tree

package
v2.25.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSizeUnlimited = errors.New("blobstore size unlimited")
)

Functions

func ReadSpaceAndNodeFromIndexLink(link string) (string, string, error)

ReadSpaceAndNodeFromIndexLink reads a symlink and parses space and node id if the link has the correct format, eg: ../../spaces/4c/510ada-c86b-4815-8820-42cdf82c3d51/nodes/4c/51/0a/da/-c86b-4815-8820-42cdf82c3d51 ../../spaces/4c/510ada-c86b-4815-8820-42cdf82c3d51/nodes/4c/51/0a/da/-c86b-4815-8820-42cdf82c3d51.T.2022-02-24T12:35:18.196484592Z

Types

type Blobstore

type Blobstore interface {
	Upload(node *node.Node, source string) error
	Download(node *node.Node) (io.ReadCloser, error)
	Delete(node *node.Node) error
	GetAvailableSize(node *node.Node) (uint64, error)
}

Blobstore defines an interface for storing blobs in a blobstore

type PermissionCheckFunc

type PermissionCheckFunc func(rp *provider.ResourcePermissions) bool

PermissionCheckFunc defined a function used to check resource permissions

type Tree

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

Tree manages a hierarchical tree

func New

func New(lu node.PathLookup, bs Blobstore, o *options.Options, cache store.Store) *Tree

New returns a new instance of Tree

func (*Tree) BuildSpaceIDIndexEntry added in v2.20.0

func (t *Tree) BuildSpaceIDIndexEntry(spaceID, nodeID string) string

BuildSpaceIDIndexEntry returns the entry for the space id index

func (*Tree) CreateDir

func (t *Tree) CreateDir(ctx context.Context, n *node.Node) (err error)

CreateDir creates a new directory entry in the tree

func (*Tree) Delete

func (t *Tree) Delete(ctx context.Context, n *node.Node) (err error)

Delete deletes a node in the tree by moving it to the trash

func (*Tree) DeleteBlob

func (t *Tree) DeleteBlob(node *node.Node) error

DeleteBlob deletes a blob from the blobstore

func (*Tree) GetMD

func (t *Tree) GetMD(ctx context.Context, n *node.Node) (os.FileInfo, error)

GetMD returns the metadata of a node in the tree

func (*Tree) InitNewNode added in v2.20.0

func (t *Tree) InitNewNode(ctx context.Context, n *node.Node, fsize uint64) (metadata.UnlockFunc, error)

InitNewNode initializes a new node

func (*Tree) ListFolder

func (t *Tree) ListFolder(ctx context.Context, n *node.Node) ([]*node.Node, error)

ListFolder lists the content of a folder node

func (*Tree) Move

func (t *Tree) Move(ctx context.Context, oldNode *node.Node, newNode *node.Node) (err error)

Move replaces the target with the source

func (*Tree) Propagate

func (t *Tree) Propagate(ctx context.Context, n *node.Node, sizeDiff int64) (err error)

Propagate propagates changes to the root of the tree

func (*Tree) PurgeRecycleItemFunc

func (t *Tree) PurgeRecycleItemFunc(ctx context.Context, spaceid, key string, path string) (*node.Node, func() error, error)

PurgeRecycleItemFunc returns a node and a function to purge it from the trash

func (*Tree) ReadBlob

func (t *Tree) ReadBlob(node *node.Node) (io.ReadCloser, error)

ReadBlob reads a blob from the blobstore

func (*Tree) ResolveSpaceIDIndexEntry added in v2.20.0

func (t *Tree) ResolveSpaceIDIndexEntry(_, entry string) (string, string, error)

ResolveSpaceIDIndexEntry returns the node id for the space id index entry

func (*Tree) RestoreRecycleItemFunc

func (t *Tree) RestoreRecycleItemFunc(ctx context.Context, spaceid, key, trashPath string, targetNode *node.Node) (*node.Node, *node.Node, func() error, error)

RestoreRecycleItemFunc returns a node and a function to restore it from the trash.

func (*Tree) Setup

func (t *Tree) Setup() error

Setup prepares the tree structure

func (*Tree) TouchFile added in v2.6.1

func (t *Tree) TouchFile(ctx context.Context, n *node.Node, markprocessing bool, mtime string) error

TouchFile creates a new empty file

func (*Tree) WriteBlob

func (t *Tree) WriteBlob(node *node.Node, source string) error

WriteBlob writes a blob to the blobstore

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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