decomposedfs

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(o *options.Options, lu *lookup.Lookup, p PermissionsChecker, tp Tree, permissionsClient CS3PermissionsClient) (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) (storage.FS, error)

NewDefault returns an instance with default components

func ReadSpaceAndNodeFromSpaceTypeLink(path string) (string, string, error)

ReadSpaceAndNodeFromSpaceTypeLink 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 CS3PermissionsClient

type CS3PermissionsClient interface {
	CheckPermission(ctx context.Context, in *cs3permissions.CheckPermissionRequest, opts ...grpc.CallOption) (*cs3permissions.CheckPermissionResponse, error)
}

CS3PermissionsClient defines an interface for checking permissions against the CS3 permissions service

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) 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) 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, 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, 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) (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) (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, 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) 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) 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, 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) 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) (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) TouchFile

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

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.

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() 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, spaceid, key, trashPath string, target *node.Node) (*node.Node, *node.Node, func() error, error)
	PurgeRecycleItemFunc(ctx context.Context, spaceid, key, purgePath string) (*node.Node, func() error, error)

	WriteBlob(node *node.Node, reader io.Reader) error
	ReadBlob(node *node.Node) (io.ReadCloser, error)
	DeleteBlob(node *node.Node) error

	Propagate(ctx context.Context, node *node.Node) (err error)
}

Tree is used to manage a tree hierarchy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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