Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Status ¶
type Status int
Status indicates the status of an upload.
const ( // Started is the status for active uploads. Started Status = iota // Completed is the status of uploads that completed successfully. Completed // TimedOut is the status for uploads that took longer than the allotted // time. TimedOut // Failed is the status for uploads that failed due to an unexpected error. Failed )
type Store ¶
type Store interface { // Load retrieves the upload with the given ID. Load should return nil, nil // if there is not upload with the given ID. Load(id string) (*Upload, error) // Save persists the given upload with the given ID. Save(id string, s *Upload) error }
Store is an opinionated data store interface suitable for use together with a TUS server implementation.
func NewInMemory ¶
func NewInMemory() Store
NewInMemory returns a store implementation that relies on a in-memory map to keep the server state. This means only one process can be exposed to the upload HTTP endpoint and that uploads won't survive process restarts. This implementation is thus probably not suitable for prodcution use.
type Upload ¶
type Upload struct { // ID is a unique identifier for the upload. ID string // StartedAt is the creation timestamp for the upload. StartedAt time.Time // ExpiresAt is the upload expiration timestamp if any, the Zero // time.Time value otherwise. ExpiresAt time.Time // Status is the current upload status. Status Status // Length is the total length of the upload if known, nil otherwise. Length *int64 // Offset is the count of bytes that have already been uploaded. Offset int64 // Metadata is arbitrary pass-through data that can be used by clients to // attach information to the upload. Metadata string }
Upload contains the information needed to manage an upload.
Click to show internal directories.
Click to hide internal directories.