Documentation
¶
Overview ¶
Package filestore provide a storage backend based on the local file system.
FileStore is a storage backend used as a tusd.DataStore in tusd.NewHandler. It stores the uploads in a directory specified in two different files: The `[id].info` files are used to store the fileinfo in JSON format. The `[id].bin` files contain the raw binary data uploaded. No cleanup is performed so you may want to run a cronjob to ensure your disk is not filled up with old and finished uploads.
In addition, it provides an exclusive upload locking mechansim using lock files which are stored on disk. Each of them stores the PID of the process which aquired the lock. This allows locks to be automatically freed when a process is unable to release it on its own because the process is not alive anymore. For more information, consult the documentation for tusd.LockerDataStore interface, which is implemented by FileStore
Index ¶
- type FileStore
- func (store FileStore) ConcatUploads(dest string, uploads []string) (err error)
- func (store FileStore) GetInfo(id string) (tusd.FileInfo, error)
- func (store FileStore) GetReader(id string) (io.Reader, error)
- func (store FileStore) LockUpload(id string) error
- func (store FileStore) NewUpload(info tusd.FileInfo) (id string, err error)
- func (store FileStore) Terminate(id string) error
- func (store FileStore) UnlockUpload(id string) error
- func (store FileStore) UseIn(composer *tusd.StoreComposer)
- func (store FileStore) WriteChunk(id string, offset int64, src io.Reader) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStore ¶
type FileStore struct { // Relative or absolute path to store files in. FileStore does not check // whether the path exists, use os.MkdirAll in this case on your own. Path string }
See the tusd.DataStore interface for documentation about the different methods.
func New ¶
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 (FileStore) ConcatUploads ¶
func (FileStore) LockUpload ¶
func (FileStore) UnlockUpload ¶
func (FileStore) UseIn ¶
func (store FileStore) UseIn(composer *tusd.StoreComposer)
UseIn sets this store as the core data store in the passed composer and adds all possible extension to it.