From 8844b0bf57434a2764dc64528dce9e6f9d1972a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20Villaf=C3=A1=C3=B1ez?= Date: Wed, 15 Sep 2021 16:33:34 +0200 Subject: [PATCH] Expose configuration for the reva archiver --- storage/pkg/command/frontend.go | 7 +++++++ storage/pkg/config/config.go | 8 ++++++++ storage/pkg/flagset/frontend.go | 24 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/storage/pkg/command/frontend.go b/storage/pkg/command/frontend.go index ef686698b..1ad2ef05e 100644 --- a/storage/pkg/command/frontend.go +++ b/storage/pkg/command/frontend.go @@ -147,6 +147,13 @@ func frontendConfigFromStruct(c *cli.Context, cfg *config.Config, filesCfg map[s "timeout": 86400, "insecure": true, }, + "archiver": map[string]interface{}{ + "prefix": cfg.Reva.Frontend.ArchiverPrefix, + "timeout": 86400, + "insecure": true, + "max_num_files": cfg.Reva.Archiver.MaxNumFiles, + "max_size": cfg.Reva.Archiver.MaxSize, + }, "datagateway": map[string]interface{}{ "prefix": cfg.Reva.Frontend.DatagatewayPrefix, "transfer_shared_secret": cfg.Reva.TransferSecret, diff --git a/storage/pkg/config/config.go b/storage/pkg/config/config.go index 4d73c02c7..7539eea6c 100644 --- a/storage/pkg/config/config.go +++ b/storage/pkg/config/config.go @@ -132,6 +132,7 @@ type FrontendPort struct { Port AppProviderPrefix string + ArchiverPrefix string DatagatewayPrefix string OCDavPrefix string OCSPrefix string @@ -401,6 +402,12 @@ type OCDav struct { DavFilesNamespace string } +// Archiver defines the available archiver configuration. +type Archiver struct { + MaxNumFiles int64 + MaxSize int64 +} + // Reva defines the available reva configuration. type Reva struct { // JWTSecret used to sign jwt tokens between services @@ -412,6 +419,7 @@ type Reva struct { UserGroupRest UserGroupRest UserOwnCloudSQL UserOwnCloudSQL OCDav OCDav + Archiver Archiver Storages StorageConfig // Ports are used to configure which services to start on which port Frontend FrontendPort diff --git a/storage/pkg/flagset/frontend.go b/storage/pkg/flagset/frontend.go index 2f7ec6fb1..e2ccc3eea 100644 --- a/storage/pkg/flagset/frontend.go +++ b/storage/pkg/flagset/frontend.go @@ -57,6 +57,23 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag { Destination: &cfg.Reva.OCDav.DavFilesNamespace, }, + // Archiver + + &cli.Int64Flag{ + Name: "archiver-max-num-files", + Value: flags.OverrideDefaultInt64(cfg.Reva.Archiver.MaxNumFiles, 10000), + Usage: "Maximum number of files to be included in the archiver", + EnvVars: []string{"STORAGE_ARCHIVER_MAX_NUM_FILES"}, + Destination: &cfg.Reva.Archiver.MaxNumFiles, + }, + &cli.Int64Flag{ + Name: "archiver-max-size", + Value: flags.OverrideDefaultInt64(cfg.Reva.Archiver.MaxSize, 1073741824), // 1GB + Usage: "Maximum size for the sum of the sizes of all the files included in the archive", + EnvVars: []string{"STORAGE_ARCHIVER_MAX_SIZE"}, + Destination: &cfg.Reva.Archiver.MaxSize, + }, + // Services // Frontend @@ -98,6 +115,13 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"STORAGE_FRONTEND_APPPROVIDER_PREFIX"}, Destination: &cfg.Reva.Frontend.AppProviderPrefix, }, + &cli.StringFlag{ + Name: "archiver-prefix", + Value: flags.OverrideDefaultString(cfg.Reva.Frontend.ArchiverPrefix, "archiver"), + Usage: "archiver prefix", + EnvVars: []string{"STORAGE_FRONTEND_ARCHIVER_PREFIX"}, + Destination: &cfg.Reva.Frontend.ArchiverPrefix, + }, &cli.StringFlag{ Name: "datagateway-prefix", Value: flags.OverrideDefaultString(cfg.Reva.Frontend.DatagatewayPrefix, "data"),