Documentation ¶
Index ¶
- Variables
- func New(o *options.Options, lu *Lookup, p PermissionsChecker, tp Tree) (storage.FS, error)
- func NewDefault(m map[string]interface{}, bs tree.Blobstore) (storage.FS, error)
- type Decomposedfs
- func (fs *Decomposedfs) AddGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) (err error)
- func (fs *Decomposedfs) AsConcatableUpload(upload tusd.Upload) tusd.ConcatableUpload
- func (fs *Decomposedfs) AsLengthDeclarableUpload(upload tusd.Upload) tusd.LengthDeclarableUpload
- func (fs *Decomposedfs) AsTerminatableUpload(upload tusd.Upload) tusd.TerminatableUpload
- func (fs *Decomposedfs) CreateDir(ctx context.Context, ref *provider.Reference) (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) (err error)
- func (fs *Decomposedfs) DenyGrant(ctx context.Context, ref *provider.Reference, g *provider.Grantee) error
- func (fs *Decomposedfs) Download(ctx context.Context, ref *provider.Reference) (io.ReadCloser, error)
- func (fs *Decomposedfs) DownloadRevision(ctx context.Context, ref *provider.Reference, revisionKey string) (io.ReadCloser, error)
- func (fs *Decomposedfs) EmptyRecycle(ctx context.Context) 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, err error)
- func (fs *Decomposedfs) GetUpload(ctx context.Context, id string) (tusd.Upload, error)
- func (fs *Decomposedfs) InitiateUpload(ctx context.Context, ref *provider.Reference, uploadLength int64, ...) (map[string]string, error)
- func (fs *Decomposedfs) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys []string) (finfos []*provider.ResourceInfo, err error)
- func (fs *Decomposedfs) ListGrants(ctx context.Context, ref *provider.Reference) (grants []*provider.Grant, err error)
- func (fs *Decomposedfs) ListRecycle(ctx context.Context, basePath, 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) Move(ctx context.Context, oldRef, newRef *provider.Reference) (err error)
- func (fs *Decomposedfs) NewUpload(ctx context.Context, info tusd.FileInfo) (upload tusd.Upload, err error)
- func (fs *Decomposedfs) PurgeRecycleItem(ctx context.Context, basePath, 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) RestoreRecycleItem(ctx context.Context, basePath, key, relativePath string, ...) error
- func (fs *Decomposedfs) RestoreRevision(ctx context.Context, ref *provider.Reference, revisionKey string) (err 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) error
- func (fs *Decomposedfs) Shutdown(ctx context.Context) error
- func (fs *Decomposedfs) TouchFile(ctx context.Context, ref *provider.Reference) error
- func (fs *Decomposedfs) Unlock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) 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) Upload(ctx context.Context, ref *provider.Reference, r io.ReadCloser) (err error)
- func (fs *Decomposedfs) UseIn(composer *tusd.StoreComposer)
- type Lookup
- func (lu *Lookup) HomeNode(ctx context.Context) (node *node.Node, err error)
- func (lu *Lookup) HomeOrRootNode(ctx context.Context) (node *node.Node, err error)
- func (lu *Lookup) InternalPath(id string) string
- func (lu *Lookup) InternalRoot() string
- func (lu *Lookup) NodeFromID(ctx context.Context, id *provider.ResourceId) (n *node.Node, err error)
- func (lu *Lookup) NodeFromPath(ctx context.Context, fn string, followReferences bool) (*node.Node, error)
- func (lu *Lookup) NodeFromResource(ctx context.Context, ref *provider.Reference) (*node.Node, error)
- func (lu *Lookup) Path(ctx context.Context, n *node.Node) (p string, err error)
- func (lu *Lookup) RootNode(ctx context.Context) (*node.Node, error)
- func (lu *Lookup) ShareFolder() string
- func (lu *Lookup) WalkPath(ctx context.Context, r *node.Node, p string, followReferences bool, ...) (*node.Node, error)
- type PermissionsChecker
- type Tree
Constants ¶
This section is empty.
Variables ¶
var SpaceGrant struct{}
SpaceGrant is the key used to signal not to create a new space when a grant is assigned to a storage space.
Functions ¶
Types ¶
type Decomposedfs ¶
type Decomposedfs struct {
// contains filtered or unexported fields
}
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) AsConcatableUpload ¶
func (fs *Decomposedfs) AsConcatableUpload(upload tusd.Upload) tusd.ConcatableUpload
AsConcatableUpload returns a ConcatableUpload
func (*Decomposedfs) AsLengthDeclarableUpload ¶
func (fs *Decomposedfs) AsLengthDeclarableUpload(upload tusd.Upload) tusd.LengthDeclarableUpload
AsLengthDeclarableUpload returns a LengthDeclarableUpload
func (*Decomposedfs) AsTerminatableUpload ¶
func (fs *Decomposedfs) AsTerminatableUpload(upload tusd.Upload) tusd.TerminatableUpload
AsTerminatableUpload returns a TerminatableUpload
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 end owncloud driver we only allow references as children of the "/Shares" folder TODO when home support is enabled should the "/Shares" folder still be listed?
func (*Decomposedfs) CreateStorageSpace ¶
func (fs *Decomposedfs) CreateStorageSpace(ctx context.Context, req *provider.CreateStorageSpaceRequest) (*provider.CreateStorageSpaceResponse, error)
CreateStorageSpace creates a storage space
func (*Decomposedfs) DenyGrant ¶
func (fs *Decomposedfs) DenyGrant(ctx context.Context, ref *provider.Reference, g *provider.Grantee) error
DenyGrant denies access to a resource.
func (*Decomposedfs) Download ¶
func (fs *Decomposedfs) Download(ctx context.Context, ref *provider.Reference) (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) (io.ReadCloser, error)
DownloadRevision returns a reader for the specified revision
func (*Decomposedfs) EmptyRecycle ¶
func (fs *Decomposedfs) EmptyRecycle(ctx context.Context) error
EmptyRecycle empties the trash
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) (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, err error)
GetQuota returns the quota available TODO Document in the cs3 should we return quota or free space?
func (*Decomposedfs) InitiateUpload ¶
func (fs *Decomposedfs) InitiateUpload(ctx context.Context, ref *provider.Reference, uploadLength int64, metadata map[string]string) (map[string]string, error)
InitiateUpload returns upload ids corresponding to different protocols it supports TODO read optional content for small files in this request TODO InitiateUpload (and Upload) needs a way to receive the expected checksum. Maybe in metadata as 'checksum' => 'sha1 aeosvp45w5xaeoe' = lowercase, space separated?
func (*Decomposedfs) ListFolder ¶
func (fs *Decomposedfs) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys []string) (finfos []*provider.ResourceInfo, err 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, basePath, key, relativePath string) ([]*provider.RecycleItem, error)
ListRecycle returns the list of available recycle items
func (*Decomposedfs) ListRevisions ¶
func (fs *Decomposedfs) ListRevisions(ctx context.Context, ref *provider.Reference) (revisions []*provider.FileVersion, err error)
ListRevisions lists the revisions of the given resource
func (*Decomposedfs) ListStorageSpaces ¶
func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provider.ListStorageSpacesRequest_Filter) ([]*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) NewUpload ¶
func (fs *Decomposedfs) NewUpload(ctx context.Context, info tusd.FileInfo) (upload tusd.Upload, err error)
NewUpload returns a new tus Upload instance
func (*Decomposedfs) PurgeRecycleItem ¶
func (fs *Decomposedfs) PurgeRecycleItem(ctx context.Context, basePath, key, relativePath string) error
PurgeRecycleItem purges the specified item
func (*Decomposedfs) RefreshLock ¶
func (fs *Decomposedfs) RefreshLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) 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) RestoreRecycleItem ¶
func (fs *Decomposedfs) RestoreRecycleItem(ctx context.Context, basePath, key, relativePath string, restoreRef *provider.Reference) error
RestoreRecycleItem restores the specified item
func (*Decomposedfs) RestoreRevision ¶
func (fs *Decomposedfs) RestoreRevision(ctx context.Context, ref *provider.Reference, revisionKey string) (err error)
RestoreRevision restores the specified revision of the resource
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) 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) Unlock ¶
func (fs *Decomposedfs) Unlock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) 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
func (*Decomposedfs) UpdateStorageSpace ¶
func (fs *Decomposedfs) UpdateStorageSpace(ctx context.Context, req *provider.UpdateStorageSpaceRequest) (*provider.UpdateStorageSpaceResponse, error)
UpdateStorageSpace updates a storage space
func (*Decomposedfs) Upload ¶
func (fs *Decomposedfs) Upload(ctx context.Context, ref *provider.Reference, r io.ReadCloser) (err error)
Upload uploads data to the given resource TODO Upload (and InitiateUpload) needs a way to receive the expected checksum. Maybe in metadata as 'checksum' => 'sha1 aeosvp45w5xaeoe' = lowercase, space separated?
func (*Decomposedfs) UseIn ¶
func (fs *Decomposedfs) UseIn(composer *tusd.StoreComposer)
UseIn tells the tus upload middleware which extensions it supports.
type Lookup ¶
Lookup implements transformations from filepath to node and back
func (*Lookup) HomeOrRootNode ¶
HomeOrRootNode returns the users home node when home support is enabled. it returns the storages root node otherwise
func (*Lookup) InternalPath ¶
InternalPath returns the internal path for a given ID
func (*Lookup) InternalRoot ¶
InternalRoot returns the internal storage root directory
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) NodeFromPath ¶
func (lu *Lookup) NodeFromPath(ctx context.Context, fn string, followReferences bool) (*node.Node, error)
NodeFromPath converts a filename into a Node
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) ShareFolder ¶
ShareFolder returns the internal storage root directory
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 PermissionsChecker ¶
type PermissionsChecker interface { AssemblePermissions(ctx context.Context, n *node.Node) (ap provider.ResourcePermissions, err error) HasPermission(ctx context.Context, n *node.Node, check func(*provider.ResourcePermissions) bool) (can bool, err error) }
PermissionsChecker defines an interface for checking permissions on a Node
type Tree ¶
type Tree interface { Setup(owner *userpb.UserId, propagateToRoot bool) error GetMD(ctx context.Context, node *node.Node) (os.FileInfo, error) ListFolder(ctx context.Context, node *node.Node) ([]*node.Node, error) // CreateHome(owner *userpb.UserId) (n *node.Node, err error) CreateDir(ctx context.Context, node *node.Node) (err error) // CreateReference(ctx context.Context, node *node.Node, targetURI *url.URL) error Move(ctx context.Context, oldNode *node.Node, newNode *node.Node) (err error) Delete(ctx context.Context, node *node.Node) (err error) RestoreRecycleItemFunc(ctx context.Context, key, trashPath, restorePath string) (*node.Node, *node.Node, func() error, error) // FIXME REFERENCE use ref instead of path PurgeRecycleItemFunc(ctx context.Context, key, purgePath string) (*node.Node, func() error, error) WriteBlob(key string, reader io.Reader) error ReadBlob(key string) (io.ReadCloser, error) DeleteBlob(key string) error Propagate(ctx context.Context, node *node.Node) (err error) }
Tree is used to manage a tree hierarchy