replace reva by fork

Signed-off-by: Christian Richter <c.richter@opencloud.eu>
This commit is contained in:
Christian Richter
2025-07-04 12:02:38 +02:00
parent 818490592f
commit 726af50e16
8 changed files with 67 additions and 3 deletions

4
go.sum
View File

@@ -281,6 +281,8 @@ github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
github.com/dnsimple/dnsimple-go v0.63.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c71tQlGr9SeGrg=
github.com/dragonchaser/reva/v2 v2.0.0-20250704073728-ba915c60abf9 h1:v5HDeqlYHRTeu6eI/C91ddKQfuGFbolAPu3hGHHI9ag=
github.com/dragonchaser/reva/v2 v2.0.0-20250704073728-ba915c60abf9/go.mod h1:hSIUWU8JUaX+y0cVjbh6VaW6Mh0uJ/azFPx5cSVhQfc=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e h1:rcHHSQqzCgvlwP0I/fQ8rQMn/MpHE5gWSLdtpxtP6KQ=
@@ -868,8 +870,6 @@ github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-202505121527
github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY=
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250703062332-6dc201fd7bf1 h1:DNJ5mJdEKguSXSTeSBRG5yBZO8FnmWibAc6MlXbRxfc=
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250703062332-6dc201fd7bf1/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q=
github.com/opencloud-eu/reva/v2 v2.34.0 h1:9oiMWj3wAaooddgq2hskD6e+JBbdqzQNVublPMkhKDs=
github.com/opencloud-eu/reva/v2 v2.34.0/go.mod h1:hfXmgujx6teOLoh5dbDINaAgHYwXZZr9qYczxU/h+do=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=

View File

@@ -85,6 +85,11 @@ func (fs *owncloudsqlfs) ListStorageSpaces(ctx context.Context, filter []*provid
}
spaces = append(spaces, space)
}
for _, space := range spaces {
space.HasTrashedItems = false // owncloudsql does not support checking for trashed items
}
return spaces, nil
}

View File

@@ -397,3 +397,26 @@ func (tb *Trashbin) EmptyRecycle(ctx context.Context, spaceID string) error {
}
return os.RemoveAll(filepath.Clean(filepath.Join(trashRoot, "info")))
}
func (tb *Trashbin) IsEmpty(ctx context.Context, spaceID string) bool {
_, span := tracer.Start(ctx, "HasTrashedItems")
defer span.End()
trashRoot := filepath.Join(tb.lu.InternalPath(spaceID, spaceID), ".Trash", "info")
trash, err := os.Open(filepath.Clean(trashRoot))
if err != nil {
// there is no trash for this space, so no trashed items
return true
}
dirItems, err := trash.ReadDir(1)
if err != nil {
// if we cannot read the trash, we assume there are no trashed items
tb.log.Error().Err(err).Str("spaceID", spaceID).Msg("trashbin: error reading trash directory")
return true
}
if len(dirItems) > 0 {
// if we can read the trash and there are items, we assume there are trashed items
return false
}
// if we cannot read the trash, we assume there are no trashed items
return true
}

View File

@@ -448,3 +448,28 @@ func (tb *DecomposedfsTrashbin) EmptyRecycle(ctx context.Context, spaceID string
func (tb *DecomposedfsTrashbin) getRecycleRoot(spaceID string) string {
return filepath.Join(tb.fs.o.Root, "spaces", lookup.Pathify(spaceID, 1, 2), "trash")
}
func (fs *DecomposedfsTrashbin) IsEmpty(ctx context.Context, spaceID string) bool {
log := appctx.GetLogger(ctx)
_, span := tracer.Start(ctx, "HasTrashedItems")
defer span.End()
trashRoot := fs.getRecycleRoot(spaceID)
trash, err := os.Open(filepath.Clean(trashRoot))
if err != nil {
// there is no trash for this space, so no trashed items
return true
}
dirItems, err := trash.ReadDir(1)
if err != nil {
// if we cannot read the trash, we assume there are no trashed items
log.Error().Err(err).Str("trashRoot", trashRoot).Str("spaceID", spaceID).Msg("trashbin: error reading trash directory")
return true
}
if len(dirItems) > 0 {
// if we can read the trash and there are items, we assume there are trashed items
return false
}
// if we cannot read the trash, we assume there are no trashed items
return true
}

View File

@@ -493,6 +493,14 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide
}()
for r := range results {
r.HasTrashedItems = true
resourceID, err := storagespace.ParseID(r.GetId().GetOpaqueId())
if err != nil {
appctx.GetLogger(ctx).Error().Err(err).Str("id", r.Id.GetOpaqueId()).Msg("could not parse space id")
r.HasTrashedItems = false
continue
}
r.HasTrashedItems = !fs.trashbin.IsEmpty(ctx, resourceID.GetSpaceId())
spaces = append(spaces, r)
}

View File

@@ -33,4 +33,5 @@ type Trashbin interface {
RestoreRecycleItem(ctx context.Context, spaceID, key, relativePath string, restoreRef *provider.Reference) (*node.Node, error)
PurgeRecycleItem(ctx context.Context, spaceID, key, relativePath string) error
EmptyRecycle(ctx context.Context, spaceID string) error
IsEmpty(ctx context.Context, spaceID string) bool
}

View File

@@ -493,6 +493,7 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide
}()
for r := range results {
r.HasTrashedItems = false // FIXME: implement me
spaces = append(spaces, r)
}

3
vendor/modules.txt vendored
View File

@@ -1210,7 +1210,7 @@ github.com/open-policy-agent/opa/v1/version
# github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250703062332-6dc201fd7bf1
## explicit; go 1.18
github.com/opencloud-eu/libre-graph-api-go
# github.com/opencloud-eu/reva/v2 v2.34.0
# github.com/opencloud-eu/reva/v2 v2.34.0 => github.com/dragonchaser/reva/v2 v2.0.0-20250704073728-ba915c60abf9
## explicit; go 1.24.1
github.com/opencloud-eu/reva/v2/cmd/revad/internal/grace
github.com/opencloud-eu/reva/v2/cmd/revad/runtime
@@ -2478,3 +2478,4 @@ stash.kopano.io/kgol/rndm
# github.com/unrolled/secure => github.com/DeepDiver1975/secure v0.0.0-20240611112133-abc838fb797c
# go-micro.dev/v4 => github.com/butonic/go-micro/v4 v4.11.1-0.20241115112658-b5d4de5ed9b3
# github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a
# github.com/opencloud-eu/reva/v2 => github.com/dragonchaser/reva/v2 v2.0.0-20250704073728-ba915c60abf9