Documentation ¶
Index ¶
- func AddIds(l logrus.FieldLogger, info tusd.FileInfo) logrus.FieldLogger
- type AuthenticationPayload
- type Authenticator
- type BaseConfig
- type ConnectorFeatures
- type DataStore
- type DryRunner
- type FeatureAnnouncer
- type FileUrlPrinter
- type GetAllOptions
- type HasMore
- type HealthReporter
- type Localizable
- type LocalizedResponse
- type MetadataWriter
- type NewUploadInitiator
- type Persistence
- type QueueHandler
- type QueueItem
- type QueueOptions
- type QueueRunResult
- type QueueStorer
- type S3Config
- type S3ConfigOptions
- type SearchAggregate
- type SearchHandler
- type SearchInput
- type SearchOptions
- type SearchResult
- type SearchResultItem
- type StoreCreator
- type SupportedSearches
- type SupportedValidation
- type UploadCompleteStatus
- type UploadCompleter
- type UploadResult
- type ValidateCaseResponse
- type ValidateGroupResponse
- type ValidateNullableResponse
- type ValidateParentResponse
- type ValidatePayload
- type ValidateResponse
- type ValidateUserResponse
- type ValidationErrorResponse
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddIds ¶
func AddIds(l logrus.FieldLogger, info tusd.FileInfo) logrus.FieldLogger
Types ¶
type AuthenticationPayload ¶
type AuthenticationPayload struct { // Used to authenticate the request. ClientId, ApiKey, UserName, UserId, UserSid string }
func (*AuthenticationPayload) SetAuthenticationPayloadOnMetadata ¶
func (a *AuthenticationPayload) SetAuthenticationPayloadOnMetadata(m *metadata.Metadata) *metadata.Metadata
Deprecated, please use context-package instead
type Authenticator ¶
type Authenticator interface {
Authenticate(r *http.Request, a AuthenticationPayload) error
}
Runs before any other requests to authenticate
type BaseConfig ¶
type BaseConfig struct { L logrus.FieldLogger P Persistence Q QueueStorer }
type ConnectorFeatures ¶
type DataStore ¶
type DataStore interface { NewUpload(ctx context.Context, info tusd.FileInfo) (upload tusd.Upload, err error) GetUpload(ctx context.Context, id string) (upload tusd.Upload, err error) // Methods that extend the tusd.DataStore SetInfo(info tusd.FileInfo) error GetInfo(ctx context.Context, id string) (tusd.FileInfo, error) RegisterConnector(interface{}) DataStore GetQueue() QueueStorer AddToQueue(id, connectorId, actionType string, dueAt time.Time) error }
type FeatureAnnouncer ¶
type FeatureAnnouncer interface {
AnnounceFeatures() ConnectorFeatures
}
Can be used to issue what features should be enabled
type FileUrlPrinter ¶
Only used in CLI-mode, for printing the url to the uploaded file on the connectors service.
type GetAllOptions ¶
type HealthReporter ¶
type Localizable ¶ added in v0.1.11
type LocalizedResponse ¶ added in v0.1.11
type LocalizedResponse struct { // For use as header, etc Title string `json:",omitempty"` Subtitle string `json:",omitempty"` // For use as additional field-information Details []Localizable }
type MetadataWriter ¶
type NewUploadInitiator ¶
type NewUploadInitiator interface {
InitiateNewUpload(ctx context.Context, data *metadata.Metadata) error
}
Will be called before the actual upload is created. (tusd.DataStore.NewUpload) Modifying data will be persisted. An error returned will stop the uplaod from being created, and the error-message is returned to the client
Typical use-cases here are creating album/folder, some extra validation if needed
type Persistence ¶
type Persistence interface { Set(k string, v interface{}) error Get(k string, v interface{}) (found bool, err error) SetReceiverChecksum(id string, checkSum metadata.CheckSum) error SetTemporaryChecksum(id string, checkSum []byte) error GetTemporaryChecksum(id string) ([]byte, error) GetTusdInfo(id string) (*tusd.FileInfo, bool) GetTusdInfos(ids []string) ([]*tusd.FileInfo, error) // Should only be used to create the info // TODO: Change to CreateTusdInfo SetInfo(info tusd.FileInfo) error SetUploadOffset(_id string, offset int64) error // Can be used to mark an upload as complete with external information SetUploaded(info tusd.FileInfo) error SetConnectorProgress(_id string, written int64) error }
type QueueHandler ¶
type QueueHandler interface { HandleQueue(qi QueueItem) QueueRunResult GetQueueHandlerId() string }
type QueueItem ¶
type QueueItem struct { ID string // The connector that is responsible for this item. ConnectorId string // Information about the upload, like storage, metadata, size, offset etc. Info tusd.FileInfo // The kind of action that needs to be done, from the connector's perspective. ActionType string // How many attempts the svcQueue-item has been trough. Attempts int // Any errors occured. Can be used to inform a sys-admin. Error string // The time of which the item is due. DueAt time.Time UploadId string BackoffLimitReached bool }
type QueueOptions ¶
type QueueRunResult ¶
type QueueRunResult struct { // Set to true to mark the svcQueue-item as complete CompleteQueueItem bool // Set to true to mark the upload as complete. Will also complete the svcQueue-item CompleteUpload bool // Set to true to make the svcQueue back off on this item, and require manual intervention. Backoff bool // Additional info for the current error Err string }
type QueueStorer ¶
type QueueStorer interface { Complete(id string) error MarkErr(qi QueueItem, err string, postpone bool, backoff bool) error Options() QueueOptions GetAll(o GetAllOptions) (qis []QueueItem, found bool, err error) AddToQueue(infoId, connectorId, actionType string, dueAt time.Time) error UpdateQueueItem(id string, dueAt sql.NullTime, attempts int, err string, backoff bool) error }
type S3ConfigOptions ¶ added in v0.2.2
type SearchAggregate ¶
type SearchAggregate struct { Offset int HasMore HasMore `json:",omitempty"` Items []SearchResultItem `json:",omitempty"` }
type SearchHandler ¶
type SearchHandler interface { Search(AuthenticationPayload, SearchInput) (SearchResult, error) SearchCacheKey(AuthenticationPayload, SearchInput) string SearchableFields() (*SupportedSearches, SearchOptions) }
type SearchInput ¶
type SearchOptions ¶
type SearchOptions struct {
RequiresAuthentication bool
}
type SearchResult ¶
type SearchResult struct { User *SearchAggregate `json:",omitempty"` Parent *SearchAggregate `json:",omitempty"` Case *SearchAggregate `json:",omitempty"` Group *SearchAggregate `json:",omitempty"` }
type SearchResultItem ¶
type StoreCreator ¶
type SupportedSearches ¶
type SupportedSearches struct { UserID bool `json:",omitempty"` UserName bool `json:",omitempty"` Sid bool `json:",omitempty"` ParentID bool `json:",omitempty"` ParentName bool `json:",omitempty"` CaseID bool `json:",omitempty"` CaseName bool `json:",omitempty"` GroupName bool `json:",omitempty"` GroupID bool `json:",omitempty"` }
func (*SupportedSearches) MapEnabled ¶
func (s *SupportedSearches) MapEnabled() map[string]bool
type SupportedValidation ¶
type SupportedValidation struct { UserID bool `json:",omitempty"` UserName bool `json:",omitempty"` Sid bool `json:",omitempty"` ParentID bool `json:",omitempty"` ParentName bool `json:",omitempty"` CaseID bool `json:",omitempty"` CaseName bool `json:",omitempty"` GroupName bool `json:",omitempty"` GroupID bool `json:",omitempty"` }
type UploadCompleteStatus ¶
type UploadCompleteStatus string
const (
UploadConfirmedComplete UploadCompleteStatus = "Confirmed"
)
type UploadCompleter ¶
type UploadCompleter interface {
CompleteUpload(info tusd.FileInfo) (UploadResult, error)
}
Will be called after the actual upload is completed (tusd.DataStore.Upload.FinishUpload) Modifying data will be persisted.
type UploadResult ¶
type UploadResult struct { Confirmed UploadCompleteStatus ExtId string CaseId string ExternalParentId string ClientMediaId string `json:"ClientId"` }
type ValidateCaseResponse ¶
type ValidateCaseResponse struct { LocalizedResponse `json:",omitempty"` Error *ValidationErrorResponse `json:",omitempty"` ID string `json:",omitempty"` Name string `json:",omitempty"` Private bool `json:",omitempty"` Sensitive bool `json:",omitempty"` }
type ValidateGroupResponse ¶
type ValidateGroupResponse struct { Error *ValidationErrorResponse `json:",omitempty"` ID string `json:",omitempty"` Gid string `json:",omitempty"` Name string `json:",omitempty"` }
type ValidateNullableResponse ¶
type ValidateNullableResponse struct { Error *ValidationErrorResponse `json:",omitempty"` UserID *ValidateUserResponse `json:",omitempty"` UserName *ValidateUserResponse `json:",omitempty"` Sid *ValidateUserResponse `json:",omitempty"` ParentID *ValidateParentResponse `json:",omitempty"` ParentName *ValidateParentResponse `json:",omitempty"` CaseID *ValidateCaseResponse `json:",omitempty"` CaseName *ValidateCaseResponse `json:",omitempty"` GroupName *ValidateGroupResponse `json:",omitempty"` GroupID *ValidateGroupResponse `json:",omitempty"` }
type ValidateParentResponse ¶
type ValidateParentResponse struct { Error *ValidationErrorResponse `json:",omitempty"` ID string `json:",omitempty"` }
type ValidatePayload ¶
type ValidatePayload struct { UserID string `json:",omitempty"` UserName string `json:",omitempty"` Sid string `json:",omitempty"` ParentID string `json:",omitempty"` ParentName string `json:",omitempty"` CaseID string `json:",omitempty"` CaseName string `json:",omitempty"` GroupName string `json:",omitempty"` GroupID string `json:",omitempty"` }
type ValidateResponse ¶
type ValidateResponse struct { UserID ValidateUserResponse `json:",omitempty"` UserName ValidateUserResponse `json:",omitempty"` Sid ValidateUserResponse `json:",omitempty"` ParentID ValidateParentResponse `json:",omitempty"` ParentName ValidateParentResponse `json:",omitempty"` CaseID ValidateCaseResponse `json:",omitempty"` CaseName ValidateCaseResponse `json:",omitempty"` GroupName ValidateGroupResponse `json:",omitempty"` GroupID ValidateGroupResponse `json:",omitempty"` }
type ValidateUserResponse ¶
type ValidateUserResponse struct { Error *ValidationErrorResponse `json:",omitempty"` ID string `json:",omitempty"` UserName string `json:",omitempty"` AuthID string `json:",omitempty"` }
type ValidationErrorResponse ¶ added in v0.1.7
type ValidationErrorResponse struct { LocalizedResponse `json:",omitempty"` Status string `json:",omitempty"` StatusCode int `json:",omitempty"` }
func NewValidationError ¶ added in v0.1.8
func NewValidationError(status string, statusCode int, response LocalizedResponse) ValidationErrorResponse
type Validator ¶
type Validator interface { // Validate should normally not error, but instead return error in the key of each validation-response Validate(r *http.Request, a AuthenticationPayload, v ValidatePayload) (ValidateResponse, error) }
Can be used by clients to validate that their input is valid before submitting data.