Help us shape the future of Go! Take the 2026 Go Developer Survey

middleware

package
v2.52.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct {
	// contains filtered or unexported fields
}

FS is a storage.FS implementation that wraps another storage.FS and calls hooks before and after each method.

func NewFS

func NewFS(next storage.FS, hooks ...Hook) *FS

func (*FS) AddGrant

func (f *FS) AddGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error

func (*FS) AddLabel added in v2.44.0

func (f *FS) AddLabel(ctx context.Context, ref *provider.Reference, userID *userpb.UserId, label string) error

func (*FS) AsConcatableUpload

func (f *FS) 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 (*FS) AsLengthDeclarableUpload

func (f *FS) 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 (*FS) AsTerminatableUpload

func (f *FS) 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 (*FS) CommitUpload added in v2.52.0

func (f *FS) CommitUpload(ctx context.Context, ref *provider.Reference, sessionID string, source storage.UploadSource) error

func (*FS) CreateDir

func (f *FS) CreateDir(ctx context.Context, ref *provider.Reference) error

func (*FS) CreateHome

func (f *FS) CreateHome(ctx context.Context) error

func (*FS) CreateReference

func (f *FS) CreateReference(ctx context.Context, path string, targetURI *url.URL) error

func (*FS) Delete

func (f *FS) Delete(ctx context.Context, ref *provider.Reference) error

func (*FS) DeleteStorageSpace

func (f *FS) DeleteStorageSpace(ctx context.Context, req *provider.DeleteStorageSpaceRequest) error

func (*FS) DenyGrant

func (f *FS) DenyGrant(ctx context.Context, ref *provider.Reference, g *provider.Grantee) error

func (*FS) Download

func (f *FS) Download(ctx context.Context, ref *provider.Reference, openReaderFunc func(md *provider.ResourceInfo) bool) (*provider.ResourceInfo, io.ReadCloser, error)

func (*FS) DownloadRevision

func (f *FS) DownloadRevision(ctx context.Context, ref *provider.Reference, key string, openReaderFunc func(md *provider.ResourceInfo) bool) (*provider.ResourceInfo, io.ReadCloser, error)

func (*FS) EmptyRecycle

func (f *FS) EmptyRecycle(ctx context.Context, ref *provider.Reference) error

func (*FS) GetHome

func (f *FS) GetHome(ctx context.Context) (string, error)

func (*FS) GetLock

func (f *FS) GetLock(ctx context.Context, ref *provider.Reference) (*provider.Lock, error)

func (*FS) GetMD

func (f *FS) GetMD(ctx context.Context, ref *provider.Reference, mdKeys, fieldMask []string) (*provider.ResourceInfo, error)

func (*FS) GetPathByID

func (f *FS) GetPathByID(ctx context.Context, id *provider.ResourceId) (string, error)

func (*FS) GetQuota

func (f *FS) GetQuota(ctx context.Context, ref *provider.Reference) (uint64, uint64, uint64, error)

func (*FS) GetUpload

func (f *FS) GetUpload(ctx context.Context, id string) (upload tusd.Upload, err error)

NewUpload returns a new tus Upload instance

func (*FS) InitiateUpload

func (f *FS) InitiateUpload(ctx context.Context, ref *provider.Reference, uploadLength int64, metadata map[string]string) (map[string]string, error)

func (*FS) ListFolder

func (f *FS) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys, fieldMask []string) ([]*provider.ResourceInfo, error)

func (*FS) ListGrants

func (f *FS) ListGrants(ctx context.Context, ref *provider.Reference) ([]*provider.Grant, error)

func (*FS) ListRecycle

func (f *FS) ListRecycle(ctx context.Context, ref *provider.Reference, key, relativePath string) ([]*provider.RecycleItem, error)

func (*FS) ListRevisions

func (f *FS) ListRevisions(ctx context.Context, ref *provider.Reference) ([]*provider.FileVersion, error)

func (*FS) ListStorageSpaces

func (f *FS) ListStorageSpaces(ctx context.Context, filter []*provider.ListStorageSpacesRequest_Filter, unrestricted bool) ([]*provider.StorageSpace, error)

func (*FS) ListUploadSessions

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

ListUploadSessions returns the upload sessions matching the given filter

func (*FS) MarkProcessing added in v2.52.0

func (f *FS) MarkProcessing(ctx context.Context, ref *provider.Reference, processing bool, sessionID string) error

func (*FS) Move

func (f *FS) Move(ctx context.Context, oldRef, newRef *provider.Reference) (*storage.MoveResult, error)

func (*FS) NewUpload

func (f *FS) NewUpload(ctx context.Context, info tusd.FileInfo) (upload tusd.Upload, err error)

NewUpload returns a new tus Upload instance

func (*FS) PurgeRecycleItem

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

func (*FS) RefreshLock

func (f *FS) RefreshLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock, existingLockID string) error

func (*FS) RemoveGrant

func (f *FS) RemoveGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error

func (*FS) RemoveLabel added in v2.44.0

func (f *FS) RemoveLabel(ctx context.Context, ref *provider.Reference, userID *userpb.UserId, label string) error

func (*FS) ResolveUpload added in v2.47.0

func (f *FS) ResolveUpload(ctx context.Context, info tusd.FileInfo) (*provider.ResourceInfo, context.Context, error)

ResolveUpload resolves a finished upload to the resource it produced, read as the upload's executant. It is best effort: if the wrapped storage does not resolve uploads it returns NotSupported rather than panicking, so the tus finalize falls back to no headers.

func (*FS) RestoreRecycleItem

func (f *FS) RestoreRecycleItem(ctx context.Context, ref *provider.Reference, key, relativePath string, restoreRef *provider.Reference) error

func (*FS) RestoreRevision

func (f *FS) RestoreRevision(ctx context.Context, ref *provider.Reference, key string) error

func (*FS) SetArbitraryMetadata

func (f *FS) SetArbitraryMetadata(ctx context.Context, ref *provider.Reference, md *provider.ArbitraryMetadata) error

func (*FS) SetLock

func (f *FS) SetLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error

func (*FS) Shutdown

func (f *FS) Shutdown(ctx context.Context) error

func (*FS) TouchFile

func (f *FS) TouchFile(ctx context.Context, ref *provider.Reference, markprocessing bool, mtime string) error

func (*FS) Unlock

func (f *FS) Unlock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error

func (*FS) UnsetArbitraryMetadata

func (f *FS) UnsetArbitraryMetadata(ctx context.Context, ref *provider.Reference, keys []string) error

func (*FS) UpdateGrant

func (f *FS) UpdateGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error

func (*FS) Upload

func (*FS) UseIn

func (f *FS) UseIn(composer *tusd.StoreComposer)

UseIn tells the tus upload middleware which extensions it supports.

func (*FS) WithDisabledSpaces added in v2.46.1

func (fs *FS) WithDisabledSpaces() storage.FS

WithDisabledSpaces returns a filesystem that can list disabled spaces

type Hook

type Hook func(methodName string, ctx context.Context, spaceID string) (context.Context, UnHook, error)

Hook is a function that is called before the actual method is executed.

type UnHook

type UnHook func() error

UnHook is a function that is called after the actual method is executed.

Jump to

Keyboard shortcuts

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