tree

package
v0.29.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileNameKey = "FileName"
)

Variables

View Source
var (
	// ErrNodeNotFound is returned from ServiceClient in case of not found error.
	ErrNodeNotFound = layer.ErrNodeNotFound

	// ErrNodeAccessDenied is returned from ServiceClient service in case of access denied error.
	ErrNodeAccessDenied = layer.ErrNodeAccessDenied

	// ErrGatewayTimeout is returned from ServiceClient service in case of timeout error.
	ErrGatewayTimeout = layer.ErrGatewayTimeout
)

Functions

This section is empty.

Types

type DummySubTreeStream added in v0.29.0

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

func (*DummySubTreeStream) Next added in v0.29.0

func (s *DummySubTreeStream) Next() (NodeResponse, error)

type GetNodesParams

type GetNodesParams struct {
	BktInfo    *data.BucketInfo
	TreeID     string
	Path       []string
	Meta       []string
	LatestOnly bool
	AllAttrs   bool
}

type Meta

type Meta interface {
	GetKey() string
	GetValue() []byte
}

type NodeResponse

type NodeResponse interface {
	GetMeta() []Meta
	GetNodeID() uint64
	GetParentID() uint64
	GetTimestamp() uint64
}

type ServiceClient

type ServiceClient interface {
	GetNodes(ctx context.Context, p *GetNodesParams) ([]NodeResponse, error)
	GetSubTree(ctx context.Context, bktInfo *data.BucketInfo, treeID string, rootID uint64, depth uint32) ([]NodeResponse, error)
	GetSubTreeStream(ctx context.Context, bktInfo *data.BucketInfo, treeID string, rootID uint64, depth uint32) (SubTreeStream, error)
	AddNode(ctx context.Context, bktInfo *data.BucketInfo, treeID string, parent uint64, meta map[string]string) (uint64, error)
	AddNodeByPath(ctx context.Context, bktInfo *data.BucketInfo, treeID string, path []string, meta map[string]string) (uint64, error)
	MoveNode(ctx context.Context, bktInfo *data.BucketInfo, treeID string, nodeID, parentID uint64, meta map[string]string) error
	RemoveNode(ctx context.Context, bktInfo *data.BucketInfo, treeID string, nodeID uint64) error
}

ServiceClient is a client to interact with tree service. Each method must return ErrNodeNotFound or ErrNodeAccessDenied if relevant.

type ServiceClientMemory

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

func NewTreeServiceClientMemory

func NewTreeServiceClientMemory() (*ServiceClientMemory, error)

func (*ServiceClientMemory) AddNode

func (c *ServiceClientMemory) AddNode(ctx context.Context, bktInfo *data.BucketInfo, treeID string, parent uint64, meta map[string]string) (uint64, error)

func (*ServiceClientMemory) AddNodeBase added in v0.29.0

func (c *ServiceClientMemory) AddNodeBase(_ context.Context, bktInfo *data.BucketInfo, treeID string, parent uint64, meta map[string]string, needSort bool) (uint64, error)

func (*ServiceClientMemory) AddNodeByPath

func (c *ServiceClientMemory) AddNodeByPath(_ context.Context, bktInfo *data.BucketInfo, treeID string, path []string, meta map[string]string) (uint64, error)

func (*ServiceClientMemory) GetNodes

func (*ServiceClientMemory) GetSubTree

func (c *ServiceClientMemory) GetSubTree(_ context.Context, bktInfo *data.BucketInfo, treeID string, rootID uint64, depth uint32) ([]NodeResponse, error)

func (*ServiceClientMemory) GetSubTreeStream added in v0.29.0

func (c *ServiceClientMemory) GetSubTreeStream(_ context.Context, bktInfo *data.BucketInfo, treeID string, rootID uint64, depth uint32) (SubTreeStream, error)

func (*ServiceClientMemory) MoveNode

func (c *ServiceClientMemory) MoveNode(_ context.Context, bktInfo *data.BucketInfo, treeID string, nodeID, parentID uint64, meta map[string]string) error

func (*ServiceClientMemory) RemoveNode

func (c *ServiceClientMemory) RemoveNode(_ context.Context, bktInfo *data.BucketInfo, treeID string, nodeID uint64) error

type SubTreeStream added in v0.29.0

type SubTreeStream interface {
	Next() (NodeResponse, error)
}

type SubTreeStreamMemoryImpl added in v0.29.0

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

func (*SubTreeStreamMemoryImpl) Next added in v0.29.0

type Tree

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

func NewTree

func NewTree(service ServiceClient, log *zap.Logger) *Tree

NewTree creates instance of Tree using provided address and create grpc connection.

func (*Tree) AddPart

func (c *Tree) AddPart(ctx context.Context, bktInfo *data.BucketInfo, multipartNodeID uint64, info *data.PartInfo) (oldObjIDToDelete oid.ID, err error)

func (*Tree) AddVersion

func (c *Tree) AddVersion(ctx context.Context, bktInfo *data.BucketInfo, version *data.NodeVersion) (uint64, error)

func (*Tree) CreateMultipartUpload

