blobstor

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: GPL-3.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobStor

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

BlobStor represents NeoFS local BLOB storage.

func New

func New(opts ...Option) *BlobStor

New creates, initializes and returns new BlobStor instance.

func (*BlobStor) Close

func (b *BlobStor) Close() error

Close releases all internal resources of BlobStor.

func (*BlobStor) DeleteBig

func (b *BlobStor) DeleteBig(prm *DeleteBigPrm) (*DeleteBigRes, error)

DeleteBig removes object from shallow dir of BLOB storage.

Returns any error encountered that did not allow to completely remove the object.

Returns ErrNotFound if there is no object to delete.

func (*BlobStor) DeleteSmall

func (b *BlobStor) DeleteSmall(prm *DeleteSmallPrm) (*DeleteSmallRes, error)

DeleteSmall removes object from blobovnicza of BLOB storage.

If blobovnicza ID is not set or set to nil, BlobStor tries to find and remove object from any blobovnicza.

Returns any error encountered that did not allow to completely remove the object.

Returns ErrObjectNotFound if there is no object to delete.

func (*BlobStor) DumpInfo

func (b *BlobStor) DumpInfo() fstree.Info

DumpInfo returns information about blob stor.

func (*BlobStor) Exists

func (b *BlobStor) Exists(prm *ExistsPrm) (*ExistsRes, error)

Exists checks if object is presented in BLOB storage.

Returns any error encountered that did not allow to completely check object existence.

func (*BlobStor) GetBig

func (b *BlobStor) GetBig(prm *GetBigPrm) (*GetBigRes, error)

GetBig reads the object from shallow dir of BLOB storage by address.

Returns any error encountered that did not allow to completely read the object.

Returns ErrNotFound if requested object is not presented in shallow dir.

func (*BlobStor) GetRangeBig

func (b *BlobStor) GetRangeBig(prm *GetRangeBigPrm) (*GetRangeBigRes, error)

GetRangeBig reads data of object payload range from shallow dir of BLOB storage.

Returns any error encountered that did not allow to completely read the object payload range.

Returns ErrRangeOutOfBounds if requested object range is out of bounds.

func (*BlobStor) GetRangeSmall

func (b *BlobStor) GetRangeSmall(prm *GetRangeSmallPrm) (*GetRangeSmallRes, error)

GetRangeSmall reads data of object payload range from blobovnicza of BLOB storage.

If blobovnicza ID is not set or set to nil, BlobStor tries to get payload range from any blobovnicza.

Returns any error encountered that did not allow to completely read the object payload range.

Returns ErrRangeOutOfBounds if requested object range is out of bounds.

func (*BlobStor) GetSmall

func (b *BlobStor) GetSmall(prm *GetSmallPrm) (*GetSmallRes, error)

GetSmall reads the object from blobovnicza of BLOB storage by address.

If blobovnicza ID is not set or set to nil, BlobStor tries to get object from any blobovnicza.

Returns any error encountered that did not allow to completely read the object.

func (*BlobStor) Init

func (b *BlobStor) Init() error

Init initializes internal data structures and system resources.

If BlobStor is already initialized, then no action is taken.

func (*BlobStor) Iterate

func (b *BlobStor) Iterate(prm *IteratePrm) (*IterateRes, error)

Iterate traverses the storage over the stored objects and calls the handler on each element.

Returns any error encountered that did not allow to completely iterate over the storage.

If handler returns an error, method returns it immediately.

func (*BlobStor) Open

func (b *BlobStor) Open() error

Open opens BlobStor.

func (*BlobStor) Put

func (b *BlobStor) Put(prm *PutPrm) (*PutRes, error)

Put saves the object in BLOB storage.

If object is "big", BlobStor saves the object in shallow dir. Otherwise, BlobStor saves the object in blobonicza. In this case the identifier of blobovnicza is returned.

Returns any error encountered that did not allow to completely save the object.

func (*BlobStor) PutRaw added in v0.19.0

func (b *BlobStor) PutRaw(addr *objectSDK.Address, data []byte) (*PutRes, error)

PutRaw saves already marshaled object in BLOB storage.

type DeleteBigPrm

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

DeleteBigPrm groups the parameters of DeleteBig operation.

func (*DeleteBigPrm) SetAddress

func (a *DeleteBigPrm) SetAddress(addr *objectSDK.Address)

SetAddress sets the address of the requested object.

type DeleteBigRes

type DeleteBigRes struct{}

DeleteBigRes groups resulting values of DeleteBig operation.

type DeleteSmallPrm

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

DeleteSmallPrm groups the parameters of DeleteSmall operation.

func (*DeleteSmallPrm) SetAddress

func (a *DeleteSmallPrm) SetAddress(addr *objectSDK.Address)

SetAddress sets the address of the requested object.

func (*DeleteSmallPrm) SetBlobovniczaID

func (v *DeleteSmallPrm) SetBlobovniczaID(id *blobovnicza.ID)

SetBlobovniczaID sets blobovnicza ID.

type DeleteSmallRes

type DeleteSmallRes struct{}

DeleteSmallRes groups resulting values of DeleteSmall operation.

type ExistsPrm

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

ExistsPrm groups the parameters of Exists operation.

func (*ExistsPrm) SetAddress

func (a *ExistsPrm) SetAddress(addr *objectSDK.Address)

SetAddress sets the address of the requested object.

type ExistsRes

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

ExistsRes groups resulting values of Exists operation.

func (ExistsRes) Exists

func (r ExistsRes) Exists() bool

Exists returns the fact that the object is in BLOB storage.

