Documentation ¶
Index ¶
- func Cleanup(upload *Upload, failure bool, keepUpload bool)
- func CreateNodeForUpload(upload *Upload, initAttrs node.Attributes) (*node.Node, error)
- type PermissionsChecker
- type Tree
- type Upload
- func (upload *Upload) ConcatUploads(_ context.Context, uploads []tusd.Upload) (err error)
- func (upload *Upload) DeclareLength(_ context.Context, length int64) error
- func (upload *Upload) Finalize() (err error)
- func (upload *Upload) FinishUpload(_ context.Context) error
- func (upload *Upload) GetInfo(_ context.Context) (tusd.FileInfo, error)
- func (upload *Upload) GetReader(_ context.Context) (io.Reader, error)
- func (upload *Upload) Terminate(_ context.Context) error
- func (upload *Upload) URL(_ context.Context) (string, error)
- func (upload *Upload) WriteChunk(_ context.Context, offset int64, src io.Reader) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNodeForUpload ¶
CreateNodeForUpload will create the target node for the Upload
Types ¶
type PermissionsChecker ¶
type PermissionsChecker interface {
AssemblePermissions(ctx context.Context, n *node.Node) (ap provider.ResourcePermissions, 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, binPath string) error ReadBlob(node *node.Node) (io.ReadCloser, error) DeleteBlob(node *node.Node) error Propagate(ctx context.Context, node *node.Node, sizeDiff int64) (err error) }
Tree is used to manage a tree hierarchy
type Upload ¶
type Upload struct { // we use a struct field on the upload as tus pkg will give us an empty context.Background Ctx context.Context // info stores the current information about the upload Info tusd.FileInfo // node for easy access Node *node.Node // contains filtered or unexported fields }
Upload processes the upload it implements tus tusd.Upload interface https://tus.io/protocols/resumable-upload.html#core-protocol it also implements its termination extension as specified in https://tus.io/protocols/resumable-upload.html#termination it also implements its creation-defer-length extension as specified in https://tus.io/protocols/resumable-upload.html#creation it also implements its concatenation extension as specified in https://tus.io/protocols/resumable-upload.html#concatenation
func Get ¶
func Get(ctx context.Context, id string, lu *lookup.Lookup, tp Tree, fsRoot string, pub events.Publisher, async bool, tknopts options.TokenOptions) (*Upload, error)
Get returns the Upload for the given upload id
func New ¶
func New(ctx context.Context, info tusd.FileInfo, lu *lookup.Lookup, tp Tree, p PermissionsChecker, fsRoot string, pub events.Publisher, async bool, tknopts options.TokenOptions) (upload *Upload, err error)
New returns a new processing instance
func (*Upload) ConcatUploads ¶
ConcatUploads concatenates multiple uploads
func (*Upload) DeclareLength ¶
DeclareLength updates the upload length information
func (*Upload) Finalize ¶
Finalize finalizes the upload (eg moves the file to the internal destination)
func (*Upload) FinishUpload ¶
FinishUpload finishes an upload and moves the file to the internal destination