Documentation
¶
Index ¶
- func New(o *options.Options, aspects aspects.Aspects, log *zerolog.Logger) (storage.FS, error)
- func NewDefault(m map[string]interface{}, bs node.Blobstore, es events.Stream, ...) (storage.FS, error)
- type CtxKey
- type Decomposedfs
- func (fs *Decomposedfs) AddGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) (err error)
- func (fs *Decomposedfs) AddLabel(ctx context.Context, ref *provider.Reference, uid *user.UserId, label string) error
- func (fs *Decomposedfs) Capabilities(_ context.Context) storage.Capabilities
- func (fs *Decomposedfs) CommitUpload(ctx context.Context, ref *provider.Reference, sessionID string, ...) error
- func (fs *Decomposedfs) ConsumeRevisionEvents(ch <-chan events.Event)
- func (fs *Decomposedfs) CreateDir(ctx context.Context, ref *provider.Reference) (_ *storage.CreateDirResult, err error)
- func (fs *Decomposedfs) CreateHome(ctx context.Context) (err error)
- func (fs *Decomposedfs) CreateReference(ctx context.Context, p string, targetURI *url.URL) (err error)
- func (fs *Decomposedfs) CreateStorageSpace(ctx context.Context, req *provider.CreateStorageSpaceRequest) (*provider.CreateStorageSpaceResponse, error)
- func (fs *Decomposedfs) Delete(ctx context.Context, ref *provider.Reference) (dr *storage.DeleteResult, err error)
- func (fs *Decomposedfs) DeleteRevision(ctx context.Context, ref *provider.Reference, revisionKey string) error
- func (fs *Decomposedfs) DeleteStorageSpace(ctx context.Context, req *provider.DeleteStorageSpaceRequest) (*storage.DeleteStorageSpaceResult, error)
- func (fs *Decomposedfs) DenyGrant(ctx context.Context, ref *provider.Reference, grantee *provider.Grantee) error
- func (fs *Decomposedfs) Download(ctx context.Context, ref *provider.Reference, ...) (*provider.ResourceInfo, io.ReadCloser, error)
- func (fs *Decomposedfs) DownloadRevision(ctx context.Context, ref *provider.Reference, revisionKey string, ...) (*provider.ResourceInfo, io.ReadCloser, error)
- func (fs *Decomposedfs) EmptyRecycle(ctx context.Context, space *provider.Reference) error
- func (fs *Decomposedfs) GetHome(ctx context.Context) (string, error)
- func (fs *Decomposedfs) GetLock(ctx context.Context, ref *provider.Reference) (*provider.Lock, error)
- func (fs *Decomposedfs) GetMD(ctx context.Context, ref *provider.Reference, mdKeys []string, ...) (ri *provider.ResourceInfo, err error)
- func (fs *Decomposedfs) GetPathByID(ctx context.Context, id *provider.ResourceId) (string, error)
- func (fs *Decomposedfs) GetQuota(ctx context.Context, ref *provider.Reference) (total uint64, inUse uint64, remaining uint64, err error)
- func (fs *Decomposedfs) IsOrphaned(ctx context.Context, ref *provider.Reference) bool
- func (fs *Decomposedfs) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys []string, ...) ([]*provider.ResourceInfo, error)
- func (fs *Decomposedfs) ListGrants(ctx context.Context, ref *provider.Reference) (grants []*provider.Grant, err error)
- func (fs *Decomposedfs) ListRecycle(ctx context.Context, space *provider.Reference, key, relativePath string) ([]*provider.RecycleItem, error)
- func (fs *Decomposedfs) ListRevisions(ctx context.Context, ref *provider.Reference) (revisions []*provider.FileVersion, err error)
- func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provider.ListStorageSpacesRequest_Filter, ...) ([]*provider.StorageSpace, error)
- func (fs *Decomposedfs) MarkProcessing(ctx context.Context, ref *provider.Reference, processing bool, ...) error
- func (fs *Decomposedfs) Move(ctx context.Context, oldRef, newRef *provider.Reference) (*storage.MoveResult, error)
- func (fs *Decomposedfs) MustCheckNodePermissions(ctx context.Context, unrestricted bool) bool
- func (fs *Decomposedfs) PrepareCreatesNode() bool
- func (fs *Decomposedfs) PrepareUpload(ctx context.Context, ref *provider.Reference, sessionID string, ...) (*storage.PrepareUploadResult, error)
- func (fs *Decomposedfs) PurgeRecycleItem(ctx context.Context, space *provider.Reference, key, relativePath string) error
- func (fs *Decomposedfs) RefreshLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock, ...) error
- func (fs *Decomposedfs) RemoveGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) (err error)
- func (fs *Decomposedfs) RemoveLabel(ctx context.Context, ref *provider.Reference, uid *user.UserId, label string) error
- func (fs *Decomposedfs) RestoreRecycleItem(ctx context.Context, space *provider.Reference, key, relativePath string, ...) (*storage.RestoreRecycleItemResult, error)
- func (fs *Decomposedfs) RestoreRevision(ctx context.Context, ref *provider.Reference, revisionKey string) (_ *storage.RestoreRevisionResult, returnErr error)
- func (fs *Decomposedfs) RollbackUpload(ctx context.Context, ref *provider.Reference, sessionID string, ...) error
- func (fs *Decomposedfs) SetArbitraryMetadata(ctx context.Context, ref *provider.Reference, md *provider.ArbitraryMetadata) (err error)
- func (fs *Decomposedfs) SetLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) (*storage.SetLockResult, error)
- func (fs *Decomposedfs) Shutdown(ctx context.Context) error
- func (fs *Decomposedfs) StorageSpaceFromNode(ctx context.Context, n *node.Node, checkPermissions bool) (*provider.StorageSpace, error)
- func (fs *Decomposedfs) TouchFile(ctx context.Context, ref *provider.Reference, markprocessing bool, ...) (*storage.TouchFileResult, error)
- func (fs *Decomposedfs) Unlock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) (*storage.UnlockResult, error)
- func (fs *Decomposedfs) UnsetArbitraryMetadata(ctx context.Context, ref *provider.Reference, keys []string) (err error)
- func (fs *Decomposedfs) UpdateGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error
- func (fs *Decomposedfs) UpdateStorageSpace(ctx context.Context, req *provider.UpdateStorageSpaceRequest) (*provider.UpdateStorageSpaceResponse, error)
- func (fs *Decomposedfs) UserIDToUserAndGroups(ctx context.Context, userid *userv1beta1.UserId) (*userv1beta1.User, error)
- func (fs *Decomposedfs) WithDisabledSpaces() storage.FS
- type DecomposedfsTrashbin
- func (tb *DecomposedfsTrashbin) EmptyRecycle(ctx context.Context, spaceID string) error
- func (fs *DecomposedfsTrashbin) IsEmpty(ctx context.Context, spaceID string) bool
- func (tb *DecomposedfsTrashbin) ListRecycle(ctx context.Context, spaceID string, key, relativePath string) ([]*provider.RecycleItem, error)
- func (tb *DecomposedfsTrashbin) PurgeRecycleItem(ctx context.Context, spaceID, key, relativePath string) error
- func (tb *DecomposedfsTrashbin) RestoreRecycleItem(ctx context.Context, spaceID string, key, relativePath string, ...) (*node.Node, error)
- func (tb *DecomposedfsTrashbin) Setup(fs storage.FS) error
- type IDCachingTree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decomposedfs ¶
Decomposedfs provides the base for decomposed filesystem implementations
func (*Decomposedfs) AddGrant ¶
func (fs *Decomposedfs) AddGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) (err error)
AddGrant adds a grant to a resource
func (*Decomposedfs) AddLabel ¶
func (fs *Decomposedfs) AddLabel(ctx context.Context, ref *provider.Reference, uid *user.UserId, label string) error
AddLabel adds a favorite
func (*Decomposedfs) Capabilities ¶
func (fs *Decomposedfs) Capabilities(_ context.Context) storage.Capabilities
Capabilities declares decomposedfs fully writeable, stated explicitly so it is a decision here and not an inherited default.
func (*Decomposedfs) CommitUpload ¶
func (fs *Decomposedfs) CommitUpload(ctx context.Context, ref *provider.Reference, sessionID string, source storage.UploadSource) error
CommitUpload writes the staged bytes from source to the resource at ref. sessionID identifies the upload that PrepareUpload wrote onto the node. Caller owns source.Body and must close it after CommitUpload returns.
The bytes are written against the real node, so drivers that keep the content in the node itself (posix) can replace it atomically. If a newer upload took over the node in the meantime, the bytes go to the revision that upload created for this session instead. Without such a revision (versioning disabled) they are discarded: nothing references them anymore.
func (*Decomposedfs) ConsumeRevisionEvents ¶
func (fs *Decomposedfs) ConsumeRevisionEvents(ch <-chan events.Event)
ConsumeRevisionEvents starts the revision event collector. Upload postprocessing results are consumed by the upload coordinator.
func (*Decomposedfs) CreateDir ¶
func (fs *Decomposedfs) CreateDir(ctx context.Context, ref *provider.Reference) (_ *storage.CreateDirResult, err error)
CreateDir creates the specified directory
func (*Decomposedfs) CreateHome ¶
func (fs *Decomposedfs) CreateHome(ctx context.Context) (err error)
CreateHome creates a new home node for the given user
func (*Decomposedfs) CreateReference ¶
func (fs *Decomposedfs) CreateReference(ctx context.Context, p string, targetURI *url.URL) (err error)
CreateReference creates a reference as a node folder with the target stored in extended attributes There is no difference between the /Shares folder and normal nodes because the storage is not supposed to be accessible without the storage provider. In effect everything is a shadow namespace. To mimic the eos and owncloud driver we only allow references as children of the "/Shares" folder FIXME: This comment should explain briefly what a reference is in this context.
func (*Decomposedfs) CreateStorageSpace ¶
func (fs *Decomposedfs) CreateStorageSpace(ctx context.Context, req *provider.CreateStorageSpaceRequest) (*provider.CreateStorageSpaceResponse, error)
CreateStorageSpace creates a storage space
func (*Decomposedfs) Delete ¶
func (fs *Decomposedfs) Delete(ctx context.Context, ref *provider.Reference) (dr *storage.DeleteResult, err error)
Delete deletes the specified resource
func (*Decomposedfs) DeleteRevision ¶
func (fs *Decomposedfs) DeleteRevision(ctx context.Context, ref *provider.Reference, revisionKey string) error
DeleteRevision deletes the specified revision of the resource
func (*Decomposedfs) DeleteStorageSpace ¶
func (fs *Decomposedfs) DeleteStorageSpace(ctx context.Context, req *provider.DeleteStorageSpaceRequest) (*storage.DeleteStorageSpaceResult, error)
DeleteStorageSpace deletes a storage space
func (*Decomposedfs) DenyGrant ¶
func (fs *Decomposedfs) DenyGrant(ctx context.Context, ref *provider.Reference, grantee *provider.Grantee) error
DenyGrant denies access to a resource.
func (*Decomposedfs) Download ¶
func (fs *Decomposedfs) Download(ctx context.Context, ref *provider.Reference, openReaderFunc func(md *provider.ResourceInfo) bool) (*provider.ResourceInfo, io.ReadCloser, error)
Download returns a reader to the specified resource
func (*Decomposedfs) DownloadRevision ¶
func (fs *Decomposedfs) DownloadRevision(ctx context.Context, ref *provider.Reference, revisionKey string, openReaderFunc func(md *provider.ResourceInfo) bool) (*provider.ResourceInfo, io.ReadCloser, error)
DownloadRevision returns a reader for the specified revision FIXME the CS3 api should explicitly allow initiating revision and trash download, a related issue is https://github.com/cs3org/reva/issues/1813
func (*Decomposedfs) EmptyRecycle ¶
func (*Decomposedfs) GetHome ¶
func (fs *Decomposedfs) GetHome(ctx context.Context) (string, error)
GetHome is called to look up the home path for a user It is NOT supposed to return the internal path but the external path
func (*Decomposedfs) GetLock ¶
func (fs *Decomposedfs) GetLock(ctx context.Context, ref *provider.Reference) (*provider.Lock, error)
GetLock returns an existing lock on the given reference
func (*Decomposedfs) GetMD ¶
func (fs *Decomposedfs) GetMD(ctx context.Context, ref *provider.Reference, mdKeys []string, fieldMask []string) (ri *provider.ResourceInfo, err error)
GetMD returns the metadata for the specified resource
func (*Decomposedfs) GetPathByID ¶
func (fs *Decomposedfs) GetPathByID(ctx context.Context, id *provider.ResourceId) (string, error)
GetPathByID returns the fn pointed by the file id, without the internal namespace
func (*Decomposedfs) GetQuota ¶
func (fs *Decomposedfs) GetQuota(ctx context.Context, ref *provider.Reference) (total uint64, inUse uint64, remaining uint64, err error)
GetQuota returns the quota available TODO Document in the cs3 should we return quota or free space?
func (*Decomposedfs) IsOrphaned ¶
IsOrphaned reports whether the referenced resource exists but its metadata is unreadable.
func (*Decomposedfs) ListFolder ¶
func (fs *Decomposedfs) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys []string, fieldMask []string) ([]*provider.ResourceInfo, error)
ListFolder returns a list of resources in the specified folder
func (*Decomposedfs) ListGrants ¶
func (fs *Decomposedfs) ListGrants(ctx context.Context, ref *provider.Reference) (grants []*provider.Grant, err error)
ListGrants lists the grants on the specified resource
func (*Decomposedfs) ListRecycle ¶
func (fs *Decomposedfs) ListRecycle(ctx context.Context, space *provider.Reference, key, relativePath string) ([]*provider.RecycleItem, error)
func (*Decomposedfs) ListRevisions ¶
func (fs *Decomposedfs) ListRevisions(ctx context.Context, ref *provider.Reference) (revisions []*provider.FileVersion, err error)
func (*Decomposedfs) ListStorageSpaces ¶
func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provider.ListStorageSpacesRequest_Filter, unrestricted bool) ([]*provider.StorageSpace, error)
ListStorageSpaces returns a list of StorageSpaces. The list can be filtered by space type or space id. Spaces are persisted with symlinks in /spaces/<type>/<spaceid> pointing to ../../nodes/<nodeid>, the root node of the space The spaceid is a concatenation of storageid + "!" + nodeid
func (*Decomposedfs) MarkProcessing ¶
func (fs *Decomposedfs) MarkProcessing(ctx context.Context, ref *provider.Reference, processing bool, sessionID string) error
MarkProcessing toggles the processing marker on a resource for a single upload session.
func (*Decomposedfs) Move ¶
func (fs *Decomposedfs) Move(ctx context.Context, oldRef, newRef *provider.Reference) (*storage.MoveResult, error)
Move moves a resource from one reference to another
func (*Decomposedfs) MustCheckNodePermissions ¶
func (fs *Decomposedfs) MustCheckNodePermissions(ctx context.Context, unrestricted bool) bool
MustCheckNodePermissions checks if permission checks are needed to be performed when user requests spaces
func (*Decomposedfs) PrepareCreatesNode ¶
func (fs *Decomposedfs) PrepareCreatesNode() bool
PrepareCreatesNode reports that PrepareUpload creates a new file's node.
func (*Decomposedfs) PrepareUpload ¶
func (fs *Decomposedfs) PrepareUpload(ctx context.Context, ref *provider.Reference, sessionID string, info storage.UploadInfo) (*storage.PrepareUploadResult, error)
PrepareUpload finalizes node metadata after bytes are received, before postprocessing, and marks the node as processing for sessionID. A new file's node is created here, under the id the ref carries. CommitUpload is called after postprocessing completes.
The previous version is snapshotted through the tree's CreateRevision, like the legacy upload path does: posix copies the current content, decomposedfs only the metadata. When another upload is still processing the node, it is snapshotted even with versioning disabled, together with that upload's processing mark: if this upload is rolled back, the other one is restored and can still finish.
With info.Source set and a blobstore that keeps blobs apart from the nodes, the upload is finished right here: the blob is stored before the node points to it, and the node is never marked. Readers get either the old or the new content, and an interrupted upload leaves no processing mark that nothing would ever remove.
func (*Decomposedfs) PurgeRecycleItem ¶
func (*Decomposedfs) RefreshLock ¶
func (fs *Decomposedfs) RefreshLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock, existingLockID string) error
RefreshLock refreshes an existing lock on the given reference
func (*Decomposedfs) RemoveGrant ¶
func (fs *Decomposedfs) RemoveGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) (err error)
RemoveGrant removes a grant from resource
func (*Decomposedfs) RemoveLabel ¶
func (fs *Decomposedfs) RemoveLabel(ctx context.Context, ref *provider.Reference, uid *user.UserId, label string) error
RemoveLabel removes a favorite
func (*Decomposedfs) RestoreRecycleItem ¶
func (fs *Decomposedfs) RestoreRecycleItem(ctx context.Context, space *provider.Reference, key, relativePath string, restoreRef *provider.Reference) (*storage.RestoreRecycleItemResult, error)
RestoreRecycleItem restores a recycle item The ref is used to determine the space The key is used to determine the recycle item. It is the node id of the recycle item, returned by ListRecycle The relativePath is the path is the path relative to the recycle item in case a child should be restored The restoreRef is the reference where the item should be restored to
func (*Decomposedfs) RestoreRevision ¶
func (fs *Decomposedfs) RestoreRevision(ctx context.Context, ref *provider.Reference, revisionKey string) (_ *storage.RestoreRevisionResult, returnErr error)
RestoreRevision restores the specified revision of the resource
func (*Decomposedfs) RollbackUpload ¶
func (fs *Decomposedfs) RollbackUpload(ctx context.Context, ref *provider.Reference, sessionID string, info storage.RollbackInfo) error
RollbackUpload reverts the node state written by PrepareUpload after a failed or aborted postprocessing run. It restores the previous revision and reverts the optimistic size propagation. Unlike upstream it never purges an existing node: without a revision (versioning disabled) the previous metadata cannot be restored, so it returns an error instead. On posix this also keeps the file itself, which still holds the previous content until CommitUpload. When the node metadata has become unreadable the ids recorded in info are used to release its quota, and to remove the node if the upload created it.
func (*Decomposedfs) SetArbitraryMetadata ¶
func (fs *Decomposedfs) SetArbitraryMetadata(ctx context.Context, ref *provider.Reference, md *provider.ArbitraryMetadata) (err error)
SetArbitraryMetadata sets the metadata on a resource
func (*Decomposedfs) SetLock ¶
func (fs *Decomposedfs) SetLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) (*storage.SetLockResult, error)
SetLock puts a lock on the given reference
func (*Decomposedfs) Shutdown ¶
func (fs *Decomposedfs) Shutdown(ctx context.Context) error
Shutdown shuts down the storage
func (*Decomposedfs) StorageSpaceFromNode ¶
func (fs *Decomposedfs) StorageSpaceFromNode(ctx context.Context, n *node.Node, checkPermissions bool) (*provider.StorageSpace, error)
func (*Decomposedfs) TouchFile ¶
func (fs *Decomposedfs) TouchFile(ctx context.Context, ref *provider.Reference, markprocessing bool, mtime string) (*storage.TouchFileResult, error)
TouchFile as defined in the storage.FS interface
func (*Decomposedfs) Unlock ¶
func (fs *Decomposedfs) Unlock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) (*storage.UnlockResult, error)
Unlock removes an existing lock from the given reference
func (*Decomposedfs) UnsetArbitraryMetadata ¶
func (fs *Decomposedfs) UnsetArbitraryMetadata(ctx context.Context, ref *provider.Reference, keys []string) (err error)
UnsetArbitraryMetadata unsets the metadata on the given resource
func (*Decomposedfs) UpdateGrant ¶
func (fs *Decomposedfs) UpdateGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error
UpdateGrant updates a grant on a resource TODO remove AddGrant or UpdateGrant grant from CS3 api, redundant? tracked in https://github.com/cs3org/cs3apis/issues/92
func (*Decomposedfs) UpdateStorageSpace ¶
func (fs *Decomposedfs) UpdateStorageSpace(ctx context.Context, req *provider.UpdateStorageSpaceRequest) (*provider.UpdateStorageSpaceResponse, error)
UpdateStorageSpace updates a storage space
func (*Decomposedfs) UserIDToUserAndGroups ¶
func (fs *Decomposedfs) UserIDToUserAndGroups(ctx context.Context, userid *userv1beta1.UserId) (*userv1beta1.User, error)
UserIDToUserAndGroups converts a user ID to a user with groups
func (*Decomposedfs) WithDisabledSpaces ¶
func (fs *Decomposedfs) WithDisabledSpaces() storage.FS
WithDisabledSpaces returns a filesystem that can list disabled spaces
type DecomposedfsTrashbin ¶
type DecomposedfsTrashbin struct {
// contains filtered or unexported fields
}
func (*DecomposedfsTrashbin) EmptyRecycle ¶
func (tb *DecomposedfsTrashbin) EmptyRecycle(ctx context.Context, spaceID string) error
EmptyRecycle empties the trash
func (*DecomposedfsTrashbin) IsEmpty ¶
func (fs *DecomposedfsTrashbin) IsEmpty(ctx context.Context, spaceID string) bool
func (*DecomposedfsTrashbin) ListRecycle ¶
func (tb *DecomposedfsTrashbin) ListRecycle(ctx context.Context, spaceID string, key, relativePath string) ([]*provider.RecycleItem, error)
ListRecycle returns the list of available recycle items ref -> the space (= resourceid), key -> deleted node id, relativePath = relative to key
func (*DecomposedfsTrashbin) PurgeRecycleItem ¶
func (tb *DecomposedfsTrashbin) PurgeRecycleItem(ctx context.Context, spaceID, key, relativePath string) error
PurgeRecycleItem purges the specified item, all its children and all their revisions