Documentation
¶
Index ¶
- func IsAttrUnset(err error) bool
- func IsNotDir(err error) bool
- func IsNotExist(err error) bool
- type Backend
- type HybridBackend
- func (b HybridBackend) All(ctx context.Context, n MetadataNode) (map[string][]byte, error)
- func (b HybridBackend) AllWithLockedSource(ctx context.Context, n MetadataNode, _ io.Reader) (map[string][]byte, error)
- func (b HybridBackend) Get(ctx context.Context, n MetadataNode, key string) ([]byte, error)
- func (b HybridBackend) GetInt64(ctx context.Context, n MetadataNode, key string) (int64, error)
- func (b HybridBackend) IdentifyPath(_ context.Context, path string) (string, string, string, time.Time, error)
- func (HybridBackend) IsMetaFile(path string) bool
- func (b HybridBackend) Lock(n MetadataNode) (UnlockFunc, error)
- func (b HybridBackend) LockfilePath(n MetadataNode) string
- func (b HybridBackend) MetadataPath(n MetadataNode) string
- func (HybridBackend) Name() string
- func (b HybridBackend) Purge(ctx context.Context, n MetadataNode) error
- func (b HybridBackend) Remove(ctx context.Context, n MetadataNode, key string, acquireLock bool) error
- func (b HybridBackend) Rename(oldNode, newNode MetadataNode) error
- func (b HybridBackend) Set(ctx context.Context, n MetadataNode, key string, val []byte) (err error)
- func (b HybridBackend) SetMultiple(ctx context.Context, n MetadataNode, attribs map[string][]byte, ...) (err error)
- type MessagePackBackend
- func (b MessagePackBackend) All(ctx context.Context, n MetadataNode) (map[string][]byte, error)
- func (b MessagePackBackend) AllWithLockedSource(ctx context.Context, n MetadataNode, source io.Reader) (map[string][]byte, error)
- func (b MessagePackBackend) Get(ctx context.Context, n MetadataNode, key string) ([]byte, error)
- func (b MessagePackBackend) GetInt64(ctx context.Context, n MetadataNode, key string) (int64, error)
- func (b MessagePackBackend) IdentifyPath(_ context.Context, path string) (string, string, string, time.Time, error)
- func (MessagePackBackend) IsMetaFile(path string) bool
- func (b MessagePackBackend) Lock(n MetadataNode) (UnlockFunc, error)
- func (MessagePackBackend) LockfilePath(n MetadataNode) string
- func (MessagePackBackend) MetadataPath(n MetadataNode) string
- func (MessagePackBackend) Name() string
- func (b MessagePackBackend) Purge(_ context.Context, n MetadataNode) error
- func (b MessagePackBackend) Remove(ctx context.Context, n MetadataNode, key string, acquireLock bool) error
- func (b MessagePackBackend) Rename(oldNode, newNode MetadataNode) error
- func (b MessagePackBackend) Set(ctx context.Context, n MetadataNode, key string, val []byte) error
- func (b MessagePackBackend) SetMultiple(ctx context.Context, n MetadataNode, attribs map[string][]byte, ...) error
- type MetadataNode
- type MetadataPathFunc
- type NullBackend
- func (NullBackend) All(ctx context.Context, n MetadataNode) (map[string][]byte, error)
- func (NullBackend) AllWithLockedSource(ctx context.Context, n MetadataNode, source io.Reader) (map[string][]byte, error)
- func (NullBackend) Get(ctx context.Context, n MetadataNode, key string) ([]byte, error)
- func (NullBackend) GetInt64(ctx context.Context, n MetadataNode, key string) (int64, error)
- func (NullBackend) IdentifyPath(ctx context.Context, path string) (string, string, string, time.Time, error)
- func (NullBackend) IsMetaFile(path string) bool
- func (NullBackend) Lock(n MetadataNode) (UnlockFunc, error)
- func (NullBackend) LockfilePath(n MetadataNode) string
- func (NullBackend) MetadataPath(n MetadataNode) string
- func (NullBackend) Name() string
- func (NullBackend) Purge(_ context.Context, n MetadataNode) error
- func (NullBackend) Remove(ctx context.Context, n MetadataNode, key string, acquireLock bool) error
- func (NullBackend) Rename(oldNode, newNode MetadataNode) error
- func (NullBackend) Set(ctx context.Context, n MetadataNode, key string, val []byte) error
- func (NullBackend) SetMultiple(ctx context.Context, n MetadataNode, attribs map[string][]byte, ...) error
- type UnlockFunc
- type XattrsBackend
- func (b XattrsBackend) All(ctx context.Context, n MetadataNode) (map[string][]byte, error)
- func (b XattrsBackend) AllWithLockedSource(ctx context.Context, n MetadataNode, _ io.Reader) (map[string][]byte, error)
- func (b XattrsBackend) Get(ctx context.Context, n MetadataNode, key string) ([]byte, error)
- func (b XattrsBackend) GetInt64(ctx context.Context, n MetadataNode, key string) (int64, error)
- func (b XattrsBackend) IdentifyPath(_ context.Context, path string) (string, string, string, time.Time, error)
- func (XattrsBackend) IsMetaFile(path string) bool
- func (b XattrsBackend) Lock(n MetadataNode) (UnlockFunc, error)
- func (XattrsBackend) LockfilePath(n MetadataNode) string
- func (XattrsBackend) MetadataPath(n MetadataNode) string
- func (XattrsBackend) Name() string
- func (b XattrsBackend) Purge(ctx context.Context, n MetadataNode) error
- func (b XattrsBackend) Remove(ctx context.Context, n MetadataNode, key string, acquireLock bool) error
- func (b XattrsBackend) Rename(oldNode, newNode MetadataNode) error
- func (b XattrsBackend) Set(ctx context.Context, n MetadataNode, key string, val []byte) (err error)
- func (b XattrsBackend) SetMultiple(ctx context.Context, n MetadataNode, attribs map[string][]byte, ...) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAttrUnset ¶
IsAttrUnset checks the xattr.ENOATTR from the xattr package which redifines it as ENODATA on platforms that do not natively support it (eg. linux) see https://github.com/pkg/xattr/blob/8725d4ccc0fcef59c8d9f0eaf606b3c6f962467a/xattr_linux.go#L19-L22
func IsNotExist ¶
IsNotExist checks if there is a os not exists error buried inside the xattr error, as we cannot just use os.IsNotExist().
Types ¶
type Backend ¶
type Backend interface {
Name() string
IdentifyPath(ctx context.Context, path string) (string, string, string, time.Time, error)
All(ctx context.Context, n MetadataNode) (map[string][]byte, error)
AllWithLockedSource(ctx context.Context, n MetadataNode, source io.Reader) (map[string][]byte, error)
Get(ctx context.Context, n MetadataNode, key string) ([]byte, error)
GetInt64(ctx context.Context, n MetadataNode, key string) (int64, error)
Set(ctx context.Context, n MetadataNode, key string, val []byte) error
SetMultiple(ctx context.Context, n MetadataNode, attribs map[string][]byte, acquireLock bool) error
Remove(ctx context.Context, n MetadataNode, key string, acquireLock bool) error
Lock(n MetadataNode) (UnlockFunc, error)
Purge(ctx context.Context, n MetadataNode) error
Rename(oldNode, newNode MetadataNode) error
MetadataPath(n MetadataNode) string
LockfilePath(n MetadataNode) string
IsMetaFile(path string) bool
}
Backend defines the interface for file attribute backends
type HybridBackend ¶
type HybridBackend struct {
// contains filtered or unexported fields
}
HybridBackend stores the file attributes in extended attributes
func NewHybridBackend ¶
func NewHybridBackend(offloadLimit int, metadataPathFunc MetadataPathFunc, o cache.Config) HybridBackend
NewMessageBackend returns a new HybridBackend instance
func (HybridBackend) All ¶
func (b HybridBackend) All(ctx context.Context, n MetadataNode) (map[string][]byte, error)
All reads all extended attributes for a node, protected by a shared file lock
func (HybridBackend) AllWithLockedSource ¶
func (b HybridBackend) AllWithLockedSource(ctx context.Context, n MetadataNode, _ io.Reader) (map[string][]byte, error)
AllWithLockedSource reads all extended attributes from the given reader. The path argument is used for storing the data in the cache
func (HybridBackend) Get ¶
func (b HybridBackend) Get(ctx context.Context, n MetadataNode, key string) ([]byte, error)
Get an extended attribute value for the given key No file locking is involved here as reading a single xattr is considered to be atomic.
func (HybridBackend) GetInt64 ¶
func (b HybridBackend) GetInt64(ctx context.Context, n MetadataNode, key string) (int64, error)
GetInt64 reads a string as int64 from the xattrs
func (HybridBackend) IdentifyPath ¶
func (b HybridBackend) IdentifyPath(_ context.Context, path string) (string, string, string, time.Time, error)
IdentifyPath returns the space id, node id and mtime of a file
func (HybridBackend) IsMetaFile ¶
func (HybridBackend) IsMetaFile(path string) bool
IsMetaFile returns whether the given path represents a meta file
func (HybridBackend) Lock ¶
func (b HybridBackend) Lock(n MetadataNode) (UnlockFunc, error)
Lock locks the metadata for the given path
func (HybridBackend) LockfilePath ¶
func (b HybridBackend) LockfilePath(n MetadataNode) string
LockfilePath returns the path of the lock file
func (HybridBackend) MetadataPath ¶
func (b HybridBackend) MetadataPath(n MetadataNode) string
MetadataPath returns the path of the file holding the metadata for the given path
func (HybridBackend) Purge ¶
func (b HybridBackend) Purge(ctx context.Context, n MetadataNode) error
Purge purges the data of a given path
func (HybridBackend) Remove ¶
func (b HybridBackend) Remove(ctx context.Context, n MetadataNode, key string, acquireLock bool) error
Remove an extended attribute key
func (HybridBackend) Rename ¶
func (b HybridBackend) Rename(oldNode, newNode MetadataNode) error
Rename moves the data for a given path to a new path
func (HybridBackend) Set ¶
func (b HybridBackend) Set(ctx context.Context, n MetadataNode, key string, val []byte) (err error)
Set sets one attribute for the given path
func (HybridBackend) SetMultiple ¶
func (b HybridBackend) SetMultiple(ctx context.Context, n MetadataNode, attribs map[string][]byte, acquireLock bool) (err error)
SetMultiple sets a set of attribute for the given path
type MessagePackBackend ¶
type MessagePackBackend struct {
// contains filtered or unexported fields
}
MessagePackBackend persists the attributes in messagepack format inside the file
func NewMessagePackBackend ¶
func NewMessagePackBackend(o cache.Config) MessagePackBackend
NewMessagePackBackend returns a new MessagePackBackend instance
func (MessagePackBackend) All ¶
func (b MessagePackBackend) All(ctx context.Context, n MetadataNode) (map[string][]byte, error)
All reads all extended attributes for a node
func (MessagePackBackend) AllWithLockedSource ¶
func (b MessagePackBackend) AllWithLockedSource(ctx context.Context, n MetadataNode, source io.Reader) (map[string][]byte, error)
AllWithLockedSource reads all extended attributes from the given reader (if possible). The path argument is used for storing the data in the cache
func (MessagePackBackend) Get ¶
func (b MessagePackBackend) Get(ctx context.Context, n MetadataNode, key string) ([]byte, error)
Get an extended attribute value for the given key
func (MessagePackBackend) GetInt64 ¶
func (b MessagePackBackend) GetInt64(ctx context.Context, n MetadataNode, key string) (int64, error)
GetInt64 reads a string as int64 from the xattrs
func (MessagePackBackend) IdentifyPath ¶
func (b MessagePackBackend) IdentifyPath(_ context.Context, path string) (string, string, string, time.Time, error)
IdentifyPath returns the id and mtime of a file
func (MessagePackBackend) IsMetaFile ¶
func (MessagePackBackend) IsMetaFile(path string) bool
IsMetaFile returns whether the given path represents a meta file
func (MessagePackBackend) Lock ¶
func (b MessagePackBackend) Lock(n MetadataNode) (UnlockFunc, error)
Lock locks the metadata for the given path
func (MessagePackBackend) LockfilePath ¶
func (MessagePackBackend) LockfilePath(n MetadataNode) string
LockfilePath returns the path of the lock file
func (MessagePackBackend) MetadataPath ¶
func (MessagePackBackend) MetadataPath(n MetadataNode) string
MetadataPath returns the path of the file holding the metadata for the given path
func (MessagePackBackend) Name ¶
func (MessagePackBackend) Name() string
Name returns the name of the backend
func (MessagePackBackend) Purge ¶
func (b MessagePackBackend) Purge(_ context.Context, n MetadataNode) error
Purge purges the data of a given path
func (MessagePackBackend) Remove ¶
func (b MessagePackBackend) Remove(ctx context.Context, n MetadataNode, key string, acquireLock bool) error
Remove an extended attribute key
func (MessagePackBackend) Rename ¶
func (b MessagePackBackend) Rename(oldNode, newNode MetadataNode) error
Rename moves the data for a given path to a new path
func (MessagePackBackend) Set ¶
func (b MessagePackBackend) Set(ctx context.Context, n MetadataNode, key string, val []byte) error
Set sets one attribute for the given path
func (MessagePackBackend) SetMultiple ¶
func (b MessagePackBackend) SetMultiple(ctx context.Context, n MetadataNode, attribs map[string][]byte, acquireLock bool) error
SetMultiple sets a set of attribute for the given path
type MetadataNode ¶
type MetadataPathFunc ¶
type MetadataPathFunc func(MetadataNode) string
type NullBackend ¶
type NullBackend struct{}
NullBackend is the default stub backend, used to enforce the configuration of a proper backend
func (NullBackend) All ¶
func (NullBackend) All(ctx context.Context, n MetadataNode) (map[string][]byte, error)
All reads all extended attributes for a node
func (NullBackend) AllWithLockedSource ¶
func (NullBackend) AllWithLockedSource(ctx context.Context, n MetadataNode, source io.Reader) (map[string][]byte, error)
AllWithLockedSource reads all extended attributes from the given reader The path argument is used for storing the data in the cache
func (NullBackend) Get ¶
func (NullBackend) Get(ctx context.Context, n MetadataNode, key string) ([]byte, error)
Get an extended attribute value for the given key
func (NullBackend) GetInt64 ¶
func (NullBackend) GetInt64(ctx context.Context, n MetadataNode, key string) (int64, error)
GetInt64 reads a string as int64 from the xattrs
func (NullBackend) IdentifyPath ¶
func (NullBackend) IdentifyPath(ctx context.Context, path string) (string, string, string, time.Time, error)
IdentifyPath returns the ids and mtime of a file
func (NullBackend) IsMetaFile ¶
func (NullBackend) IsMetaFile(path string) bool
IsMetaFile returns whether the given path represents a meta file
func (NullBackend) Lock ¶
func (NullBackend) Lock(n MetadataNode) (UnlockFunc, error)
Lock locks the metadata for the given path
func (NullBackend) LockfilePath ¶
func (NullBackend) LockfilePath(n MetadataNode) string
LockfilePath returns the path of the lock file
func (NullBackend) MetadataPath ¶
func (NullBackend) MetadataPath(n MetadataNode) string
MetadataPath returns the path of the file holding the metadata for the given path
func (NullBackend) Purge ¶
func (NullBackend) Purge(_ context.Context, n MetadataNode) error
Purge purges the data of a given path from any cache that might hold it
func (NullBackend) Remove ¶
func (NullBackend) Remove(ctx context.Context, n MetadataNode, key string, acquireLock bool) error
Remove removes an extended attribute key
func (NullBackend) Rename ¶
func (NullBackend) Rename(oldNode, newNode MetadataNode) error
Rename moves the data for a given path to a new path
func (NullBackend) Set ¶
func (NullBackend) Set(ctx context.Context, n MetadataNode, key string, val []byte) error
Set sets one attribute for the given path
func (NullBackend) SetMultiple ¶
func (NullBackend) SetMultiple(ctx context.Context, n MetadataNode, attribs map[string][]byte, acquireLock bool) error
SetMultiple sets a set of attribute for the given path
type UnlockFunc ¶
type UnlockFunc func() error
type XattrsBackend ¶
type XattrsBackend struct {
// contains filtered or unexported fields
}
XattrsBackend stores the file attributes in extended attributes
func NewXattrsBackend ¶
func NewXattrsBackend(o cache.Config) XattrsBackend
NewMessageBackend returns a new XattrsBackend instance
func (XattrsBackend) All ¶
func (b XattrsBackend) All(ctx context.Context, n MetadataNode) (map[string][]byte, error)
All reads all extended attributes for a node, protected by a shared file lock
func (XattrsBackend) AllWithLockedSource ¶
func (b XattrsBackend) AllWithLockedSource(ctx context.Context, n MetadataNode, _ io.Reader) (map[string][]byte, error)
AllWithLockedSource reads all extended attributes from the given reader. The path argument is used for storing the data in the cache
func (XattrsBackend) Get ¶
func (b XattrsBackend) Get(ctx context.Context, n MetadataNode, key string) ([]byte, error)
Get an extended attribute value for the given key No file locking is involved here as reading a single xattr is considered to be atomic.
func (XattrsBackend) GetInt64 ¶
func (b XattrsBackend) GetInt64(ctx context.Context, n MetadataNode, key string) (int64, error)
GetInt64 reads a string as int64 from the xattrs
func (XattrsBackend) IdentifyPath ¶
func (b XattrsBackend) IdentifyPath(_ context.Context, path string) (string, string, string, time.Time, error)
IdentifyPath returns the space id, node id and mtime of a file
func (XattrsBackend) IsMetaFile ¶
func (XattrsBackend) IsMetaFile(path string) bool
IsMetaFile returns whether the given path represents a meta file
func (XattrsBackend) Lock ¶
func (b XattrsBackend) Lock(n MetadataNode) (UnlockFunc, error)
Lock locks the metadata for the given path
func (XattrsBackend) LockfilePath ¶
func (XattrsBackend) LockfilePath(n MetadataNode) string
LockfilePath returns the path of the lock file
func (XattrsBackend) MetadataPath ¶
func (XattrsBackend) MetadataPath(n MetadataNode) string
MetadataPath returns the path of the file holding the metadata for the given path
func (XattrsBackend) Purge ¶
func (b XattrsBackend) Purge(ctx context.Context, n MetadataNode) error
Purge purges the data of a given path
func (XattrsBackend) Remove ¶
func (b XattrsBackend) Remove(ctx context.Context, n MetadataNode, key string, acquireLock bool) error
Remove an extended attribute key
func (XattrsBackend) Rename ¶
func (b XattrsBackend) Rename(oldNode, newNode MetadataNode) error
Rename moves the data for a given path to a new path
func (XattrsBackend) Set ¶
func (b XattrsBackend) Set(ctx context.Context, n MetadataNode, key string, val []byte) (err error)
Set sets one attribute for the given path
func (XattrsBackend) SetMultiple ¶
func (b XattrsBackend) SetMultiple(ctx context.Context, n MetadataNode, attribs map[string][]byte, acquireLock bool) (err error)
SetMultiple sets a set of attribute for the given path