metadata

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

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 begining of the name of the bucket for Metadata
	BucketNamePrefix = "0.safescale"
)

Variables

This section is empty.

Functions

func BuildMetadataBucketName

func BuildMetadataBucketName(id string) string

BuildMetadataBucketName builds the name of the bucket/container that will store metadata id must be a unique identifier of the tenant (not the tenant itself, probability of having same name for 2 different customers isn't zero; this can be domain or project name)

func LoadShare

func LoadShare(svc *providers.Service, ref string) (string, error)

LoadShare returns the name of the host owing the share 'ref', read from Object Storage

func RemoveHost

func RemoveHost(svc *providers.Service, host *model.Host) error

RemoveHost removes the host definition from Object Storage

func RemoveNetwork

func RemoveNetwork(svc *providers.Service, net *model.Network) error

RemoveNetwork removes the Network definition from Object Storage

func RemoveShare

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

RemoveShare removes the share definition from Object Storage

func RemoveVolume

func RemoveVolume(svc *providers.Service, volumeID string) error

RemoveVolume removes the Volume definition from Object Storage

func SaveGateway

func SaveGateway(svc *providers.Service, host *model.Host, networkID string) error

SaveGateway saves the metadata of a gateway

func SaveHost

func SaveHost(svc *providers.Service, host *model.Host) error

SaveHost saves the Host definition in Object Storage

func SaveNetwork

func SaveNetwork(svc *providers.Service, net *model.Network) error

SaveNetwork saves the Network definition in Object Storage

func SaveShare

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

SaveShare saves the Nas definition in Object Storage

func SaveVolume

func SaveVolume(svc *providers.Service, volume *model.Volume) error

SaveVolume saves the Volume definition in 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 *providers.Service, networkID string) (*Gateway, error)

LoadGateway returns the metadata of the Gateway of a network

func NewGateway

func NewGateway(svc *providers.Service, networkID string) (*Gateway, error)

NewGateway creates an instance of metadata.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 *model.Host) *Gateway

Carry links a Network instance to the Metadata instance

func (*Gateway) Delete

func (mg *Gateway) Delete() error

Delete updates the metadata of the network concerning the gateway

func (*Gateway) Get

func (mg *Gateway) Get() *model.Host

Get returns the *model.Host linked to the metadata

func (*Gateway) Read

func (mg *Gateway) Read() (bool, 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() error

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

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 *providers.Service, ref string) (*Host, error)

LoadHost gets the host definition from Object Storage

func LoadHostByID

func LoadHostByID(svc *providers.Service, hostID string) (*Host, error)

LoadHostByID gets the host definition from Object Storage

func LoadHostByName

func LoadHostByName(svc *providers.Service, hostName string) (*Host, error)

LoadHostByName gets the Network definition from Object Storage

func NewHost

func NewHost(svc *providers.Service) *Host

NewHost creates an instance of api.Host

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(*model.Host) error) error

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

func (*Host) Carry

func (mh *Host) Carry(host *model.Host) *Host

Carry links an host instance to the Metadata instance

func (*Host) Delete

func (mh *Host) Delete() error

Delete updates the metadata corresponding to the network

func (*Host) Get

func (mh *Host) Get() *model.Host

Get returns the Network instance linked to metadata

func (*Host) ReadByID

func (mh *Host) ReadByID(id string) (bool, error)

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

func (*Host) ReadByName

func (mh *Host) ReadByName(name string) (bool, error)

ReadByName reads the metadata of a network identified by name

func (*Host) Release

func (mh *Host) Release()

Release unlocks the metadata

func (*Host) Write

func (mh *Host) Write() 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 *providers.Service, ref string) (*Network, error)

LoadNetwork gets the Network definition from Object Storage

func LoadNetworkByID

func LoadNetworkByID(svc *providers.Service, networkID string) (*Network, error)

LoadNetworkByID gets the Network definition from Object Storage

func LoadNetworkByName

func LoadNetworkByName(svc *providers.Service, networkname string) (*Network, error)

LoadNetworkByName gets the Network definition from Object Storage

func NewNetwork

func NewNetwork(svc *providers.Service) *Network

NewNetwork creates an instance of network.Metadata

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 *model.Host) error

AttachHost links host ID to the network

func (*Network) Browse

func (m *Network) Browse(callback func(*model.Network) error) error

Browse walks through all the metadata objects in network

func (*Network) Carry

func (m *Network) Carry(network *model.Network) *Network

Carry links a Network instance to the Metadata instance

func (*Network) Delete

func (m *Network) Delete() error

Delete deletes the metadata corresponding to the network

func (*Network) DetachHost

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

DetachHost unlinks host ID to network

func (*Network) Get

func (m *Network) Get() *model.Network

Get returns the model.Network instance linked to metadata

func (*Network) GetPath

func (m *Network) GetPath() string

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

func (*Network) ListHosts

func (m *Network) ListHosts() ([]*model.Host, error)

ListHosts returns the list of model.Host attached to the network (not including gateway)

func (*Network) ReadByID

func (m *Network) ReadByID(id string) (bool, error)

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

func (*Network) ReadByName

func (m *Network) ReadByName(name string) (bool, error)

ReadByName reads the metadata of a network identified by name

func (*Network) Release

func (m *Network) Release()

Release unlocks the metadata

func (*Network) Reload

func (m *Network) Reload() error

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

func (*Network) Write

func (m *Network) Write() 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 *providers.Service) *Share

NewShare creates an instance of metadata.Nas

func (*Share) Acquire

func (ms *Share) Acquire()

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

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

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

Get returns the ID of the host owning the share

func (*Share) ReadByID

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

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

func (*Share) ReadByName

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

ReadByName reads the metadata of a nas identified by name

func (*Share) Release

func (ms *Share) Release()

Release unlocks the metadata

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 *providers.Service, ref string) (*Volume, error)

LoadVolume gets the Volume definition from Object Storage

func NewVolume

func NewVolume(svc *providers.Service) *Volume

NewVolume creates an instance of metadata.Volume

func (*Volume) Browse

func (mv *Volume) Browse(callback func(*model.Volume) error) error

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

func (*Volume) Carry

func (mv *Volume) Carry(volume *model.Volume) *Volume

Carry links a Volume instance to the Metadata instance

func (*Volume) Delete

func (mv *Volume) Delete() error

Delete delete the metadata corresponding to the volume

func (*Volume) Get

func (mv *Volume) Get() *model.Volume

Get returns the Volume instance linked to metadata

func (*Volume) ReadByID

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

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

func (*Volume) ReadByName

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

ReadByName reads the metadata of a volume identified by 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