Merge pull request #10419 from owncloud/update-reva

[full-ci] chore: update reva to 2.26.2
This commit is contained in:
kobergj
2024-10-28 17:26:04 +01:00
committed by GitHub
12 changed files with 24 additions and 62 deletions

View File

@@ -0,0 +1,6 @@
Enhancement: Bump reva to 2.26.2
* Enhancement [cs3org/reva#4897](https://github.com/cs3org/reva/pull/4897): Fix remaining quota calculation
* Bugfix [cs3org/reva#4902](https://github.com/cs3org/reva/pull/4902): Fix quota calculation
https://github.com/owncloud/ocis/pull/10419

2
go.mod
View File

@@ -15,7 +15,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.11.0
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb
github.com/cs3org/reva/v2 v2.26.0
github.com/cs3org/reva/v2 v2.26.2
github.com/davidbyttow/govips/v2 v2.15.0
github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e

4
go.sum
View File

@@ -255,8 +255,8 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c=
github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME=
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb h1:KmYZDReplv/yfwc1LNYpDcVhVujC3Pasv6WjXx1haSU=
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb/go.mod h1:yyP8PRo0EZou3nSH7H4qjlzQwaydPeIRNgX50npQHpE=
github.com/cs3org/reva/v2 v2.26.0 h1:FTM0L0eP9MOfnEgmU9R+fAjCstgk0dCDbDMm9xg2FA4=
github.com/cs3org/reva/v2 v2.26.0/go.mod h1:b+AwpMCeJo7pihdjr0ZBvs7gvgbVNCzFpCOIHqS2hiY=
github.com/cs3org/reva/v2 v2.26.2 h1:0J+Ph9iM6zlVex11vu2p94hRiqiCBgSTwWg03c5qDfg=
github.com/cs3org/reva/v2 v2.26.2/go.mod h1:b+AwpMCeJo7pihdjr0ZBvs7gvgbVNCzFpCOIHqS2hiY=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=

View File

@@ -116,11 +116,6 @@ func (bs *Blobstore) Delete(node *node.Node) error {
return nil
}
// GetAvailableSize returns the available size in the blobstore in bytes
func (bs *Blobstore) GetAvailableSize(n *node.Node) (uint64, error) {
return node.GetAvailableSize(n.InternalPath())
}
// List lists all blobs in the Blobstore
func (bs *Blobstore) List() ([]*node.Node, error) {
dirs, err := filepath.Glob(filepath.Join(bs.root, "spaces", "*", "*", "blobs", "*", "*", "*", "*", "*"))

View File

@@ -88,8 +88,3 @@ func (bs *Blobstore) Download(node *node.Node) (io.ReadCloser, error) {
func (bs *Blobstore) Delete(node *node.Node) error {
return nil
}
// GetAvailableSize returns the available size in the blobstore in bytes
func (bs *Blobstore) GetAvailableSize(n *node.Node) (uint64, error) {
return node.GetAvailableSize(n.InternalPath())
}

View File

@@ -126,7 +126,6 @@ func New(m map[string]interface{}, stream events.Stream) (storage.FS, error) {
aspects := aspects.Aspects{
Lookup: lu,
Tree: tp,
Blobstore: bs,
Permissions: p,
EventStream: stream,
UserMapper: um,

View File

@@ -29,7 +29,6 @@ import (
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/lookup"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/tree"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/pkg/errors"
@@ -129,12 +128,6 @@ func (bs *Blobstore) Delete(node *node.Node) error {
return nil
}
// GetAvailableSize returns the available size in the blobstore in bytes
func (bs *Blobstore) GetAvailableSize(n *node.Node) (uint64, error) {
// S3 doen't have a concept of available size
return 0, tree.ErrSizeUnlimited
}
// List lists all blobs in the Blobstore
func (bs *Blobstore) List() ([]*node.Node, error) {
ch := bs.client.ListObjects(context.Background(), bs.bucket, minio.ListObjectsOptions{Recursive: true})

View File

@@ -23,7 +23,6 @@ import (
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/permissions"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/trashbin"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/tree"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/usermapper"
)
@@ -31,7 +30,6 @@ import (
type Aspects struct {
Lookup node.PathLookup
Tree node.Tree
Blobstore tree.Blobstore
Trashbin trashbin.Trashbin
Permissions permissions.Permissions
EventStream events.Stream

View File

@@ -113,7 +113,6 @@ type SessionStore interface {
type Decomposedfs struct {
lu node.PathLookup
tp node.Tree
bs tree.Blobstore
trashbin trashbin.Trashbin
o *options.Options
p permissions.Permissions
@@ -164,7 +163,6 @@ func NewDefault(m map[string]interface{}, bs tree.Blobstore, es events.Stream) (
aspects := aspects.Aspects{
Lookup: lu,
Tree: tp,
Blobstore: bs,
Permissions: permissions.NewPermissions(node.NewPermissions(lu), permissionsSelector),
EventStream: es,
DisableVersioning: o.DisableVersioning,
@@ -226,7 +224,6 @@ func New(o *options.Options, aspects aspects.Aspects) (storage.FS, error) {
fs := &Decomposedfs{
tp: aspects.Tree,
bs: aspects.Blobstore,
lu: aspects.Lookup,
trashbin: aspects.Trashbin,
o: o,
@@ -602,20 +599,14 @@ func (fs *Decomposedfs) GetQuota(ctx context.Context, ref *provider.Reference) (
quotaStr = string(ri.Opaque.Map["quota"].Value)
}
remaining, err = fs.bs.GetAvailableSize(n)
switch {
case errors.Is(err, tree.ErrSizeUnlimited):
remaining = math.MaxUint64
case err != nil:
return 0, 0, 0, err
}
return fs.calculateTotalUsedRemaining(quotaStr, ri.Size, remaining)
return fs.calculateTotalUsedRemaining(quotaStr, ri.Size)
}
func (fs *Decomposedfs) calculateTotalUsedRemaining(quotaStr string, inUse, remaining uint64) (uint64, uint64, uint64, error) {
func (fs *Decomposedfs) calculateTotalUsedRemaining(quotaStr string, inUse uint64) (uint64, uint64, uint64, error) {
var err error
var total uint64
remaining := uint64(math.MaxUint64)
switch quotaStr {
case node.QuotaUncalculated, node.QuotaUnknown:
// best we can do is return current total
@@ -628,14 +619,13 @@ func (fs *Decomposedfs) calculateTotalUsedRemaining(quotaStr string, inUse, rema
return 0, 0, 0, err
}
if total <= remaining {
// Prevent overflowing
if inUse >= total {
remaining = 0
} else {
remaining = total - inUse
}
switch {
case total > inUse:
remaining = total - inUse
case total <= inUse:
remaining = 0
}
}
return total, inUse, remaining, nil
}

View File

@@ -46,7 +46,6 @@ import (
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata/prefixes"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/permissions"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/tree"
"github.com/cs3org/reva/v2/pkg/storage/utils/templates"
"github.com/cs3org/reva/v2/pkg/storagespace"
"github.com/cs3org/reva/v2/pkg/utils"
@@ -1030,22 +1029,13 @@ func (fs *Decomposedfs) StorageSpaceFromNode(ctx context.Context, n *node.Node,
quotaStr = quotaInOpaque
}
remaining, err := fs.bs.GetAvailableSize(n)
switch {
case errors.Is(err, tree.ErrSizeUnlimited):
remaining = math.MaxUint64
case err != nil:
return nil, err
}
total, used, remaining, err := fs.calculateTotalUsedRemaining(quotaStr, space.GetRootInfo().GetSize(), remaining)
total, used, remaining, err := fs.calculateTotalUsedRemaining(quotaStr, space.GetRootInfo().GetSize())
if err != nil {
return nil, err
}
space.Opaque = utils.AppendPlainToOpaque(space.Opaque, "quota.total", strconv.FormatUint(total, 10))
space.Opaque = utils.AppendPlainToOpaque(space.Opaque, "quota.used", strconv.FormatUint(used, 10))
if remaining != math.MaxUint64 {
space.Opaque = utils.AppendPlainToOpaque(space.Opaque, "quota.remaining", strconv.FormatUint(remaining, 10))
}
space.Opaque = utils.AppendPlainToOpaque(space.Opaque, "quota.remaining", strconv.FormatUint(remaining, 10))
return space, nil
}

View File

@@ -48,10 +48,7 @@ import (
"golang.org/x/sync/errgroup"
)
var (
tracer trace.Tracer
ErrSizeUnlimited = errors.New("blobstore size unlimited")
)
var tracer trace.Tracer
func init() {
tracer = otel.Tracer("github.com/cs3org/reva/pkg/storage/utils/decomposedfs/tree")
@@ -62,7 +59,6 @@ type Blobstore interface {
Upload(node *node.Node, source string) error
Download(node *node.Node) (io.ReadCloser, error)
Delete(node *node.Node) error
GetAvailableSize(node *node.Node) (uint64, error)
}
// Tree manages a hierarchical tree

4
vendor/modules.txt vendored
View File

@@ -368,7 +368,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1
github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1
github.com/cs3org/go-cs3apis/cs3/tx/v1beta1
github.com/cs3org/go-cs3apis/cs3/types/v1beta1
# github.com/cs3org/reva/v2 v2.26.0
# github.com/cs3org/reva/v2 v2.26.2
## explicit; go 1.22.0
github.com/cs3org/reva/v2/cmd/revad/internal/grace
github.com/cs3org/reva/v2/cmd/revad/runtime
@@ -2406,7 +2406,7 @@ sigs.k8s.io/yaml/goyaml.v2
## explicit; go 1.13
stash.kopano.io/kgol/rndm
# github.com/studio-b12/gowebdav => github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6
# go-micro.dev/v4 => github.com/butonic/go-micro/v4 v4.11.1-0.20241028133844-ac2cdce96c71
# github.com/egirna/icap-client => github.com/fschade/icap-client v0.0.0-20240802074440-aade4a234387
# github.com/unrolled/secure => github.com/DeepDiver1975/secure v0.0.0-20240611112133-abc838fb797c
# github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90
# go-micro.dev/v4 => github.com/butonic/go-micro/v4 v4.11.1-0.20241028133844-ac2cdce96c71