Documentation ¶
Index ¶
- func Pathify(id string, depth, width int) string
- type IDCache
- type Lookup
- func (lu *Lookup) CacheID(ctx context.Context, spaceID, nodeID, val string) error
- func (lu *Lookup) CopyMetadata(ctx context.Context, src, target string, ...) (err error)
- func (lu *Lookup) CopyMetadataWithSourceLock(ctx context.Context, sourcePath, targetPath string, ...) (err error)
- func (lu *Lookup) GenerateSpaceID(spaceType string, owner *user.User) (string, error)
- func (lu *Lookup) GetCachedID(ctx context.Context, spaceID, nodeID string) (string, bool)
- func (lu *Lookup) IDsForPath(ctx context.Context, path string) (string, string, error)
- func (lu *Lookup) InternalPath(spaceID, nodeID string) string
- func (lu *Lookup) InternalRoot() string
- func (lu *Lookup) MetadataBackend() metadata.Backend
- func (lu *Lookup) NodeFromID(ctx context.Context, id *provider.ResourceId) (n *node.Node, err error)
- func (lu *Lookup) NodeFromResource(ctx context.Context, ref *provider.Reference) (*node.Node, error)
- func (lu *Lookup) NodeFromSpaceID(ctx context.Context, spaceID string) (n *node.Node, err error)
- func (lu *Lookup) NodeIDFromParentAndName(ctx context.Context, parent *node.Node, name string) (string, error)
- func (lu *Lookup) Path(ctx context.Context, n *node.Node, hasPermission node.PermissionFunc) (p string, err error)
- func (lu *Lookup) ReadBlobIDAttr(ctx context.Context, path string) (string, error)
- func (lu *Lookup) ReadBlobSizeAttr(ctx context.Context, path string) (int64, error)
- func (lu *Lookup) TypeFromPath(ctx context.Context, path string) provider.ResourceType
- func (lu *Lookup) WalkPath(ctx context.Context, r *node.Node, p string, followReferences bool, ...) (*node.Node, error)
- type StoreIDCache
- func (c *StoreIDCache) Delete(_ context.Context, spaceID, nodeID string) error
- func (c *StoreIDCache) DeleteByPath(ctx context.Context, path string) error
- func (c *StoreIDCache) DeletePath(ctx context.Context, path string) error
- func (c *StoreIDCache) Get(_ context.Context, spaceID, nodeID string) (string, bool)
- func (c *StoreIDCache) GetByPath(_ context.Context, val string) (string, string, bool)
- func (c *StoreIDCache) Set(_ context.Context, spaceID, nodeID, val string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IDCache ¶ added in v2.20.0
type IDCache interface { Get(ctx context.Context, spaceID, nodeID string) (string, bool) GetByPath(ctx context.Context, path string) (string, string, bool) Set(ctx context.Context, spaceID, nodeID, val string) error Delete(ctx context.Context, spaceID, nodeID string) error DeleteByPath(ctx context.Context, path string) error DeletePath(ctx context.Context, path string) error }
IDCache is a cache for node ids
type Lookup ¶
type Lookup struct { Options *options.Options IDCache IDCache // contains filtered or unexported fields }
Lookup implements transformations from filepath to node and back
func (*Lookup) CopyMetadata ¶
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 ¶
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 ¶
GenerateSpaceID generates a space id for the given space type and owner
func (*Lookup) GetCachedID ¶ added in v2.20.0
GetCachedID returns the cached path for the given space and node id
func (*Lookup) IDsForPath ¶ added in v2.21.0
IDsForPath returns the space and opaque id for the given path
func (*Lookup) InternalPath ¶
InternalPath returns the internal path for a given ID
func (*Lookup) InternalRoot ¶
InternalRoot returns the internal storage root directory
func (*Lookup) MetadataBackend ¶
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 ¶
NodeFromSpaceID converts a resource id into a Node
func (*Lookup) NodeIDFromParentAndName ¶ added in v2.20.0
func (lu *Lookup) NodeIDFromParentAndName(ctx context.Context, parent *node.Node, name string) (string, error)
NodeFromPath returns the node for the given path
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 ¶
ReadBlobIDAttr reads the blobsize from the xattrs
func (*Lookup) ReadBlobSizeAttr ¶
ReadBlobSizeAttr reads the blobsize from the xattrs
func (*Lookup) TypeFromPath ¶
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.
type StoreIDCache ¶ added in v2.20.0
type StoreIDCache struct {
// contains filtered or unexported fields
}
func NewStoreIDCache ¶ added in v2.20.0
func NewStoreIDCache(o *options.Options) *StoreIDCache
NewMemoryIDCache returns a new MemoryIDCache
func (*StoreIDCache) Delete ¶ added in v2.21.0
func (c *StoreIDCache) Delete(_ context.Context, spaceID, nodeID string) error
Delete removes an entry from the cache
func (*StoreIDCache) DeleteByPath ¶ added in v2.21.0
func (c *StoreIDCache) DeleteByPath(ctx context.Context, path string) error
DeleteByPath removes an entry from the cache
func (*StoreIDCache) DeletePath ¶ added in v2.21.0
func (c *StoreIDCache) DeletePath(ctx context.Context, path string) error
DeletePath removes only the path entry from the cache