tree

package
v0.31.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: GPL-3.0 Imports: 9 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
)

Functions

func GetFilename added in v0.31.0

func GetFilename(node NodeResponse) string

Types

type GetNodesParams

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

type Meta

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

type MultiID added in v0.31.0

type MultiID []uint64

func (MultiID) Equal added in v0.31.0

func (m MultiID) Equal(id MultiID) bool

type NodeResponse

type NodeResponse interface {
	GetMeta() []Meta
	GetTimestamp() []uint64
	GetNodeID() []uint64
	GetParentID() []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, sort bool) ([]NodeResponse, error)
}

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

type Tree

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

func NewTree

func NewTree(service ServiceClient) *Tree

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

func (*Tree) GetLatestVersion

func (c *Tree) GetLatestVersion(ctx context.Context, cnrID *cid.ID, objectName string) (*api.NodeVersion, error)

func (*Tree) GetSubTreeByPrefix added in v0.31.0

func (c *Tree) GetSubTreeByPrefix(ctx context.Context, bktInfo *data.BucketInfo, prefix string, latestOnly bool) ([]NodeResponse, string, error)

func (*Tree) GetVersions added in v0.31.0

func (c *Tree) GetVersions(ctx context.Context, cnrID *cid.ID, objectName string) ([]NodeResponse, error)

Jump to

Keyboard shortcuts

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