func (c *Tree) CreateMultipartUpload(ctx context.Context, bktInfo *data.BucketInfo, info *data.MultipartInfo) error

func (*Tree) DeleteBucketCORS

func (c *Tree) DeleteBucketCORS(ctx context.Context, bktInfo *data.BucketInfo) (oid.ID, error)

func (*Tree) DeleteBucketTagging

func (c *Tree) DeleteBucketTagging(ctx context.Context, bktInfo *data.BucketInfo) error

func (*Tree) DeleteMultipartUpload

func (c *Tree) DeleteMultipartUpload(ctx context.Context, bktInfo *data.BucketInfo, multipartInfo *data.MultipartInfo) error

func (*Tree) DeleteObjectTagging

func (c *Tree) DeleteObjectTagging(ctx context.Context, bktInfo *data.BucketInfo, objVersion *data.NodeVersion) error

func (*Tree) GetBucketCORS

func (c *Tree) GetBucketCORS(ctx context.Context, bktInfo *data.BucketInfo) (oid.ID, error)

func (*Tree) GetBucketTagging

func (c *Tree) GetBucketTagging(ctx context.Context, bktInfo *data.BucketInfo) (map[string]string, error)

func (*Tree) GetLatestVersion

func (c *Tree) GetLatestVersion(ctx context.Context, bktInfo *data.BucketInfo, objectName string) (*data.NodeVersion, error)

func (*Tree) GetLock

func (c *Tree) GetLock(ctx context.Context, bktInfo *data.BucketInfo, nodeID uint64) (*data.LockInfo, error)

func (*Tree) GetMultipartUpload

func (c *Tree) GetMultipartUpload(ctx context.Context, bktInfo *data.BucketInfo, objectName, uploadID string) (*data.MultipartInfo, error)

func (*Tree) GetMultipartUploadsByPrefix

func (c *Tree) GetMultipartUploadsByPrefix(ctx context.Context, bktInfo *data.BucketInfo, prefix string) ([]*data.MultipartInfo, error)

func (*Tree) GetNotificationConfigurationNode

func (c *Tree) GetNotificationConfigurationNode(ctx context.Context, bktInfo *data.BucketInfo) (oid.ID, error)

func (*Tree) GetObjectTagging

func (c *Tree) GetObjectTagging(ctx context.Context, bktInfo *data.BucketInfo, objVersion *data.NodeVersion) (map[string]string, error)

func (*Tree) GetObjectTaggingAndLock

func (c *Tree) GetObjectTaggingAndLock(ctx context.Context, bktInfo *data.BucketInfo, objVersion *data.NodeVersion) (map[string]string, *data.LockInfo, error)

func (*Tree) GetParts

func (c *Tree) GetParts(ctx context.Context, bktInfo *data.BucketInfo, multipartNodeID uint64) ([]*data.PartInfo, error)

func (*Tree) GetSettingsNode

func (c *Tree) GetSettingsNode(ctx context.Context, bktInfo *data.BucketInfo) (*data.BucketSettings, error)

func (*Tree) GetUnversioned

func (c *Tree) GetUnversioned(ctx context.Context, bktInfo *data.BucketInfo, filepath string) (*data.NodeVersion, error)

func (*Tree) GetVersions

func (c *Tree) GetVersions(ctx context.Context, bktInfo *data.BucketInfo, filepath string) ([]*data.NodeVersion, error)

func (*Tree) InitVersionsByPrefixStream added in v0.29.0

func (c *Tree) InitVersionsByPrefixStream(ctx context.Context, bktInfo *data.BucketInfo, prefix string, latestOnly bool) (data.VersionsStream, error)

func (*Tree) PutBucketCORS

func (c *Tree) PutBucketCORS(ctx context.Context, bktInfo *data.BucketInfo, objID oid.ID) (oid.ID, error)

func (*Tree) PutBucketTagging

func (c *Tree) PutBucketTagging(ctx context.Context, bktInfo *data.BucketInfo, tagSet map[string]string) error

func (*Tree) PutLock

func (c *Tree) PutLock(ctx context.Context, bktInfo *data.BucketInfo, nodeID uint64, lock *data.LockInfo) error

func (*Tree) PutNotificationConfigurationNode

func (c *Tree) PutNotificationConfigurationNode(ctx context.Context, bktInfo *data.BucketInfo, objID oid.ID) (oid.ID, error)

func (*Tree) PutObjectTagging

func (c *Tree) PutObjectTagging(ctx context.Context, bktInfo *data.BucketInfo, objVersion *data.NodeVersion, tagSet map[string]string) error

func (*Tree) PutSettingsNode

func (c *Tree) PutSettingsNode(ctx context.Context, bktInfo *data.BucketInfo, settings *data.BucketSettings) error

func (*Tree) RemoveVersion

func (c *Tree) RemoveVersion(ctx context.Context, bktInfo *data.BucketInfo, id uint64) error

type VersionsByPrefixStreamImpl added in v0.29.0

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

func (*VersionsByPrefixStreamImpl) Next added in v0.29.0

Jump to

Keyboard shortcuts

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