Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
github.com/gabriel-vasile/mimetype v1.4.15
github.com/ggwhite/go-masker v1.1.0
github.com/go-chi/chi/v5 v5.3.2
github.com/go-chi/chi/v5 v5.4.0
github.com/go-chi/render v1.0.3
github.com/go-ldap/ldap/v3 v3.4.15
github.com/go-ldap/ldif v0.0.0-20200320164324-fd88d9b715b3
Expand All @@ -33,7 +33,7 @@
github.com/go-micro/plugins/v4/store/nats-js-kv v0.0.0-20240726082623-6831adfdcdc4
github.com/go-micro/plugins/v4/wrapper/monitoring/prometheus v1.2.0
github.com/go-micro/plugins/v4/wrapper/trace/opentelemetry v1.2.0
github.com/go-playground/validator/v10 v10.30.3
github.com/go-playground/validator/v10 v10.30.5
github.com/go-resty/resty/v2 v2.17.2
github.com/go-viper/mapstructure/v2 v2.5.0
github.com/gofrs/flock v0.13.1
Expand Down Expand Up @@ -68,7 +68,7 @@
github.com/open-policy-agent/opa v1.21.1
github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89
github.com/opencloud-eu/libre-graph-api-go v1.0.9-0.20261016073229-17ed3d5dd346
github.com/opencloud-eu/reva/v2 v2.52.1
github.com/opencloud-eu/reva/v2 v2.52.3-0.20261113144838-03685668969d
github.com/opensearch-project/opensearch-go/v4 v4.7.3
github.com/orcaman/concurrent-map v1.0.0
github.com/pkg/errors v0.9.1
Expand Down Expand Up @@ -208,8 +208,8 @@
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.9.1 // indirect
github.com/go-git/go-git/v5 v5.19.2 // indirect
github.com/go-jose/go-jose/v3 v3.0.5 // indirect

Check warning on line 211 in go.mod

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

go.mod#L211

