Documentation ¶
Index ¶
- type Backend
- func (b *Backend) CountUploadFiles(uploadID string) (count int, err error)
- func (b *Backend) CountUserTokens(userID string) (count int, err error)
- func (b *Backend) CountUsers() (count int, err error)
- func (b *Backend) CreateFile(file *common.File) (err error)
- func (b *Backend) CreateSetting(setting *common.Setting) (err error)
- func (b *Backend) CreateToken(token *common.Token) (err error)
- func (b *Backend) CreateUpload(upload *common.Upload) (err error)
- func (b *Backend) CreateUser(user *common.User) (err error)
- func (b *Backend) DeleteExpiredUploads() (removed int, err error)
- func (b *Backend) DeleteSetting(key string) (err error)
- func (b *Backend) DeleteToken(tokenStr string) (deleted bool, err error)
- func (b *Backend) DeleteUpload(uploadID string) (err error)
- func (b *Backend) DeleteUser(userID string) (deleted bool, err error)
- func (b *Backend) DeleteUserUploads(userID string, tokenStr string) (removed int, err error)
- func (b *Backend) Export(path string) (err error)
- func (b *Backend) ForEachFile(f func(file *common.File) error) (err error)
- func (b *Backend) ForEachRemovedFile(f func(file *common.File) error) (err error)
- func (b *Backend) ForEachSetting(f func(setting *common.Setting) error) (err error)
- func (b *Backend) ForEachToken(f func(token *common.Token) error) (err error)
- func (b *Backend) ForEachUpload(f func(upload *common.Upload) error) (err error)
- func (b *Backend) ForEachUploadFiles(uploadID string, f func(file *common.File) error) (err error)
- func (b *Backend) ForEachUserUploads(userID string, tokenStr string, f func(upload *common.Upload) error) (err error)
- func (b *Backend) ForEachUsers(f func(user *common.User) error) (err error)
- func (b *Backend) GetFile(fileID string) (file *common.File, err error)
- func (b *Backend) GetFiles(uploadID string) (files []*common.File, err error)
- func (b *Backend) GetServerStatistics() (stats *common.ServerStats, err error)
- func (b *Backend) GetSetting(key string) (setting *common.Setting, err error)
- func (b *Backend) GetToken(tokenStr string) (token *common.Token, err error)
- func (b *Backend) GetTokens(userID string, pagingQuery *common.PagingQuery) (tokens []*common.Token, cursor *paginator.Cursor, err error)
- func (b *Backend) GetUpload(ID string) (upload *common.Upload, err error)
- func (b *Backend) GetUploadStatistics(userID *string, tokenStr *string) (uploads int, files int, size int64, err error)
- func (b *Backend) GetUploads(userID string, tokenStr string, withFiles bool, ...) (uploads []*common.Upload, cursor *paginator.Cursor, err error)
- func (b *Backend) GetUser(ID string) (user *common.User, err error)
- func (b *Backend) GetUserStatistics(userID string, tokenStr *string) (stats *common.UserStats, err error)
- func (b *Backend) GetUsers(provider string, withTokens bool, pagingQuery *common.PagingQuery) (users []*common.User, cursor *paginator.Cursor, err error)
- func (b *Backend) Import(path string) (err error)
- func (b *Backend) PurgeDeletedUploads() (removed int, err error)
- func (b *Backend) RemoveFile(file *common.File) error
- func (b *Backend) RemoveUploadFiles(uploadID string) (err error)
- func (b *Backend) Shutdown() (err error)
- func (b *Backend) UpdateFile(file *common.File, status string) error
- func (b *Backend) UpdateFileStatus(file *common.File, oldStatus string, newStatus string) error
- func (b *Backend) UpdateSetting(key string, oldValue string, newValue string) (err error)
- func (b *Backend) UpdateUser(user *common.User) (err error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct { Config *Config // contains filtered or unexported fields }
Backend object
func NewBackend ¶
NewBackend instantiate a new File Data Backend from configuration passed as argument
func (*Backend) CountUploadFiles ¶
CountUploadFiles count how many files have been added to an upload
func (*Backend) CountUserTokens ¶
CountUserTokens count how many token a user has
func (*Backend) CountUsers ¶
CountUsers count the number of user in the DB
func (*Backend) CreateFile ¶
CreateFile persist a new file to the database
func (*Backend) CreateSetting ¶
CreateSetting create a new setting in DB
func (*Backend) CreateToken ¶
CreateToken create a new token in DB
func (*Backend) CreateUpload ¶
CreateUpload create a new upload in DB
func (*Backend) CreateUser ¶
CreateUser create a new user in DB
func (*Backend) DeleteExpiredUploads ¶
DeleteExpiredUploads soft delete all expired uploads
func (*Backend) DeleteSetting ¶
DeleteSetting delete a setting from DB
func (*Backend) DeleteToken ¶
DeleteToken remove a token from the DB
func (*Backend) DeleteUpload ¶
DeleteUpload soft delete upload ( just set upload.DeletedAt field ) and remove all files
func (*Backend) DeleteUser ¶
DeleteUser delete a user from the DB
func (*Backend) DeleteUserUploads ¶
DeleteUserUploads delets all uploads matching the user and token filters
func (*Backend) ForEachFile ¶
ForEachFile execute f for every file in the database
func (*Backend) ForEachRemovedFile ¶
ForEachRemovedFile execute f for each file with the status "removed"
func (*Backend) ForEachSetting ¶
ForEachSetting execute f for every setting in the database
func (*Backend) ForEachToken ¶
ForEachToken execute f for every token in the database
func (*Backend) ForEachUpload ¶
ForEachUpload execute f for every upload in the database
func (*Backend) ForEachUploadFiles ¶
ForEachUploadFiles execute f for each file of the upload
func (*Backend) ForEachUserUploads ¶
func (b *Backend) ForEachUserUploads(userID string, tokenStr string, f func(upload *common.Upload) error) (err error)
ForEachUserUploads execute f for all upload matching the user and token filters
func (*Backend) ForEachUsers ¶
ForEachUsers execute f for every user in the database
func (*Backend) GetServerStatistics ¶
func (b *Backend) GetServerStatistics() (stats *common.ServerStats, err error)
GetServerStatistics return statistics about user all uploads
func (*Backend) GetSetting ¶
GetSetting get a setting from DB
func (*Backend) GetToken ¶
GetToken return a token from the DB ( return nil and non error if not found )
func (*Backend) GetTokens ¶
func (b *Backend) GetTokens(userID string, pagingQuery *common.PagingQuery) (tokens []*common.Token, cursor *paginator.Cursor, err error)
GetTokens return all tokens for a user
func (*Backend) GetUpload ¶
GetUpload return an upload from the DB ( return nil and no error if not found )
func (*Backend) GetUploadStatistics ¶
func (b *Backend) GetUploadStatistics(userID *string, tokenStr *string) (uploads int, files int, size int64, err error)
GetUploadStatistics return statistics about uploads for userID and tokenStr params : nil doesn't activate the filter, empty string enables the filter with an empty value to generate statistics about anonymous upload
func (*Backend) GetUploads ¶
func (b *Backend) GetUploads(userID string, tokenStr string, withFiles bool, pagingQuery *common.PagingQuery) (uploads []*common.Upload, cursor *paginator.Cursor, err error)
GetUploads return uploads from DB userID and tokenStr are filters set withFiles to also fetch the files
func (*Backend) GetUserStatistics ¶
func (b *Backend) GetUserStatistics(userID string, tokenStr *string) (stats *common.UserStats, err error)
GetUserStatistics return statistics about user uploads for tokenStr params : nil doesn't activate the filter, empty string enables the filter with an empty value to generate statistics about upload without a token
func (*Backend) GetUsers ¶
func (b *Backend) GetUsers(provider string, withTokens bool, pagingQuery *common.PagingQuery) (users []*common.User, cursor *paginator.Cursor, err error)
GetUsers return all users provider is an optional filter
func (*Backend) PurgeDeletedUploads ¶
PurgeDeletedUploads ensure all files from an expired upload have been deleted Then delete the upload and files for good
func (*Backend) RemoveFile ¶
RemoveFile change the file status to removed The file will then be deleted from the data backend by the server and the status changed to deleted.
func (*Backend) RemoveUploadFiles ¶
RemoveUploadFiles set the file status to removed for all files of an upload The files are then deleted by the servers and their status set to removed
func (*Backend) UpdateFile ¶
UpdateFile update a file in DB. Status ensure the file status has not changed since loaded
func (*Backend) UpdateFileStatus ¶
UpdateFileStatus update a file status in DB. oldStatus ensure the file status has not changed since loaded
func (*Backend) UpdateSetting ¶
UpdateSetting update a setting in DB