storage

package
v2.19.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS interface {
	GetHome(ctx context.Context) (string, error)
	CreateHome(ctx context.Context) error
	CreateDir(ctx context.Context, ref *provider.Reference) error
	TouchFile(ctx context.Context, ref *provider.Reference, markprocessing bool, mtime string) error
	Delete(ctx context.Context, ref *provider.Reference) error
	Move(ctx context.Context, oldRef, newRef *provider.Reference) error
	GetMD(ctx context.Context, ref *provider.Reference, mdKeys, fieldMask []string) (*provider.ResourceInfo, error)
	ListFolder(ctx context.Context, ref *provider.Reference, mdKeys, fieldMask []string) ([]*provider.ResourceInfo, error)
	InitiateUpload(ctx context.Context, ref *provider.Reference, uploadLength int64, metadata map[string]string) (map[string]string, error)
	Upload(ctx context.Context, req UploadRequest, uploadFunc UploadFinishedFunc) (provider.ResourceInfo, error)
	Download(ctx context.Context, ref *provider.Reference) (io.ReadCloser, error)
	ListRevisions(ctx context.Context, ref *provider.Reference) ([]*provider.FileVersion, error)
	DownloadRevision(ctx context.Context, ref *provider.Reference, key string) (io.ReadCloser, error)
	RestoreRevision(ctx context.Context, ref *provider.Reference, key string) error
	ListRecycle(ctx context.Context, ref *provider.Reference, key, relativePath string) ([]*provider.RecycleItem, error)
	RestoreRecycleItem(ctx context.Context, ref *provider.Reference, key, relativePath string, restoreRef *provider.Reference) error
	PurgeRecycleItem(ctx context.Context, ref *provider.Reference, key, relativePath string) error
	EmptyRecycle(ctx context.Context, ref *provider.Reference) error
	GetPathByID(ctx context.Context, id *provider.ResourceId) (string, error)
	AddGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error
	DenyGrant(ctx context.Context, ref *provider.Reference, g *provider.Grantee) error
	RemoveGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error
	UpdateGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error
	ListGrants(ctx context.Context, ref *provider.Reference) ([]*provider.Grant, error)
	GetQuota(ctx context.Context, ref *provider.Reference) (uint64, uint64, uint64, error)
	CreateReference(ctx context.Context, path string, targetURI *url.URL) error
	Shutdown(ctx context.Context) error
	SetArbitraryMetadata(ctx context.Context, ref *provider.Reference, md *provider.ArbitraryMetadata) error
	UnsetArbitraryMetadata(ctx context.Context, ref *provider.Reference, keys []string) error
	SetLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error
	GetLock(ctx context.Context, ref *provider.Reference) (*provider.Lock, error)
	RefreshLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock, existingLockID string) error
	Unlock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error
	// ListStorageSpaces lists the spaces in the storage.
	// The unrestricted parameter can be used to list other user's spaces when
	// the user has the necessary permissions.
	ListStorageSpaces(ctx context.Context, filter []*provider.ListStorageSpacesRequest_Filter, unrestricted bool) ([]*provider.StorageSpace, error)
	CreateStorageSpace(ctx context.Context, req *provider.CreateStorageSpaceRequest) (*provider.CreateStorageSpaceResponse, error)
	UpdateStorageSpace(ctx context.Context, req *provider.UpdateStorageSpaceRequest) (*provider.UpdateStorageSpaceResponse, error)
	DeleteStorageSpace(ctx context.Context, req *provider.DeleteStorageSpaceRequest) error
}

FS is the interface to implement access to the storage.

type PathWrapper

type PathWrapper interface {
	Unwrap(ctx context.Context, rp string) (string, error)
	Wrap(ctx context.Context, rp string) (string, error)
}

PathWrapper is the interface to implement for path transformations

type Registry

type Registry interface {
	// GetProvider returns the Address of the storage provider that should be used for the given space.
	// Use it to determine where to create a new storage space.
	GetProvider(ctx context.Context, space *provider.StorageSpace) (*registry.ProviderInfo, error)
	// ListProviders returns the storage providers that match the given filter
	ListProviders(ctx context.Context, filters map[string]string) ([]*registry.ProviderInfo, error)
}

Registry is the interface that storage registries implement for discovering storage providers

type UploadFinishedFunc added in v2.4.0

type UploadFinishedFunc func(spaceOwner, executant *userpb.UserId, ref *provider.Reference)

UploadFinishedFunc is a callback function used in storage drivers to indicate that an upload has finished

type UploadRequest added in v2.16.4

type UploadRequest struct {
	Ref    *provider.Reference
	Body   io.ReadCloser
	Length int64
}

UploadRequest us used in FS.Upload() to carry required upload metadata

type UploadSession added in v2.16.4

type UploadSession interface {
	// ID returns the upload id
	ID() string
	// Filename returns the filename of the file
	Filename() string
	// Size returns the size of the upload
	Size() int64
	// Offset returns the current offset
	Offset() int64
	// Reference returns a reference for the file being uploaded. May be absolute id based or relative to e.g. a space root
	Reference() provider.Reference
	// Executant returns the userid of the user that created the upload
	Executant() userpb.UserId
	// SpaceOwner returns the owner of a space if set. optional
	SpaceOwner() *userpb.UserId
	// Expires returns the time when the upload can no longer be used
	Expires() time.Time

	// IsProcessing returns true if postprocessing has not finished, yet
	// The actual postprocessing state is tracked in the postprocessing service.
	IsProcessing() bool

	// Purge allows completely removing an upload. Should emit a PostprocessingFinished event with a Delete outcome
	Purge(ctx context.Context) error

	// ScanData returns the scan data for the UploadSession
	ScanData() (string, time.Time)
}

UploadSession is the interface that storage drivers need to return whan listing upload sessions.

type UploadSessionFilter added in v2.16.4

type UploadSessionFilter struct {
	ID         *string
	Processing *bool
	Expired    *bool
}

UploadSessionFilter can be used to filter upload sessions

type UploadSessionLister added in v2.16.4

type UploadSessionLister interface {
	// ListUploadSessions returns the upload sessions matching the given filter
	ListUploadSessions(ctx context.Context, filter UploadSessionFilter) ([]UploadSession, error)
}

UploadSessionLister defines the interface for FS implementations that allow listing and purging upload sessions

type UploadsManager added in v2.7.3

type UploadsManager interface {
	ListUploads() ([]tusd.FileInfo, error)
	PurgeExpiredUploads(chan<- tusd.FileInfo) error
}

UploadsManager defines the interface for storage drivers that allow for managing uploads Deprecated: No longer used. Storage drivers should implement the UploadSessionLister.

Jump to

Keyboard shortcuts

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