metadata

package
v19.10.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 12 Imported by: 8

Documentation

Index

Constants

View Source
const (
	//ByIDFolderName tells in what folder to put 'byID' information
	ByIDFolderName = "byID"
	//ByNameFolderName tells in what folder to store 'byName' information
	ByNameFolderName = "byName"
	// BucketNamePrefix is the beginning of the name of the bucket for Metadata
	BucketNamePrefix = "0.safescale"
)

Variables

This section is empty.

Functions

func LoadShare

func LoadShare(svc iaas.Service, ref string) (share string, err error)

LoadShare returns the name of the host owing the share 'ref', read from Object Storage logic: Read by ID; if error is ErrNotFound then read by name; if error is ErrNotFound return this error

In case of any other error, abort the retry to propagate the error
If retry times out, return errNotFound

func RemoveHost

func RemoveHost(svc iaas.Service, host *resources.Host) (err error)

RemoveHost removes the host definition from Object Storage

func RemoveNetwork

func RemoveNetwork(svc iaas.Service, net *resources.Network) (err error)

RemoveNetwork removes the Network definition from Object Storage

func RemoveShare

func RemoveShare(svc iaas.Service, hostID, hostName, shareID, shareName string) error

RemoveShare removes the share definition from Object Storage

func RemoveVolume

func RemoveVolume(svc iaas.Service, volumeID string) (err error)

RemoveVolume removes the Volume definition from Object Storage

Types

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

Gateway links Object Storage folder and Network

func LoadGateway

func LoadGateway(svc iaas.Service, networkID string) (mg *Gateway, err error)

LoadGateway returns the metadata of the Gateway of a network

func NewGateway

func NewGateway(svc iaas.Service, networkID string) (gw *Gateway, err error)

NewGateway creates an instance of metadata.Gateway

func SaveGateway

func SaveGateway(svc iaas.Service, host *resources.Host, networkID string) (mg *Gateway, err error)

SaveGateway saves the metadata of a gateway

func (*Gateway) Acquire

func (mg *Gateway) Acquire()

Acquire waits until the write lock is available, then locks the metadata

func (*Gateway) Carry

func (mg *Gateway) Carry(host *resources.Host) (gw *Gateway, err error)

Carry links a Network instance to the Metadata instance

func (*Gateway) Delete

func (mg *Gateway) Delete() (err error)

Delete updates the metadata of the network concerning the gateway

func (*Gateway) Get

func (mg *Gateway) Get() (*resources.Host, error)

Get returns the *resources.Host linked to the metadata

func (*Gateway) Read

func (mg *Gateway) Read() (err error)

Read reads the metadata of a gateway of a network identified by ID from Object Storage

func (*Gateway) Release

func (mg *Gateway) Release()

Release unlocks the metadata

func (*Gateway) Reload

func (mg *Gateway) Reload() (err error)

Reload reloads the content of the Object Storage, overriding what is in the metadata instance It's advised to Acquire/Release around Reload()...

func (*Gateway) Write

func (mg *Gateway) Write() error

Write updates the metadata corresponding to the network in the Object Storage A Gateway is a particular host : we want it listed in hosts, but not listed as attached to the network

type Host

type Host struct {
	// contains filtered or unexported fields
}

Host links Object Storage folder and Network

func LoadHost

func LoadHost(svc iaas.Service, ref string) (mh *Host, err error)

LoadHost gets the host definition from Object Storage logic: Read by ID; if error is ErrNotFound then read by name; if error is ErrNotFound return this error

In case of any other error, abort the retry to propagate the error
If retry times out, return errNotFound

func NewHost

func NewHost(svc iaas.Service) (*Host, error)

NewHost creates an instance of api.Host

func SaveHost

func SaveHost(svc iaas.Service, host *resources.Host) (mh *Host, err error)

SaveHost saves the Host definition in Object Storage

func (*Host) Acquire

func (mh *Host) Acquire()

