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 ¶
- func RemoveWithDirs(path string, basePath string) (err error)
- func Uid() string
- type ShardedFileStore
- func (store ShardedFileStore) AsConcatableUpload(upload handler.Upload) handler.ConcatableUpload
- func (store ShardedFileStore) AsLengthDeclarableUpload(upload handler.Upload) handler.LengthDeclarableUpload
- func (store ShardedFileStore) AsTerminatableUpload(upload handler.Upload) handler.TerminatableUpload
- func (store ShardedFileStore) GetUpload(ctx context.Context, id string) (handler.Upload, error)
- func (store ShardedFileStore) NewUpload(ctx context.Context, info handler.FileInfo) (handler.Upload, error)
- func (store *ShardedFileStore) Terminate(id string) error
- func (store ShardedFileStore) UseIn(composer *handler.StoreComposer)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoveWithDirs ¶
RemoveWithDirs deletes the given path and its empty parent directories up to the given basePath
func Uid ¶
func Uid() string
taken from https://github.com/tus/tusd/blob/42bfe35457f8bfc79a0af40a9f51c8112903737e/internal/uid/uid.go
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) 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.