type GetBigPrm

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

GetBigPrm groups the parameters of GetBig operation.

func (*GetBigPrm) SetAddress

func (a *GetBigPrm) SetAddress(addr *objectSDK.Address)

SetAddress sets the address of the requested object.

type GetBigRes

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

GetBigRes groups resulting values of GetBig operation.

func (GetBigRes) Object

func (o GetBigRes) Object() *object.Object

Object returns the object.

type GetRangeBigPrm

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

GetRangeBigPrm groups the parameters of GetRangeBig operation.

func (*GetRangeBigPrm) SetAddress

func (a *GetRangeBigPrm) SetAddress(addr *objectSDK.Address)

SetAddress sets the address of the requested object.

func (*GetRangeBigPrm) SetRange

func (r *GetRangeBigPrm) SetRange(rng *objectSDK.Range)

SetRange sets range of the object payload.

type GetRangeBigRes

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

GetRangeBigRes groups resulting values of GetRangeBig operation.

func (GetRangeBigRes) RangeData

func (d GetRangeBigRes) RangeData() []byte

RangeData returns data of the requested payload range.

type GetRangeSmallPrm

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

GetRangeSmallPrm groups the parameters of GetRangeSmall operation.

func (*GetRangeSmallPrm) SetAddress

func (a *GetRangeSmallPrm) SetAddress(addr *objectSDK.Address)

SetAddress sets the address of the requested object.

func (*GetRangeSmallPrm) SetBlobovniczaID

func (v *GetRangeSmallPrm) SetBlobovniczaID(id *blobovnicza.ID)

SetBlobovniczaID sets blobovnicza ID.

func (*GetRangeSmallPrm) SetRange

func (r *GetRangeSmallPrm) SetRange(rng *objectSDK.Range)

SetRange sets range of the object payload.

type GetRangeSmallRes

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

GetRangeSmallRes groups resulting values of GetRangeSmall operation.

func (GetRangeSmallRes) RangeData

func (d GetRangeSmallRes) RangeData() []byte

RangeData returns data of the requested payload range.

type GetSmallPrm

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

GetSmallPrm groups the parameters of GetSmallPrm operation.

func (*GetSmallPrm) SetAddress

func (a *GetSmallPrm) SetAddress(addr *objectSDK.Address)

SetAddress sets the address of the requested object.

func (*GetSmallPrm) SetBlobovniczaID

func (v *GetSmallPrm) SetBlobovniczaID(id *blobovnicza.ID)

SetBlobovniczaID sets blobovnicza ID.

type GetSmallRes

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

GetSmallRes groups resulting values of GetSmall operation.

func (GetSmallRes) Object

func (o GetSmallRes) Object() *object.Object

Object returns the object.

type Info

type Info = fstree.Info

type IteratePrm

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

IteratePrm groups the parameters of Iterate operation.

func (*IteratePrm) SetIterationHandler

func (i *IteratePrm) SetIterationHandler(h IterationHandler)

SetIterationHandler sets the action to be performed on each iteration.

type IterateRes

type IterateRes struct{}

IterateRes groups resulting values of Iterate operation.

type IterationHandler

type IterationHandler func(*objectSDK.Address, *blobovnicza.ID) error

IterationHandler represents the action to be performed on each iteration.

type Option

type Option func(*cfg)

Option represents BlobStor's constructor option.

func WithBlobovniczaOpenedCacheSize

func WithBlobovniczaOpenedCacheSize(sz int) Option

WithBlobovniczaOpenedCacheSize return option to specify maximum number of opened non-active blobovnicza's.

func WithBlobovniczaShallowDepth

func WithBlobovniczaShallowDepth(d uint64) Option

WithBlobovniczaShallowDepth returns option to specify depth of blobovnicza directories.

func WithBlobovniczaShallowWidth

func WithBlobovniczaShallowWidth(w uint64) Option

WithBlobovniczaShallowWidth returns option to specify width of blobovnicza directories.

func WithBlobovniczaSize

func WithBlobovniczaSize(sz uint64) Option

WithBlobovniczaSize returns option to specify maximum volume of each blobovnicza.

func WithCompressObjects

func WithCompressObjects(comp bool, log *logger.Logger) Option

WithCompressObjects returns option to toggle compression of the stored objects.

If true, Zstandard algorithm is used for data compression.

If compressor (decompressor) creation failed, the uncompressed option will be used, and the error is recorded in the provided log.

func WithLogger

func WithLogger(l *logger.Logger) Option

WithLogger returns option to specify BlobStor's logger.

func WithRootPath

func WithRootPath(rootDir string) Option

WithRootPath returns option to set path to root directory of the fs tree to write the objects.

func WithRootPerm

func WithRootPerm(perm fs.FileMode) Option

WithRootPerm returns option to set permission bits of the fs tree.

func WithShallowDepth

func WithShallowDepth(depth int) Option

WithShallowDepth returns option to set the depth of the object file subdirectory tree.

Depth is reduced to maximum value in case of overflow.

func WithSmallSizeLimit

func WithSmallSizeLimit(lim uint64) Option

WithSmallSizeLimit returns option to set maximum size of "small" object.

type PutPrm

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

PutPrm groups the parameters of Put operation.

func (*PutPrm) SetObject

func (o *PutPrm) SetObject(obj *object.Object)

SetObject sets the object.

type PutRes

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

PutRes groups resulting values of Put operation.

func (PutRes) BlobovniczaID

func (v PutRes) BlobovniczaID() *blobovnicza.ID

BlobovniczaID returns blobovnicza ID.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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