decomposedfs

package
v2.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(o *options.Options, aspects aspects.Aspects) (storage.FS, error)

New returns an implementation of the storage.FS interface that talks to a local filesystem.

func NewDefault

func NewDefault(m map[string]interface{}, bs tree.Blobstore, es events.Stream) (storage.FS, error)

NewDefault returns an instance with default components

func ReadSpaceAndNodeFromIndexLink(link string) (string, string, error)

ReadSpaceAndNodeFromIndexLink reads a symlink and parses space and node id if the link has the correct format, eg: ../../spaces/4c/510ada-c86b-4815-8820-42cdf82c3d51/nodes/4c/51/0a/da/-c86b-4815-8820-42cdf82c3d51 ../../spaces/4c/510ada-c86b-4815-8820-42cdf82c3d51/nodes/4c/51/0a/da/-c86b-4815-8820-42cdf82c3d51.T.2022-02-24T12:35:18.196484592Z

Types

type Decomposedfs

type Decomposedfs struct {
	UserCache *ttlcache.Cache
	// 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(up tusd.Upload) tusd.ConcatableUpload

AsConcatableUpload returns a ConcatableUpload To implement the concatenation extension as specified in https://tus.io/protocols/resumable-upload.html#concatenation the storage needs to implement AsConcatableUpload

func (*Decomposedfs) AsLengthDeclarableUpload

func (fs *Decomposedfs) AsLengthDeclarableUpload(up tusd.Upload) tusd.LengthDeclarableUpload

AsLengthDeclarableUpload returns a LengthDeclarableUpload To implement the creation-defer-length extension as specified in https://tus.io/protocols/resumable-upload.html#creation the storage needs to implement AsLengthDeclarableUpload

func (*Decomposedfs) AsTerminatableUpload

func (fs *Decomposedfs) AsTerminatableUpload(up tusd.Upload) tusd.TerminatableUpload

AsTerminatableUpload returns a TerminatableUpload To implement the termination extension as specified in https://tus.io/protocols/resumable-upload.html#termination the storage needs to implement AsTerminatableUpload

func (*Decomposedfs) CreateDir

func (fs *Decomposedfs) CreateDir(ctx context.Context, ref *provider.Reference) (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

CreateStorageSpace creates a storage space

func (*Decomposedfs) Delete

func (fs *Decomposedfs) Delete(ctx context.Context, ref *provider.Reference) (err error)

Delete deletes the specified resource

func (*Decomposedfs) DeleteRevision added in v2.13.0

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) 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) (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 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 (fs *Decomposedfs) EmptyRecycle(ctx context.Context, ref *provider.Reference) 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, 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) GetUpload

func (fs *Decomposedfs) GetUpload(ctx context.Context, id string) (tusd.Upload, error)

GetUpload returns the Upload for the given upload id

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, 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, ref *provider.Reference, 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 (*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, 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) ListUploadSessions added in v2.16.4

func (fs *Decomposedfs) ListUploadSessions(ctx context.Context, filter storage.UploadSessionFilter) ([]storage.UploadSession, error)

ListUploadSessions returns the upload sessions for the given filter

func (*Decomposedfs) Move

func (fs *Decomposedfs) Move(ctx context.Context, oldRef, newRef *provider.Reference) (err error)

Move moves a resource from one reference to another

func (*Decomposedfs) MustCheckNodePermissions added in v2.7.3

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) NewUpload

func (fs *Decomposedfs) NewUpload(ctx context.Context, info tusd.FileInfo) (tusd.Upload, error)

NewUpload returns a new tus Upload instance

func (*Decomposedfs) Postprocessing added in v2.13.0

func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event)

Postprocessing starts the postprocessing result collector

func (*Decomposedfs) PurgeRecycleItem

func (fs *Decomposedfs) PurgeRecycleItem(ctx context.Context, ref *provider.Reference, key, relativePath string) error

PurgeRecycleItem purges the specified item, all its children and all their revisions

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) RestoreRecycleItem

func (fs *Decomposedfs) RestoreRecycleItem(ctx context.Context, ref *provider.Reference, 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) (returnErr 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) TouchFile

func (fs *Decomposedfs) TouchFile(ctx context.Context, ref *provider.Reference, markprocessing bool, mtime string) 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) 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

UpdateStorageSpace updates a storage space

func (*Decomposedfs) Upload

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.

func (*Decomposedfs) UserIDToUserAndGroups added in v2.13.0

func (fs *Decomposedfs) UserIDToUserAndGroups(ctx context.Context, userid *userv1beta1.UserId) (*userv1beta1.User, error)

UserIDToUserAndGroups converts a user ID to a user with groups

type Session added in v2.18.0

type Session interface {
	tusd.Upload
	storage.UploadSession
	upload.Session
	LockID() string
}

Session is the interface that OcisSession implements. By combining tus.Upload, storage.UploadSession and custom functions we can reuse the same struct throughout the whole upload lifecycle.

Some functions that are only used by decomposedfs are not yet part of this interface. They might be added after more refactoring.

type SessionStore added in v2.18.0

type SessionStore interface {
	New(ctx context.Context) *upload.OcisSession
	List(ctx context.Context) ([]*upload.OcisSession, error)
	Get(ctx context.Context, id string) (*upload.OcisSession, error)
	Cleanup(ctx context.Context, session upload.Session, revertNodeMetadata, keepUpload, unmarkPostprocessing bool)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL