shardedfilestore

package
v0.0.0-...-33f6f7a Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package shardedfilestore is a modified version of the tusd/filestore implementation. Splits file storage into subdirectories based on the hash prefix. based on https://github.com/tus/tusd/blob/6d987aa226e2e6cefca1df012da5599a57622b17/pkg/filestore/filestore.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveWithDirs

func RemoveWithDirs(path string, basePath string) (err error)

RemoveWithDirs deletes the given path and its empty parent directories up to the given basePath

Types

type ShardedFileStore

type ShardedFileStore struct {
	BasePath             string        // Relative or absolute path to store files in.
	PrefixShardLayers    int           // Number of extra directory layers to prefix file paths with.
	ExpireTime           time.Duration // How long before an upload expires (seconds)
	ExpireIdentifiedTime time.Duration // How long before an upload expires with valid account (seconds)
	PreFinishCommands    []config.PreFinishCommand
	DBConn               *db.DatabaseConnection
	// contains filtered or unexported fields
}

ShardedFileStore implements various tusd.DataStore-related interfaces. See the interfaces for more documentation about the different methods.

func New

func New(basePath string, prefixShardLayers int, expireTime, expireIdentifiedTime time.Duration, PreFinishCommands []config.PreFinishCommand, dbConnection *db.DatabaseConnection, log *zerolog.Logger) *ShardedFileStore

New creates a new file based storage backend. The directory specified will be used as the only storage entry. This method does not check whether the path exists, use os.MkdirAll to ensure. In addition, a locking mechanism is provided.

func (ShardedFileStore) AsConcatableUpload

func (store ShardedFileStore) AsConcatableUpload(upload handler.Upload) handler.ConcatableUpload

func (ShardedFileStore) AsLengthDeclarableUpload

func (store ShardedFileStore) AsLengthDeclarableUpload(upload handler.Upload) handler.LengthDeclarableUpload

func (ShardedFileStore) AsTerminatableUpload

func (store ShardedFileStore) AsTerminatableUpload(upload handler.Upload) handler.TerminatableUpload

func (ShardedFileStore) GetUpload

func (store ShardedFileStore) GetUpload(ctx context.Context, id string) (handler.Upload, error)

func (ShardedFileStore) NewUpload

func (store ShardedFileStore) NewUpload(ctx context.Context, info handler.FileInfo) (handler.Upload, error)

func (*ShardedFileStore) Terminate

func (store *ShardedFileStore) Terminate(id string) error

func (ShardedFileStore) UseIn

func (store ShardedFileStore) UseIn(composer *handler.StoreComposer)

UseIn sets this store as the core data store in the passed composer and adds all possible extension to it.

Jump to

Keyboard shortcuts

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