lookup

package
v2.19.7 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectBackendOnDisk added in v2.13.0

func DetectBackendOnDisk(root string) string

DetectBackendOnDisk returns the name of the metadata backend being used on disk

func Pathify

func Pathify(id string, depth, width int) string

Pathify segments the beginning of a string into depth segments of width length Pathify("aabbccdd", 3, 1) will return "a/a/b/bccdd"

Types

type Lookup

type Lookup struct {
	Options *options.Options
	// contains filtered or unexported fields
}

Lookup implements transformations from filepath to node and back

func New added in v2.13.0

New returns a new Lookup instance

func (*Lookup) CopyMetadata added in v2.13.0

func (lu *Lookup) CopyMetadata(ctx context.Context, src, target string, filter func(attributeName string, value []byte) (newValue []byte, copy bool), acquireTargetLock bool) (err error)

CopyMetadata copies all extended attributes from source to target. The optional filter function can be used to filter by attribute name, e.g. by checking a prefix For the source file, a shared lock is acquired. NOTE: target resource will be write locked!

func (*Lookup) CopyMetadataWithSourceLock added in v2.13.0

func (lu *Lookup) CopyMetadataWithSourceLock(ctx context.Context, sourcePath, targetPath string, filter func(attributeName string, value []byte) (newValue []byte, copy bool), lockedSource *lockedfile.File, acquireTargetLock bool) (err error)

CopyMetadataWithSourceLock copies all extended attributes from source to target. The optional filter function can be used to filter by attribute name, e.g. by checking a prefix For the source file, a matching lockedfile is required. NOTE: target resource will be write locked!

func (*Lookup) GenerateSpaceID added in v2.19.0

func (lu *Lookup) GenerateSpaceID(spaceType string, owner *user.User) (string, error)

GenerateSpaceID generates a new space id and alias

func (*Lookup) InternalPath

func (lu *Lookup) InternalPath(spaceID, nodeID string) string

InternalPath returns the internal path for a given ID

func (*Lookup) InternalRoot

func (lu *Lookup) InternalRoot() string

InternalRoot returns the internal storage root directory

func (*Lookup) MetadataBackend added in v2.13.0

func (lu *Lookup) MetadataBackend() metadata.Backend

MetadataBackend returns the metadata backend

func (*Lookup) NodeFromID

func (lu *Lookup) NodeFromID(ctx context.Context, id *provider.ResourceId) (n *node.Node, err error)

NodeFromID returns the internal path for the id

func (*Lookup) NodeFromResource

func (lu *Lookup) NodeFromResource(ctx context.Context, ref *provider.Reference) (*node.Node, error)

NodeFromResource takes in a request path or request id and converts it to a Node

func (*Lookup) NodeFromSpaceID

func (lu *Lookup) NodeFromSpaceID(ctx context.Context, spaceID string) (n *node.Node, err error)

NodeFromSpaceID converts a resource id into a Node

func (*Lookup) Path

func (lu *Lookup) Path(ctx context.Context, n *node.Node, hasPermission node.PermissionFunc) (p string, err error)

Path returns the path for node

func (*Lookup) ReadBlobIDAttr added in v2.13.0

func (lu *Lookup) ReadBlobIDAttr(ctx context.Context, path string) (string, error)

ReadBlobIDAttr reads the blobsize from the xattrs

func (*Lookup) ReadBlobSizeAttr added in v2.13.0

func (lu *Lookup) ReadBlobSizeAttr(ctx context.Context, path string) (int64, error)

ReadBlobSizeAttr reads the blobsize from the xattrs

func (*Lookup) TypeFromPath added in v2.13.0

func (lu *Lookup) TypeFromPath(ctx context.Context, path string) provider.ResourceType

TypeFromPath returns the type of the node at the given path

func (*Lookup) WalkPath

func (lu *Lookup) WalkPath(ctx context.Context, r *node.Node, p string, followReferences bool, f func(ctx context.Context, n *node.Node) error) (*node.Node, error)

WalkPath calls n.Child(segment) on every path segment in p starting at the node r. If a function f is given it will be executed for every segment node, but not the root node r. If followReferences is given the current visited reference node is replaced by the referenced node.

Jump to

Keyboard shortcuts

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