Insecure dependency golang/github.com/go-jose/go-jose/v3@v3.0.5 (CVE-2026-116585: github.com/go-jose/go-jose: go-jose: Denial of Service via empty ciphertext buffer during JWE decryption) (no fix available)
github.com/go-jose/go-jose/v4 v4.1.5 // indirect
github.com/go-jose/go-jose/v4 v4.1.6 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.4.4 // indirect
Expand All @@ -218,7 +218,7 @@
github.com/go-micro/plugins/v4/store/nats-js v1.2.1 // indirect
github.com/go-micro/plugins/v4/store/redis v1.2.1 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/locales v0.14.2 // indirect
github.com/go-playground/universal-translator v0.18.2 // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/go-sql-driver/mysql v1.10.1 // indirect
Expand Down Expand Up @@ -259,7 +259,7 @@
github.com/klauspost/crc32 v1.3.0 // indirect
github.com/kovidgoyal/go-parallel v1.1.1 // indirect
github.com/kovidgoyal/go-shm v1.0.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/leodido/go-urn v1.5.0 // indirect
github.com/lestrrat-go/blackmagic v1.0.4 // indirect
github.com/lestrrat-go/dsig v1.4.0 // indirect
github.com/lestrrat-go/dsig-secp256k1 v1.0.0 // indirect
Expand Down
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkPro
github.com/go-asn1-ber/asn1-ber v1.4.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-asn1-ber/asn1-ber v1.5.8 h1:H9AZkK22UOmfX8J84ubyaZxKJZ3FMHVwn8swoMML7iQ=
github.com/go-asn1-ber/asn1-ber v1.5.8/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-chi/chi/v5 v5.3.2 h1:5YQkICvTCSZ25hoRsyJazN0scjzKGiu4VAUc7H1o1nY=
github.com/go-chi/chi/v5 v5.3.2/go.mod h1:R+tYY2hNuVUUjxoPtqUdgBqevM9s9njzkTLutVsOCto=
github.com/go-chi/chi/v5 v5.4.0 h1:+ufzvFTGKyin26Or5DLrlIDq4ygIDBVcj7oVNeeaYFE=
github.com/go-chi/chi/v5 v5.4.0/go.mod h1:d1IG7GtKPSjPyBP365PH8sAGVHk3qfB/IhjFNRH1wWM=
github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4=
github.com/go-chi/render v1.0.3/go.mod h1:/gr3hVkmYR0YlEy3LxCuVRFzEu9Ruok+gFqbIofjao0=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
Expand All @@ -323,8 +323,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2
github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
github.com/go-jose/go-jose/v3 v3.0.5 h1:BLLJWbC4nMZOfuPVxoZIxeYsn6Nl2r1fITaJ78UQlVQ=
github.com/go-jose/go-jose/v3 v3.0.5/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
github.com/go-jose/go-jose/v4 v4.1.5 h1:RjgjO2LOtWOJKUC5wpwY9LR3B3vwVAz6JS2YHfYU6eA=
github.com/go-jose/go-jose/v4 v4.1.5/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4=
github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
Expand Down Expand Up @@ -373,12 +373,12 @@ github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/locales v0.14.2 h1:d8UmcrM6Nip0hfGZKLGpAvZH37XB4TS0xzK9B56YNCY=
github.com/go-playground/locales v0.14.2/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.2 h1:LCsMLC9RzmbUMNUPVYD15dmcjwYAJhmX8mPZRW4rAVU=
github.com/go-playground/universal-translator v0.18.2/go.mod h1:67VZIMp5lQpDWlnStOct22q1bkdJGJqHghbOtmkawxk=
github.com/go-playground/validator/v10 v10.30.3 h1:4MU6YkEwx7GbcPJOZxrtbu+QfF3pJLJuaYTeAH0DYy8=
github.com/go-playground/validator/v10 v10.30.3/go.mod h1:4Axh7oCNGcoGkqLoE4YWt6n20mcEIsPRlB7vPk3lpyc=
github.com/go-playground/validator/v10 v10.30.5 h1:YyCXvVShZbs2Sm3Mb53eNOlhRXctSOzW5QJAouCTZL4=
github.com/go-playground/validator/v10 v10.30.5/go.mod h1:wEqiaov48pXX1kjhc3Da8y0M0Dtg/BK7gurFBLgwFrQ=
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/go-resty/resty/v2 v2.17.2 h1:FQW5oHYcIlkCNrMD2lloGScxcHJ0gkjshV3qcQAyHQk=
Expand Down Expand Up @@ -610,8 +610,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/leodido/go-urn v1.5.0 h1:pLqT2kq1zpHW/1D18QMjMpdtX7cekxqtJJjg5ANyWw0=
github.com/leodido/go-urn v1.5.0/go.mod h1:9BORnCDhdPBJNDEX+w1bJisa8yOKYi116VeO96s4ifE=
github.com/leonelquinteros/gotext v1.7.3-0.20260422134830-b012b4ccae69 h1:ZLo0bXX17iUZpb/Sp7N+1uK4Jb7dl0fm5x5ETfzYSvY=
github.com/leonelquinteros/gotext v1.7.3-0.20260422134830-b012b4ccae69/go.mod h1:ksG5iXViKefoupjy+0qQjAVoaDnylnQ1ejWl9g14wh8=
github.com/lestrrat-go/blackmagic v1.0.4 h1:IwQibdnf8l2KoO+qC3uT4OaTWsW7tuRQXy9TRN9QanA=
Expand Down Expand Up @@ -761,8 +761,8 @@ github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89 h1:W1ms+l
github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89/go.mod h1:vigJkNss1N2QEceCuNw/ullDehncuJNFB6mEnzfq9UI=
github.com/opencloud-eu/libre-graph-api-go v1.0.9-0.20261016073229-17ed3d5dd346 h1:3ptbiFhSK4fzY/rC3idcYUveiwepMoOov1sBpc7Rg3k=
github.com/opencloud-eu/libre-graph-api-go v1.0.9-0.20261016073229-17ed3d5dd346/go.mod h1:lTM8JeGblNpoMySTW7Lui2+c5TTLI95mwxtdUIHHrhU=
github.com/opencloud-eu/reva/v2 v2.52.1 h1:c4tjmqtbJeqDjztTNq4Jvl3dWWSMHhXqV1JixKLKbT4=
github.com/opencloud-eu/reva/v2 v2.52.1/go.mod h1:rAwuI3PX8n3RxBXHfpMtAKqfwxTIKhZol1Bi3Qj39p8=
github.com/opencloud-eu/reva/v2 v2.52.3-0.20261113144838-03685668969d h1:U9B6MvPDbNWwoOUHCPUO1GwxL/n1TbE2Tlomo+P0Qp4=
github.com/opencloud-eu/reva/v2 v2.52.3-0.20261113144838-03685668969d/go.mod h1:nKOQFFHQZiBFiiXBqEIc99giHQ/Pe0XYf5cztJhZDYw=
github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4 h1:l2oB/RctH+t8r7QBj5p8thfEHCM/jF35aAY3WQ3hADI=
github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4/go.mod h1:BmF5hyM6tXczk3MpQkFf1hpKSRqCyhqcbiQtiAF7+40=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
Expand Down Expand Up @@ -951,8 +951,8 @@ github.com/testcontainers/testcontainers-go/modules/opensearch v0.44.0 h1:iuBDo8
github.com/testcontainers/testcontainers-go/modules/opensearch v0.44.0/go.mod h1:8Qw29ffsCPzhomxqoeGhpj3J3Lbsrv0FsOUWeOjTl+I=
github.com/tetratelabs/wazero v1.12.0 h1:DuWcpNu/FzgEXgGBDp8J1Spc+CWOvvtvVyjKlaZopYU=
github.com/tetratelabs/wazero v1.12.0/go.mod h1:LvKtzl2RqO4gyF27BiXU+nKAjcV8f38U+kP/q2vgxh0=
github.com/thanhpk/randstr v1.0.6 h1:psAOktJFD4vV9NEVb3qkhRSMvYh4ORRaj1+w/hn4B+o=
github.com/thanhpk/randstr v1.0.6/go.mod h1:M/H2P1eNLZzlDwAzpkkkUvoyNNMbzRGhESZuEQk3r0U=
github.com/thanhpk/randstr v1.0.7 h1:tfsKHOb2hkJVJoguakWQ0IYDGM9BsBcFIpJdmIoQp9M=
github.com/thanhpk/randstr v1.0.7/go.mod h1:M/H2P1eNLZzlDwAzpkkkUvoyNNMbzRGhESZuEQk3r0U=
github.com/thejerf/suture/v4 v4.0.6 h1:QsuCEsCqb03xF9tPAsWAj8QOAJBgQI1c0VqJNaingg8=
github.com/thejerf/suture/v4 v4.0.6/go.mod h1:gu9Y4dXNUWFrByqRt30Rm9/UZ0wzRSt9AJS6xu/ZGxU=
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
Expand Down
9 changes: 6 additions & 3 deletions services/ocm/pkg/revaconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package revaconfig
import (
"math"
"net/url"
"path/filepath"

"github.com/opencloud-eu/opencloud/pkg/log"
"github.com/opencloud-eu/opencloud/services/ocm/pkg/config"
Expand Down Expand Up @@ -94,8 +95,9 @@ func OCMConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]any {
"expose_recipient_display_name": cfg.OCMD.ExposeRecipientDisplayName,
},
"dataprovider": map[string]any{
"prefix": "data",
"driver": "ocmreceived",
"prefix": "data",
"driver": "ocmreceived",
"upload_directory": filepath.Join(cfg.OCMStorageProvider.StorageRoot, "uploads"),
"drivers": map[string]any{
"ocmreceived": map[string]any{
"insecure": cfg.OCMStorageProvider.Insecure,
Expand Down Expand Up @@ -175,7 +177,8 @@ func OCMConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]any {
},
},
"storageprovider": map[string]any{
"driver": "ocmreceived",
"driver": "ocmreceived",
"upload_directory": filepath.Join(cfg.OCMStorageProvider.StorageRoot, "uploads"),
"drivers": map[string]any{
"ocmreceived": map[string]any{
"insecure": cfg.OCMStorageProvider.Insecure,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func (pp *Postprocessing) finished(outcome events.PostprocessingOutcome) events.
UploadID: pp.ID,
ExecutingUser: pp.User,
Filename: pp.Filename,
ResourceID: pp.ResourceID,
Outcome: outcome,
ImpersonatingUser: pp.ImpersonatingUser,
}
Expand Down
18 changes: 18 additions & 0 deletions services/storage-users/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ OPTIONS:
--processing filter sessions by processing status (default: unset)
--expired filter sessions by expired status (default: unset)
--has-virus filter sessions by virus scan result (default: unset)
--orphaned filter sessions by whether their node metadata is unreadable (default: unset)
--json output as json (default: false)
--restart send restart event for all listed sessions (default: false)
--resume send resume event for all listed sessions (default: false)
Expand Down Expand Up @@ -149,6 +150,23 @@ opencloud storage-users uploads sessions --expired=true --clean
opencloud storage-users uploads sessions --processing=false --has-virus=false --resume
```

Uploads whose node metadata can no longer be read are orphaned: they can never finish
postprocessing, because the destination of the upload cannot be resolved. Such uploads stay
in processing state indefinitely and keep consuming the quota of their space. Use the
`--orphaned` filter to list them, and `--clean` to remove them and release the quota.

```bash
# lists all orphaned upload sessions
opencloud storage-users uploads sessions --orphaned=true

# removes them and releases the quota they consume
opencloud storage-users uploads sessions --orphaned=true --clean
```

Note: `--orphaned` reads the node metadata of every upload session, so it is slower than the
other filters. Cleaning an orphaned session deletes the uploaded bytes, which are the only
copy as long as postprocessing has not finished. Run the command without `--clean` first.


#### Delete Stale Nodes command

Expand Down
51 changes: 42 additions & 9 deletions services/storage-users/pkg/command/uploads.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
olog "github.com/opencloud-eu/opencloud/pkg/log"
opencloudstorage "github.com/opencloud-eu/opencloud/pkg/storage"
"github.com/opencloud-eu/opencloud/services/storage-users/pkg/config"
"github.com/opencloud-eu/opencloud/services/storage-users/pkg/config/parser"
Expand All @@ -31,6 +32,7 @@ import (
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/lookup"
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/metadata/prefixes"
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/node"
"github.com/opencloud-eu/reva/v2/pkg/upload"
"github.com/opencloud-eu/reva/v2/pkg/utils"
)

Expand Down Expand Up @@ -94,10 +96,12 @@ func ListUploadSessions(cfg *config.Config) *cobra.Command {
// We need to init the posix driver with 'scanfs' disabled
posixDrivers := revaconfig.Posix(cfg, false, false)
// Disable async file uploads: this command only lists sessions and publishes
// events, but with async uploads enabled the driver would join the "dcfs"
// JetStream queue group. Events routed to this short-lived CLI member are
// auto-acked by the nats client and lost when the process exits, so the
// clean/restart/resume events published below would never reach the daemon.
// events, but with async uploads enabled the driver would join the
// "dcfs-revisions" JetStream queue group. Events routed to this short-lived
// CLI member are auto-acked by the nats client and lost when the process
// exits, so the daemon would miss them. The coordinator built below does not
// subscribe to postprocessing events, so the clean/restart/resume events
// published below reach the daemon.
posixDrivers["asyncfileuploads"] = false
drivers["posix"] = posixDrivers
// Also posix refuses to start without an events stream
Expand All @@ -108,15 +112,21 @@ func ListUploadSessions(cfg *config.Config) *cobra.Command {
}
}

fs, err := f(drivers[driver].(map[string]any), fsStream, nil)
driverConf, ok := drivers[driver].(map[string]any)
if !ok {
fmt.Fprintf(os.Stderr, "No configuration found for filesystem driver '%s'\n", cfg.Driver)
os.Exit(1)
}
fs, err := f(driverConf, fsStream, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to initialize filesystem driver '%s'\n", cfg.Driver)
return err
}

managingFS, ok := fs.(storage.UploadSessionLister)
if !ok {
fmt.Fprintf(os.Stderr, "'%s' storage does not support listing upload sessions\n", cfg.Driver)
logger := olog.Configure(cfg.Service.Name, cfg.Commons, cfg.LogLevel)
coord, err := upload.NewCoordinatorFromConfig("", driverConf, fs, nil, &logger.Logger, false)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to initialize the upload coordinator: %v\n", err)
os.Exit(1)
}

Expand All @@ -135,7 +145,7 @@ func ListUploadSessions(cfg *config.Config) *cobra.Command {
}

filter := buildFilter(cmd)
uploads, err := managingFS.ListUploadSessions(cmd.Context(), filter)
uploads, err := coord.ListUploadSessions(cmd.Context(), filter)
if err != nil {
return err
}
Expand Down Expand Up @@ -240,6 +250,7 @@ func ListUploadSessions(cfg *config.Config) *cobra.Command {
listUploadSessionsCmd.Flags().Bool("processing", false, "filter sessions by processing status")
listUploadSessionsCmd.Flags().Bool("expired", false, "filter sessions by expired status")
listUploadSessionsCmd.Flags().Bool("has-virus", false, "filter sessions by virus scan result")
listUploadSessionsCmd.Flags().Bool("orphaned", false, "filter sessions by whether their node metadata is unreadable. Such sessions can never finish processing and can be removed with --clean")
listUploadSessionsCmd.Flags().Bool("json", false, "output as json")
listUploadSessionsCmd.Flags().Bool("restart", false, "send restart event for all listed sessions. Only one of resume/restart/clean can be set.")
listUploadSessionsCmd.Flags().Bool("resume", false, "send resume event for all listed sessions. Only one of resume/restart/clean can be set.")
Expand All @@ -261,6 +272,10 @@ func buildFilter(cmd *cobra.Command) storage.UploadSessionFilter {
infectedValue, _ := cmd.Flags().GetBool("has-virus")
filter.HasVirus = &infectedValue
}
if cmd.Flag("orphaned").Changed {
orphanedValue, _ := cmd.Flags().GetBool("orphaned")
filter.Orphaned = &orphanedValue
}
if cmd.Flag("id").Changed {
idValue, _ := cmd.Flags().GetString("id")
if idValue != "" {
Expand Down Expand Up @@ -319,6 +334,24 @@ func buildInfo(filter storage.UploadSessionFilter) string {
}
}

if filter.Orphaned != nil {
if b.Len() != 0 {
b.WriteString(", ")
}
if !*filter.Orphaned {
if b.Len() == 0 {
b.WriteString("Not ")
} else {
b.WriteString("not ")
}
}
if b.Len() == 0 {
b.WriteString("Orphaned")
} else {
b.WriteString("orphaned")
}
}

if b.Len() == 0 {
b.WriteString("Session")
} else {
Expand Down
20 changes: 20 additions & 0 deletions services/storage-users/pkg/command/uploads_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ func TestBuildInfo(t *testing.T) {
filter: storage.UploadSessionFilter{Processing: boolPtr(true), Expired: boolPtr(false), HasVirus: boolPtr(true), ID: strPtr("123")},
expectedInfo: "Processing, not expired, virusinfected session with id '123':",
},
{
alias: "orphaned",
filter: storage.UploadSessionFilter{Orphaned: boolPtr(true)},
expectedInfo: "Orphaned sessions:",
},
{
alias: "not orphaned",
filter: storage.UploadSessionFilter{Orphaned: boolPtr(false)},
expectedInfo: "Not orphaned sessions:",
},
{
alias: "processing and orphaned",
filter: storage.UploadSessionFilter{Processing: boolPtr(true), Orphaned: boolPtr(true)},
expectedInfo: "Processing, orphaned sessions:",
},
{
alias: "expired, not virus infected and orphaned",
filter: storage.UploadSessionFilter{Expired: boolPtr(true), HasVirus: boolPtr(false), Orphaned: boolPtr(true)},
expectedInfo: "Expired, not virusinfected, orphaned sessions:",
},
}

for _, tc := range testCases {
Expand Down
1 change: 1 addition & 0 deletions services/storage-users/pkg/revaconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]any {
"prefix": cfg.HTTP.Prefix,
"driver": storage.EffectiveDriver(cfg.Driver),
"drivers": DataProviderDrivers(cfg),
"mount_id": cfg.MountID,
"nats_address": cfg.Events.Addr,
"nats_clusterID": cfg.Events.ClusterID,
"nats_tls_insecure": cfg.Events.TLSInsecure,
Expand Down
Loading
Loading