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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeBucket

func InitializeBucket(location objectstorage.Location) error

InitializeBucket creates the Object Storage Bucket that will store the metadata

Types

type Folder

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

Folder describes a metadata folder

func NewFolder

func NewFolder(svc *providers.Service, path string) *Folder

NewFolder creates a new Metadata Folder object, ready to help access the metadata inside it

func (*Folder) Browse

func (f *Folder) Browse(path string, callback FolderDecoderCallback) error

Browse browses the content of a specific path in Metadata and executes 'cb' on each entry

func (*Folder) Delete

func (f *Folder) Delete(path string, name string) error

Delete removes metadata passed as parameter

func (*Folder) GetBucket

func (f *Folder) GetBucket() objectstorage.Bucket

GetBucket returns the bucket used by the folder to store Object Storage

func (*Folder) GetClient

func (f *Folder) GetClient() api.ClientAPI

GetClient returns the api.ClientAPI used by the folder

func (*Folder) GetPath

func (f *Folder) GetPath() string

GetPath returns the base path of the folder

func (*Folder) GetService

func (f *Folder) GetService() *providers.Service

GetService returns the service used by the folder

func (*Folder) Read

func (f *Folder) Read(path string, name string, callback FolderDecoderCallback) (bool, error)

Read loads the content of the object stored in metadata bucket returns false, nil if the object is not found returns false, err if an error occured returns true, nil if the object has been found The callback function has to know how to decode it and where to store the result

func (*Folder) Search

func (f *Folder) Search(path string, name string) (bool, error)

Search tells if the object named 'name' is inside the ObjectStorage folder

func (*Folder) Write

func (f *Folder) Write(path string, name string, content []byte) error

Write writes the content in Object Storage

type FolderDecoderCallback

type FolderDecoderCallback func([]byte) error

FolderDecoderCallback is the prototype of the function that will decode data read from Metadata

type Item

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

Item is an entry in the ObjectStorage

func NewItem

func NewItem(svc *providers.Service, path string) *Item

NewItem creates a new item with 'name' and in 'path'

func (*Item) Acquire

func (i *Item) Acquire()

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

func (*Item) Browse

func (i *Item) Browse(callback func([]byte) error) error

Browse walks through folder of item and executes a callback for each entry

func (*Item) BrowseInto

func (i *Item) BrowseInto(path string, callback func([]byte) error) error

BrowseInto walks through a subfolder ogf item folder and executes a callback for each entry

func (*Item) Carry

func (i *Item) Carry(data model.Serializable) *Item

Carry links metadata with cluster struct

func (*Item) Delete

func (i *Item) Delete(name string) error

Delete removes a metadata

func (*Item) DeleteFrom

func (i *Item) DeleteFrom(path string, name string) error

DeleteFrom removes a metadata from a folder

func (*Item) Get

func (i *Item) Get() interface{}

Get returns payload in item

func (*Item) GetBucket

func (i *Item) GetBucket() objectstorage.Bucket

GetBucket returns the bucket used by Item

func (*Item) GetClient

func (i *Item) GetClient() api.ClientAPI

GetClient returns the bucket used by Item

func (*Item) GetPath

func (i *Item) GetPath() string

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

func (*Item) GetService

func (i *Item) GetService() *providers.Service

GetService returns the service used by Item

func (*Item) Read

func (i *Item) Read(name string, callback ItemDecoderCallback) (bool, error)

Read read metadata of item from Object Storage (in current folder)

func (*Item) ReadFrom

func (i *Item) ReadFrom(path string, name string, callback ItemDecoderCallback) (bool, error)

ReadFrom reads metadata of item from Object Storage in a subfolder

func (*Item) Release

func (i *Item) Release()

Release unlocks the metadata

func (*Item) Reset

func (i *Item) Reset()

Reset ...

func (*Item) Write

func (i *Item) Write(name string) error

Write saves the content of Item to the Object Storage

func (*Item) WriteInto

func (i *Item) WriteInto(path string, name string) error

WriteInto saves the content of Item in a subfolder to the Object Storage

type ItemDecoderCallback

type ItemDecoderCallback func([]byte) (model.Serializable, error)

ItemDecoderCallback ...

Jump to

Keyboard shortcuts

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