Documentation
¶
Index ¶
- Variables
- type MetadataStorer
- type NoMeta
- func (NoMeta) DeleteAttribute(_, _, _ string) error
- func (NoMeta) DeleteAttributes(bucket, object string) error
- func (NoMeta) ListAttributes(_, _ string) ([]string, error)
- func (NoMeta) RenameObject(_, _, _ string) error
- func (NoMeta) ReplaceObject(_, _ string, _ []string) error
- func (NoMeta) RetrieveAttribute(_ *os.File, _, _, _ string) ([]byte, error)
- func (NoMeta) StoreAttribute(_ *os.File, _, _, _ string, _ []byte) error
- type RootDirSetter
- type SideCar
- func (s SideCar) DeleteAttribute(bucket, object, attribute string) error
- func (s SideCar) DeleteAttributes(bucket, object string) error
- func (s SideCar) ListAttributes(bucket, object string) ([]string, error)
- func (s SideCar) RenameObject(bucket, oldObject, newObject string) error
- func (s SideCar) ReplaceObject(bucket, object string, keep []string) error
- func (s SideCar) RetrieveAttribute(_ *os.File, bucket, object, attribute string) ([]byte, error)
- func (s SideCar) StoreAttribute(_ *os.File, bucket, object, attribute string, value []byte) error
- type XattrMeta
- func (x XattrMeta) DeleteAttribute(bucket, object, attribute string) error
- func (x XattrMeta) DeleteAttributes(bucket, object string) error
- func (x XattrMeta) ListAttributes(bucket, object string) ([]string, error)
- func (x XattrMeta) RenameObject(_, _, _ string) error
- func (x XattrMeta) ReplaceObject(_, _ string, _ []string) error
- func (x XattrMeta) RetrieveAttribute(f *os.File, bucket, object, attribute string) ([]byte, error)
- func (x XattrMeta) StoreAttribute(f *os.File, bucket, object, attribute string, value []byte) error
- func (x XattrMeta) Test(path string) error
- func (x XattrMeta) WithRootDir(rootdir string) MetadataStorer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoSuchKey is returned when the key does not exist. ErrNoSuchKey = errors.New("no such key") )
Functions ¶
This section is empty.
Types ¶
type MetadataStorer ¶
type MetadataStorer interface {
// RetrieveAttribute retrieves the value of a specific attribute for an object or a bucket.
// Returns the value of the attribute, or an error if the attribute does not exist.
RetrieveAttribute(f *os.File, bucket, object, attribute string) ([]byte, error)
// StoreAttribute stores the value of a specific attribute for an object or a bucket.
// If attribute already exists, new attribute should replace existing.
// Returns an error if the operation fails.
StoreAttribute(f *os.File, bucket, object, attribute string, value []byte) error
// DeleteAttribute removes the value of a specific attribute for an object or a bucket.
// Returns an error if the operation fails.
DeleteAttribute(bucket, object, attribute string) error
// ListAttributes lists all attributes for an object or a bucket.
// Returns list of attribute names, or an error if the operation fails.
ListAttributes(bucket, object string) ([]string, error)
// DeleteAttributes removes all attributes for an object or a bucket.
// Returns an error if the operation fails.
DeleteAttributes(bucket, object string) error
// RenameObject renames all stored metadata from oldObject to newObject
// within the given bucket. This must be called whenever the data
// directory for an object is renamed so that metadata stays in sync.
RenameObject(bucket, oldObject, newObject string) error
// ReplaceObject removes the attributes of an object, other than the
// ones named in keep, when a new file replaces the object's file. This
// must be called whenever a new file is published at an object's path
// so that it doesn't inherit the metadata of the replaced file. The
// attributes in keep are the ones the new file sets anyway: they are
// overwritten instead of removed, so that they never go missing for
// concurrent readers.
ReplaceObject(bucket, object string, keep []string) error
}
MetadataStorer defines the interface for managing metadata. When object == "", the operation is on the bucket.
type NoMeta ¶ added in v1.0.10
type NoMeta struct{}
NoMeta is a metadata storer that does not store metadata. This can be useful for read only mounts where attempting to store metadata would fail.
func (NoMeta) DeleteAttribute ¶ added in v1.0.10
DeleteAttribute removes the value of a specific attribute for an object or a bucket. always returns nil without deleting the attribute
func (NoMeta) DeleteAttributes ¶ added in v1.0.10
DeleteAttributes removes all attributes for an object or a bucket. always returns nil without deleting any attributes
func (NoMeta) ListAttributes ¶ added in v1.0.10
ListAttributes lists all attributes for an object or a bucket. always returns an empty list of attributes
func (NoMeta) RenameObject ¶ added in v1.4.1
RenameObject is a no-op because NoMeta does not store metadata.
func (NoMeta) ReplaceObject ¶ added in v1.9.0
ReplaceObject is a no-op because NoMeta does not store metadata.
func (NoMeta) RetrieveAttribute ¶ added in v1.0.10
RetrieveAttribute retrieves the value of a specific attribute for an object or a bucket. always returns ErrNoSuchKey
type RootDirSetter ¶ added in v1.9.0
type RootDirSetter interface {
WithRootDir(rootdir string) MetadataStorer
}
RootDirSetter is implemented by metadata storers that keep metadata on the bucket and object files themselves and therefore need to know where those files live. A backend that does not change the process working directory to its root calls WithRootDir with the absolute path of the root before using the storer; the returned storer resolves bucket names against that directory instead of the working directory. Storers that keep metadata elsewhere (SideCar, NoMeta) do not implement it.
A type that embeds XattrMeta inherits its WithRootDir, which returns a bare XattrMeta and so drops the outer type; such a type must provide its own WithRootDir.
type SideCar ¶ added in v1.0.10
type SideCar struct {
// contains filtered or unexported fields
}
SideCar is a metadata storer that uses sidecar files to store metadata.
func NewSideCar ¶ added in v1.0.10
NewSideCar creates a new SideCar metadata storer.
func (SideCar) DeleteAttribute ¶ added in v1.0.10
DeleteAttribute removes the value of a specific attribute for an object or a bucket.
func (SideCar) DeleteAttributes ¶ added in v1.0.10
DeleteAttributes removes all attributes for an object or a bucket. When object is empty the entire bucket sidecar directory is removed, cleaning up any orphaned object or multipart metadata within it.
func (SideCar) ListAttributes ¶ added in v1.0.10
ListAttributes lists all attributes for an object or a bucket.
func (SideCar) RenameObject ¶ added in v1.4.1
RenameObject renames the sidecar metadata directory from oldObject to newObject so that path-based lookups continue to work after the data directory has been renamed.
func (SideCar) ReplaceObject ¶ added in v1.9.0
ReplaceObject removes the attributes of the object other than the ones in keep. The attributes are stored at the object's path, so they would otherwise outlive the replaced file. Directories in the metadata directory hold the metadata of the objects under "<object>/meta/" and are left in place.
func (SideCar) RetrieveAttribute ¶ added in v1.0.10
RetrieveAttribute retrieves the value of a specific attribute for an object or a bucket.
type XattrMeta ¶
type XattrMeta struct {
// contains filtered or unexported fields
}
XattrMeta stores metadata as extended attributes on the bucket and object files. The zero value resolves bucket names against the process working directory, which the posix backend sets to its root directory; a backend that keeps the working directory supplies the root through WithRootDir.
func (XattrMeta) DeleteAttribute ¶
DeleteAttribute removes the value of a specific attribute for an object in a bucket.
func (XattrMeta) DeleteAttributes ¶
DeleteAttributes is not implemented for xattr since xattrs are automatically removed when the file is deleted.
func (XattrMeta) ListAttributes ¶
ListAttributes lists all attributes for an object in a bucket.
func (XattrMeta) RenameObject ¶ added in v1.4.1
RenameObject is a no-op for xattr because extended attributes are stored on the inodes and follow the file/directory when it is renamed.
func (XattrMeta) ReplaceObject ¶ added in v1.9.0
ReplaceObject is a no-op for xattr because extended attributes are stored on the inodes: the replaced file takes its attributes with it, and the new file has only the ones set on it.
func (XattrMeta) RetrieveAttribute ¶
RetrieveAttribute retrieves the value of a specific attribute for an object in a bucket.
func (XattrMeta) StoreAttribute ¶
StoreAttribute stores the value of a specific attribute for an object in a bucket.
func (XattrMeta) WithRootDir ¶ added in v1.9.0
func (x XattrMeta) WithRootDir(rootdir string) MetadataStorer
WithRootDir returns a copy of x that resolves bucket names against rootdir.