mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Implement storage interfaces (#841)
* Implement interfaces for federationsender storage * Implement interfaces for mediaapi storage * Implement interfaces for publicroomsapi storage * Implement interfaces for roomserver storage * Implement interfaces for syncapi storage * Implement interfaces for keydb storage * common.PartitionStorer in publicroomsapi interface * Update copyright notices
This commit is contained in:
parent
6cab622468
commit
c28577ea25
60 changed files with 1594 additions and 1223 deletions
|
@ -67,7 +67,7 @@ func Download(
|
|||
origin gomatrixserverlib.ServerName,
|
||||
mediaID types.MediaID,
|
||||
cfg *config.Dendrite,
|
||||
db *storage.Database,
|
||||
db storage.Database,
|
||||
client *gomatrixserverlib.Client,
|
||||
activeRemoteRequests *types.ActiveRemoteRequests,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
|
@ -192,7 +192,7 @@ func (r *downloadRequest) doDownload(
|
|||
ctx context.Context,
|
||||
w http.ResponseWriter,
|
||||
cfg *config.Dendrite,
|
||||
db *storage.Database,
|
||||
db storage.Database,
|
||||
client *gomatrixserverlib.Client,
|
||||
activeRemoteRequests *types.ActiveRemoteRequests,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
|
@ -235,7 +235,7 @@ func (r *downloadRequest) respondFromLocalFile(
|
|||
absBasePath config.Path,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
maxThumbnailGenerators int,
|
||||
db *storage.Database,
|
||||
db storage.Database,
|
||||
dynamicThumbnails bool,
|
||||
thumbnailSizes []config.ThumbnailSize,
|
||||
) (*types.MediaMetadata, error) {
|
||||
|
@ -325,7 +325,7 @@ func (r *downloadRequest) getThumbnailFile(
|
|||
filePath types.Path,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
maxThumbnailGenerators int,
|
||||
db *storage.Database,
|
||||
db storage.Database,
|
||||
dynamicThumbnails bool,
|
||||
thumbnailSizes []config.ThumbnailSize,
|
||||
) (*os.File, *types.ThumbnailMetadata, error) {
|
||||
|
@ -407,7 +407,7 @@ func (r *downloadRequest) generateThumbnail(
|
|||
thumbnailSize types.ThumbnailSize,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
maxThumbnailGenerators int,
|
||||
db *storage.Database,
|
||||
db storage.Database,
|
||||
) (*types.ThumbnailMetadata, error) {
|
||||
r.Logger.WithFields(log.Fields{
|
||||
"Width": thumbnailSize.Width,
|
||||
|
@ -443,7 +443,7 @@ func (r *downloadRequest) getRemoteFile(
|
|||
ctx context.Context,
|
||||
client *gomatrixserverlib.Client,
|
||||
cfg *config.Dendrite,
|
||||
db *storage.Database,
|
||||
db storage.Database,
|
||||
activeRemoteRequests *types.ActiveRemoteRequests,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
) (errorResponse error) {
|
||||
|
@ -545,7 +545,7 @@ func (r *downloadRequest) fetchRemoteFileAndStoreMetadata(
|
|||
client *gomatrixserverlib.Client,
|
||||
absBasePath config.Path,
|
||||
maxFileSizeBytes config.FileSizeBytes,
|
||||
db *storage.Database,
|
||||
db storage.Database,
|
||||
thumbnailSizes []config.ThumbnailSize,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
maxThumbnailGenerators int,
|
||||
|
|
|
@ -43,7 +43,7 @@ const pathPrefixR0 = "/_matrix/media/r0"
|
|||
func Setup(
|
||||
apiMux *mux.Router,
|
||||
cfg *config.Dendrite,
|
||||
db *storage.Database,
|
||||
db storage.Database,
|
||||
deviceDB *devices.Database,
|
||||
client *gomatrixserverlib.Client,
|
||||
) {
|
||||
|
@ -80,7 +80,7 @@ func Setup(
|
|||
func makeDownloadAPI(
|
||||
name string,
|
||||
cfg *config.Dendrite,
|
||||
db *storage.Database,
|
||||
db storage.Database,
|
||||
client *gomatrixserverlib.Client,
|
||||
activeRemoteRequests *types.ActiveRemoteRequests,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
|
|
|
@ -53,7 +53,7 @@ type uploadResponse struct {
|
|||
// This implementation supports a configurable maximum file size limit in bytes. If a user tries to upload more than this, they will receive an error that their upload is too large.
|
||||
// Uploaded files are processed piece-wise to avoid DoS attacks which would starve the server of memory.
|
||||
// TODO: We should time out requests if they have not received any data within a configured timeout period.
|
||||
func Upload(req *http.Request, cfg *config.Dendrite, db *storage.Database, activeThumbnailGeneration *types.ActiveThumbnailGeneration) util.JSONResponse {
|
||||
func Upload(req *http.Request, cfg *config.Dendrite, db storage.Database, activeThumbnailGeneration *types.ActiveThumbnailGeneration) util.JSONResponse {
|
||||
r, resErr := parseAndValidateRequest(req, cfg)
|
||||
if resErr != nil {
|
||||
return *resErr
|
||||
|
@ -96,7 +96,7 @@ func (r *uploadRequest) doUpload(
|
|||
ctx context.Context,
|
||||
reqReader io.Reader,
|
||||
cfg *config.Dendrite,
|
||||
db *storage.Database,
|
||||
db storage.Database,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
) *util.JSONResponse {
|
||||
r.Logger.WithFields(log.Fields{
|
||||
|
@ -214,7 +214,7 @@ func (r *uploadRequest) storeFileAndMetadata(
|
|||
ctx context.Context,
|
||||
tmpDir types.Path,
|
||||
absBasePath config.Path,
|
||||
db *storage.Database,
|
||||
db storage.Database,
|
||||
thumbnailSizes []config.ThumbnailSize,
|
||||
activeThumbnailGeneration *types.ActiveThumbnailGeneration,
|
||||
maxThumbnailGenerators int,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue