Documentation ¶
Index ¶
- Constants
- type DatabaseProvider
- func (p DatabaseProvider) Close()
- func (p DatabaseProvider) DeleteAllSessions()
- func (p DatabaseProvider) DeleteApiKey(id string)
- func (p DatabaseProvider) DeleteEnd2EndInfo()
- func (p DatabaseProvider) DeleteHotlink(id string)
- func (p DatabaseProvider) DeleteMetaData(id string)
- func (p DatabaseProvider) DeleteSession(id string)
- func (p DatabaseProvider) GetAllApiKeys() map[string]models.ApiKey
- func (p DatabaseProvider) GetAllHotlinks() []string
- func (p DatabaseProvider) GetAllMetaDataIds() []string
- func (p DatabaseProvider) GetAllMetadata() map[string]models.File
- func (p DatabaseProvider) GetAllUploadStatus() []models.UploadStatus
- func (p DatabaseProvider) GetApiKey(id string) (models.ApiKey, bool)
- func (p DatabaseProvider) GetDbVersion() int
- func (p DatabaseProvider) GetEnd2EndInfo() models.E2EInfoEncrypted
- func (p DatabaseProvider) GetHotlink(id string) (string, bool)
- func (p DatabaseProvider) GetMetaDataById(id string) (models.File, bool)
- func (p DatabaseProvider) GetSchemaVersion() int
- func (p DatabaseProvider) GetSession(id string) (models.Session, bool)
- func (p DatabaseProvider) GetType() int
- func (p DatabaseProvider) GetUploadDefaults() (models.LastUploadValues, bool)
- func (p DatabaseProvider) GetUploadStatus(id string) (models.UploadStatus, bool)
- func (p DatabaseProvider) RunGarbageCollection()
- func (p DatabaseProvider) SaveApiKey(apikey models.ApiKey)
- func (p DatabaseProvider) SaveEnd2EndInfo(info models.E2EInfoEncrypted)
- func (p DatabaseProvider) SaveHotlink(file models.File)
- func (p DatabaseProvider) SaveMetaData(file models.File)
- func (p DatabaseProvider) SaveSession(id string, session models.Session)
- func (p DatabaseProvider) SaveUploadDefaults(values models.LastUploadValues)
- func (p DatabaseProvider) SaveUploadStatus(status models.UploadStatus)
- func (p DatabaseProvider) SetDbVersion(currentVersion int)
- func (p DatabaseProvider) UpdateTimeApiKey(apikey models.ApiKey)
- func (p DatabaseProvider) Upgrade(currentDbVersion int)
Constants ¶
const DatabaseSchemeVersion = 2
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseProvider ¶
type DatabaseProvider struct {
// contains filtered or unexported fields
}
DatabaseProvider contains the database instance
func (DatabaseProvider) DeleteAllSessions ¶
func (p DatabaseProvider) DeleteAllSessions()
DeleteAllSessions logs all users out
func (DatabaseProvider) DeleteApiKey ¶
func (p DatabaseProvider) DeleteApiKey(id string)
DeleteApiKey deletes an API key with the given ID
func (DatabaseProvider) DeleteEnd2EndInfo ¶
func (p DatabaseProvider) DeleteEnd2EndInfo()
DeleteEnd2EndInfo resets the encrypted e2e info
func (DatabaseProvider) DeleteHotlink ¶
func (p DatabaseProvider) DeleteHotlink(id string)
DeleteHotlink deletes a hotlink with the given hotlink ID
func (DatabaseProvider) DeleteMetaData ¶
func (p DatabaseProvider) DeleteMetaData(id string)
DeleteMetaData deletes information about a file
func (DatabaseProvider) DeleteSession ¶
func (p DatabaseProvider) DeleteSession(id string)
DeleteSession deletes a session with the given ID
func (DatabaseProvider) GetAllApiKeys ¶
func (p DatabaseProvider) GetAllApiKeys() map[string]models.ApiKey
GetAllApiKeys returns a map with all API keys
func (DatabaseProvider) GetAllHotlinks ¶
func (p DatabaseProvider) GetAllHotlinks() []string
GetAllHotlinks returns an array with all hotlink ids
func (DatabaseProvider) GetAllMetaDataIds ¶
func (p DatabaseProvider) GetAllMetaDataIds() []string
GetAllMetaDataIds returns all Ids that contain metadata
func (DatabaseProvider) GetAllMetadata ¶
func (p DatabaseProvider) GetAllMetadata() map[string]models.File
GetAllMetadata returns a map of all available files
func (DatabaseProvider) GetAllUploadStatus ¶
func (p DatabaseProvider) GetAllUploadStatus() []models.UploadStatus
GetAllUploadStatus returns all UploadStatus values from the past 24 hours
func (DatabaseProvider) GetApiKey ¶
func (p DatabaseProvider) GetApiKey(id string) (models.ApiKey, bool)
GetApiKey returns a models.ApiKey if valid or false if the ID is not valid
func (DatabaseProvider) GetDbVersion ¶
func (p DatabaseProvider) GetDbVersion() int
GetDbVersion gets the version number of the database
func (DatabaseProvider) GetEnd2EndInfo ¶
func (p DatabaseProvider) GetEnd2EndInfo() models.E2EInfoEncrypted
GetEnd2EndInfo retrieves the encrypted e2e info
func (DatabaseProvider) GetHotlink ¶
func (p DatabaseProvider) GetHotlink(id string) (string, bool)
GetHotlink returns the id of the file associated or false if not found
func (DatabaseProvider) GetMetaDataById ¶
func (p DatabaseProvider) GetMetaDataById(id string) (models.File, bool)
GetMetaDataById returns a models.File from the ID passed or false if the id is not valid
func (DatabaseProvider) GetSchemaVersion ¶
func (p DatabaseProvider) GetSchemaVersion() int
GetSchemaVersion returns the version number, that the database should be if fully upgraded
func (DatabaseProvider) GetSession ¶
func (p DatabaseProvider) GetSession(id string) (models.Session, bool)
GetSession returns the session with the given ID or false if not a valid ID
func (DatabaseProvider) GetType ¶
func (p DatabaseProvider) GetType() int
GetType returns 1, for being a Redis interface
func (DatabaseProvider) GetUploadDefaults ¶
func (p DatabaseProvider) GetUploadDefaults() (models.LastUploadValues, bool)
GetUploadDefaults returns the last used setting for amount of downloads allowed, last expiry in days and a password for the file
func (DatabaseProvider) GetUploadStatus ¶
func (p DatabaseProvider) GetUploadStatus(id string) (models.UploadStatus, bool)
GetUploadStatus returns a models.UploadStatus from the ID passed or false if the id is not valid
func (DatabaseProvider) RunGarbageCollection ¶
func (p DatabaseProvider) RunGarbageCollection()
RunGarbageCollection runs the databases GC
func (DatabaseProvider) SaveApiKey ¶
func (p DatabaseProvider) SaveApiKey(apikey models.ApiKey)
SaveApiKey saves the API key to the database
func (DatabaseProvider) SaveEnd2EndInfo ¶
func (p DatabaseProvider) SaveEnd2EndInfo(info models.E2EInfoEncrypted)
SaveEnd2EndInfo stores the encrypted e2e info
func (DatabaseProvider) SaveHotlink ¶
func (p DatabaseProvider) SaveHotlink(file models.File)
SaveHotlink stores the hotlink associated with the file in the database
func (DatabaseProvider) SaveMetaData ¶
func (p DatabaseProvider) SaveMetaData(file models.File)
SaveMetaData stores the metadata of a file to the disk
func (DatabaseProvider) SaveSession ¶
func (p DatabaseProvider) SaveSession(id string, session models.Session)
SaveSession stores the given session. After the expiry passed, it will be deleted automatically
func (DatabaseProvider) SaveUploadDefaults ¶
func (p DatabaseProvider) SaveUploadDefaults(values models.LastUploadValues)
SaveUploadDefaults saves the last used setting for an upload
func (DatabaseProvider) SaveUploadStatus ¶
func (p DatabaseProvider) SaveUploadStatus(status models.UploadStatus)
SaveUploadStatus stores the upload status of a new file for 24 hours
func (DatabaseProvider) SetDbVersion ¶
func (p DatabaseProvider) SetDbVersion(currentVersion int)
SetDbVersion sets the version number of the database
func (DatabaseProvider) UpdateTimeApiKey ¶
func (p DatabaseProvider) UpdateTimeApiKey(apikey models.ApiKey)
UpdateTimeApiKey writes the content of LastUsage to the database
func (DatabaseProvider) Upgrade ¶
func (p DatabaseProvider) Upgrade(currentDbVersion int)
Upgrade migrates the DB to a new Gokapi version, if required