Acquire waits until the write lock is available, then locks the metadata

func (*Host) Browse

func (mh *Host) Browse(callback func(*resources.Host) error) (err error)

Browse walks through host folder and executes a callback for each entries

func (*Host) Carry

func (mh *Host) Carry(host *resources.Host) (*Host, error)

Carry links an host instance to the Metadata instance

func (*Host) Delete

func (mh *Host) Delete() (err error)

Delete updates the metadata corresponding to the host

func (*Host) Get

func (mh *Host) Get() (*resources.Host, error)

Get returns the Network instance linked to metadata

func (*Host) ReadByID

func (mh *Host) ReadByID(id string) (err error)

ReadByID reads the metadata of a network identified by ID from Object Storage

func (*Host) ReadByName

func (mh *Host) ReadByName(name string) (err error)

ReadByName reads the metadata of a host identified by name

func (*Host) ReadByReference

func (mh *Host) ReadByReference(id string) (err error)

ReadByReference ...

func (*Host) Release

func (mh *Host) Release()

Release unlocks the metadata

func (*Host) Write

func (mh *Host) Write() (err error)

Write updates the metadata corresponding to the host in the Object Storage

type Network

type Network struct {
	// contains filtered or unexported fields
}

Network links Object Storage folder and Network

func LoadNetwork

func LoadNetwork(svc iaas.Service, ref string) (mn *Network, err error)

LoadNetwork gets the Network definition from Object Storage logic: Read by ID; if error is ErrNotFound then read by name; if error is ErrNotFound return this error

In case of any other error, abort the retry to propagate the error
If retry times out, return errNotFound

func NewNetwork

func NewNetwork(svc iaas.Service) (*Network, error)

NewNetwork creates an instance of network.Metadata

func SaveNetwork

func SaveNetwork(svc iaas.Service, net *resources.Network) (mn *Network, err error)

SaveNetwork saves the Network definition in Object Storage

func (*Network) Acquire

func (m *Network) Acquire()

Acquire waits until the write lock is available, then locks the metadata

func (*Network) AttachHost

func (m *Network) AttachHost(host *resources.Host) (err error)

AttachHost links host ID to the network

func (*Network) Browse

func (m *Network) Browse(callback func(*resources.Network) error) (err error)

Browse walks through all the metadata objects in network

func (*Network) Carry

func (m *Network) Carry(network *resources.Network) (*Network, error)

Carry links a Network instance to the Metadata instance

func (*Network) Delete

func (m *Network) Delete() (err error)

Delete deletes the metadata corresponding to the network

func (*Network) DetachHost

func (m *Network) DetachHost(hostID string) (err error)

DetachHost unlinks host ID from network

func (*Network) Get

func (m *Network) Get() (*resources.Network, error)

Get returns the resources.Network instance linked to metadata

func (*Network) GetPath

func (m *Network) GetPath() (string, error)

GetPath returns the path in Object Storage where the item is stored

func (*Network) GetService

func (m *Network) GetService() iaas.Service

GetService returns the provider service used

func (*Network) ListHosts

func (m *Network) ListHosts() (list []*resources.Host, err error)

ListHosts returns the list of resources.Host attached to the network (excluding gateway)

func (*Network) ReadByID

func (m *Network) ReadByID(id string) (err error)

ReadByID reads the metadata of a network identified by ID from Object Storage

func (*Network) ReadByName

func (m *Network) ReadByName(name string) (err error)

ReadByName reads the metadata of a network identified by name

func (*Network) ReadByReference

func (m *Network) ReadByReference(ref string) (err error)

ReadByReference tries to read first using 'ref' as an ID then as a name

func (*Network) Release

func (m *Network) Release()

Release unlocks the metadata

func (*Network) Reload

func (m *Network) Reload() (err error)

Reload reloads the content of the Object Storage, overriding what is in the metadata instance

func (*Network) Write

func (m *Network) Write() (err error)

