Documentation ¶
Index ¶
- func IsAttrUnset(err error) bool
- func IsNotExist(err error) bool
- type Backend
- type MessagePackBackend
- func (b MessagePackBackend) All(ctx context.Context, path string) (map[string][]byte, error)
- func (b MessagePackBackend) AllWithLockedSource(ctx context.Context, path string, source io.Reader) (map[string][]byte, error)
- func (b MessagePackBackend) Get(ctx context.Context, path, key string) ([]byte, error)
- func (b MessagePackBackend) GetInt64(ctx context.Context, path, key string) (int64, error)
- func (MessagePackBackend) IsMetaFile(path string) bool
- func (b MessagePackBackend) List(ctx context.Context, path string) ([]string, error)
- func (MessagePackBackend) LockfilePath(path string) string
- func (MessagePackBackend) MetadataPath(path string) string
- func (MessagePackBackend) Name() string
- func (b MessagePackBackend) Purge(path string) error
- func (b MessagePackBackend) Remove(ctx context.Context, path, key string, acquireLock bool) error
- func (b MessagePackBackend) Rename(oldPath, newPath string) error
- func (b MessagePackBackend) Set(ctx context.Context, path, key string, val []byte) error
- func (b MessagePackBackend) SetMultiple(ctx context.Context, path string, attribs map[string][]byte, acquireLock bool) error
- type NullBackend
- func (NullBackend) All(ctx context.Context, path string) (map[string][]byte, error)
- func (NullBackend) AllWithLockedSource(ctx context.Context, path string, source io.Reader) (map[string][]byte, error)
- func (NullBackend) Get(ctx context.Context, path, key string) ([]byte, error)
- func (NullBackend) GetInt64(ctx context.Context, path, key string) (int64, error)
- func (NullBackend) IsMetaFile(path string) bool
- func (NullBackend) List(ctx context.Context, path string) ([]string, error)
- func (NullBackend) LockfilePath(path string) string
- func (NullBackend) MetadataPath(path string) string
- func (NullBackend) Name() string
- func (NullBackend) Purge(purges string) error
- func (NullBackend) Remove(ctx context.Context, path string, key string, acquireLock bool) error
- func (NullBackend) Rename(oldPath, newPath string) error
- func (NullBackend) Set(ctx context.Context, path string, key string, val []byte) error
- func (NullBackend) SetMultiple(ctx context.Context, path string, attribs map[string][]byte, acquireLock bool) error
- type XattrsBackend
- func (b XattrsBackend) All(ctx context.Context, filePath string) (attribs map[string][]byte, err error)
- func (b XattrsBackend) AllWithLockedSource(ctx context.Context, path string, _ io.Reader) (map[string][]byte, error)
- func (b XattrsBackend) Get(ctx context.Context, filePath, key string) ([]byte, error)
- func (b XattrsBackend) GetInt64(ctx context.Context, filePath, key string) (int64, error)
- func (XattrsBackend) IsMetaFile(path string) bool
- func (XattrsBackend) List(ctx context.Context, filePath string) (attribs []string, err error)
- func (XattrsBackend) LockfilePath(path string) string
- func (XattrsBackend) MetadataPath(path string) string
- func (XattrsBackend) Name() string
- func (XattrsBackend) Purge(path string) error
- func (XattrsBackend) Remove(ctx context.Context, filePath string, key string, acquireLock bool) (err error)
- func (XattrsBackend) Rename(oldPath, newPath string) error
- func (b XattrsBackend) Set(ctx context.Context, path string, key string, val []byte) (err error)
- func (XattrsBackend) SetMultiple(ctx context.Context, path string, attribs map[string][]byte, acquireLock bool) (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 All(ctx context.Context, path string) (map[string][]byte, error) Get(ctx context.Context, path, key string) ([]byte, error) GetInt64(ctx context.Context, path, key string) (int64, error) List(ctx context.Context, path string) (attribs []string, err error) Set(ctx context.Context, path, key string, val []byte) error SetMultiple(ctx context.Context, path string, attribs map[string][]byte, acquireLock bool) error Remove(ctx context.Context, path, key string, acquireLock bool) error Purge(path string) error Rename(oldPath, newPath string) error IsMetaFile(path string) bool MetadataPath(path string) string LockfilePath(path string) string AllWithLockedSource(ctx context.Context, path string, source io.Reader) (map[string][]byte, error) }
Backend defines the interface for file attribute backends
type MessagePackBackend ¶
type MessagePackBackend struct {
// contains filtered or unexported fields
}
MessagePackBackend persists the attributes in messagepack format inside the file
func NewMessagePackBackend ¶
func NewMessagePackBackend(rootPath string, o cache.Config) MessagePackBackend
NewMessagePackBackend returns a new MessagePackBackend instance
func (MessagePackBackend) AllWithLockedSource ¶
func (b MessagePackBackend) AllWithLockedSource(ctx context.Context, path string, 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) IsMetaFile ¶
func (MessagePackBackend) IsMetaFile(path string) bool
IsMetaFile returns whether the given path represents a meta file
func (MessagePackBackend) List ¶
List retrieves a list of names of extended attributes associated with the given path in the file system.
func (MessagePackBackend) LockfilePath ¶ added in v2.15.0
func (MessagePackBackend) LockfilePath(path string) string
LockfilePath returns the path of the lock file
func (MessagePackBackend) MetadataPath ¶
func (MessagePackBackend) MetadataPath(path string) 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(path string) error
Purge purges the data of a given path
func (MessagePackBackend) Rename ¶
func (b MessagePackBackend) Rename(oldPath, newPath string) error
Rename moves the data for a given path to a new path
func (MessagePackBackend) SetMultiple ¶
func (b MessagePackBackend) SetMultiple(ctx context.Context, path string, attribs map[string][]byte, acquireLock bool) error
SetMultiple sets a set of attribute for the given path
type NullBackend ¶
type NullBackend struct{}
NullBackend is the default stub backend, used to enforce the configuration of a proper backend
func (NullBackend) AllWithLockedSource ¶
func (NullBackend) AllWithLockedSource(ctx context.Context, path string, 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) IsMetaFile ¶
func (NullBackend) IsMetaFile(path string) bool
IsMetaFile returns whether the given path represents a meta file
func (NullBackend) List ¶
List retrieves a list of names of extended attributes associated with the given path in the file system.
func (NullBackend) LockfilePath ¶ added in v2.15.0
func (NullBackend) LockfilePath(path string) string
LockfilePath returns the path of the lock file
func (NullBackend) MetadataPath ¶
func (NullBackend) MetadataPath(path string) string
MetadataPath returns the path of the file holding the metadata for the given path
func (NullBackend) Purge ¶
func (NullBackend) Purge(purges string) error
Purge purges the data of a given path from any cache that might hold it
func (NullBackend) Rename ¶
func (NullBackend) Rename(oldPath, newPath string) error
Rename moves the data for a given path to a new path
func (NullBackend) SetMultiple ¶
func (NullBackend) SetMultiple(ctx context.Context, path string, attribs map[string][]byte, acquireLock bool) error
SetMultiple sets a set of attribute for the given path
type XattrsBackend ¶
type XattrsBackend struct{}
XattrsBackend stores the file attributes in extended attributes
func (XattrsBackend) All ¶
func (b XattrsBackend) All(ctx context.Context, filePath string) (attribs map[string][]byte, err 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, path string, _ 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 ¶
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) IsMetaFile ¶
func (XattrsBackend) IsMetaFile(path string) bool
IsMetaFile returns whether the given path represents a meta file
func (XattrsBackend) List ¶
List retrieves a list of names of extended attributes associated with the given path in the file system.
func (XattrsBackend) LockfilePath ¶ added in v2.15.0
func (XattrsBackend) LockfilePath(path string) string
LockfilePath returns the path of the lock file
func (XattrsBackend) MetadataPath ¶
func (XattrsBackend) MetadataPath(path string) string
MetadataPath returns the path of the file holding the metadata for the given path
func (XattrsBackend) Purge ¶
func (XattrsBackend) Purge(path string) error
Purge purges the data of a given path
func (XattrsBackend) Remove ¶
func (XattrsBackend) Remove(ctx context.Context, filePath string, key string, acquireLock bool) (err error)
Remove an extended attribute key
func (XattrsBackend) Rename ¶
func (XattrsBackend) Rename(oldPath, newPath string) error
Rename moves the data for a given path to a new path
func (XattrsBackend) SetMultiple ¶
func (XattrsBackend) SetMultiple(ctx context.Context, path string, attribs map[string][]byte, acquireLock bool) (err error)
SetMultiple sets a set of attribute for the given path