Space Trash-bin expiration cli (#5500)

* add storage-users trash-bin cli
add task to clean up outdated trash-bin resources
add trash-bin cli purge-expired command to purge expired trash-bin resources
add purge-expired task tests
This commit is contained in:
Florian Schade
2023-02-10 12:04:47 +01:00
committed by GitHub
parent 9e73221a68
commit 5da3df8ffe
13 changed files with 650 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import (
"path"
"github.com/cs3org/reva/v2/cmd/revad/runtime"
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
"github.com/gofrs/uuid"
"github.com/oklog/run"
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
@@ -15,6 +16,7 @@ import (
"github.com/owncloud/ocis/v2/ocis-pkg/version"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/config"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/config/parser"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/event"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/logging"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/revaconfig"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/server/debug"
@@ -88,6 +90,27 @@ func Server(cfg *config.Config) *cli.Command {
logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
}
{
stream, err := event.NewStream(cfg.Events)
if err != nil {
logger.Fatal().Err(err).Msg("can't connect to nats")
}
gw, err := pool.GetGatewayServiceClient(cfg.Reva.Address)
if err != nil {
return err
}
eventSVC, err := event.NewService(gw, stream, logger, *cfg)
if err != nil {
logger.Fatal().Err(err).Msg("can't create event service")
}
gr.Add(eventSVC.Run, func(_ error) {
cancel()
})
}
return gr.Run()
},
}