Write updates the metadata corresponding to the network in the Object Storage

type Share

type Share struct {
	// contains filtered or unexported fields
}

Share contains information to maintain in Object Storage a list of shared folders

func NewShare

func NewShare(svc iaas.Service) (*Share, error)

NewShare creates an instance of metadata.Nas

func SaveShare

func SaveShare(svc iaas.Service, hostID, hostName, shareID, shareName string) (*Share, error)

SaveShare saves the Nas definition in Object Storage

func (*Share) Acquire

func (ms *Share) Acquire()

Acquire waits until the write lock is available, then locks the metadata.

May panic (see scerr.OnPanic() usage to intercept and translate it to an error)

func (*Share) Browse

func (ms *Share) Browse(callback func(string, string) error) error

Browse walks through shares folder and executes a callback for each entry

func (*Share) Carry

func (ms *Share) Carry(hostID, hostName, shareID, shareName string) (*Share, error)

Carry links an export instance to the Metadata instance

func (*Share) Delete

func (ms *Share) Delete() error

Delete updates the metadata corresponding to the share

func (*Share) Get

func (ms *Share) Get() (string, error)

Get returns the ID of the host owning the share

func (*Share) ReadByID

func (ms *Share) ReadByID(id string) error

ReadByID reads the metadata of an export identified by ID from Object Storage

func (*Share) ReadByName

func (ms *Share) ReadByName(name string) error

ReadByName reads the metadata of a nas identified by name

func (*Share) ReadByReference

func (ms *Share) ReadByReference(id string) (err error)

ReadByReference tries to read 'ref' as an ID, and if not found as a name

func (*Share) Release

func (ms *Share) Release()

Release unlocks the metadata

May panic (see scerr.OnPanic() usage to intercept and translate it to an error)

func (*Share) Write

func (ms *Share) Write() error

Write updates the metadata corresponding to the share in the Object Storage

type Volume

type Volume struct {
	// contains filtered or unexported fields
}

Volume links Object Storage folder and Volumes

func LoadVolume

func LoadVolume(svc iaas.Service, ref string) (mv *Volume, err error)

LoadVolume gets the Volume definition from Object Storage logic: Read by ID; if error is ErrNotFound then read by name; if error is ErrNotFound return this error

In case of any other error, abort the retry to propagate the error
If retry times out, return errNotFound

func NewVolume

func NewVolume(svc iaas.Service) (*Volume, error)

NewVolume creates an instance of metadata.Volume

func SaveVolume

func SaveVolume(svc iaas.Service, volume *resources.Volume) (mv *Volume, err error)

SaveVolume saves the Volume definition in Object Storage

func (*Volume) Browse

func (mv *Volume) Browse(callback func(*resources.Volume) error) (err error)

Browse walks through volume folder and executes a callback for each entries

func (*Volume) Carry

func (mv *Volume) Carry(volume *resources.Volume) (*Volume, error)

Carry links a Volume instance to the Metadata instance

func (*Volume) Delete

func (mv *Volume) Delete() (err error)

Delete delete the metadata corresponding to the volume

func (*Volume) Get

func (mv *Volume) Get() (*resources.Volume, error)

Get returns the Volume instance linked to metadata

func (*Volume) ReadByID

func (mv *Volume) ReadByID(id string) error

ReadByID reads the metadata of a volume identified by ID from Object Storage

func (*Volume) ReadByName

func (mv *Volume) ReadByName(name string) error

ReadByName reads the metadata of a volume identified by name

func (*Volume) ReadByReference

func (mv *Volume) ReadByReference(ref string) (err error)

ReadByReference tries to read with 'ref' as id, then if not found as name

func (*Volume) Reload

func (mv *Volume) Reload() error

Reload reloads the content of the Object Storage, overriding what is in the metadata instance

func (*Volume) Write

func (mv *Volume) Write() error

Write updates the metadata corresponding to the volume in the Object Storage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL