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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Folder

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

Folder describes a metadata folder

func NewFolder

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

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) GetPath

func (f *Folder) GetPath() string

GetPath returns the base path of the folder

func (*Folder) GetService

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

GetService returns the service used by the folder

func (*Folder) Read

func (f *Folder) Read(path string, name string, callback FolderDecoderCallback) 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 occurred 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) 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 iaas.Service, path string) (*Item, error)

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

func (*Item) Acquire

func (i *Item) Acquire()

Acquire waits until the 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 and item folder and executes a callback for each entry

func (*Item) Carry

func (i *Item) Carry(data serialize.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) 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() iaas.Service

GetService returns the service used by Item

func (*Item) Read

func (i *Item) Read(name string, callback ItemDecoderCallback) 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) 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() *Item

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

func (*Item) Written

func (i *Item) Written() bool

Written tells if the item has already been written in Object Storage

type ItemDecoderCallback

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

ItemDecoderCallback ...

Jump to

Keyboard shortcuts

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