chore: update reva to 2.26.2
Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
-5
@@ -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", "*", "*", "*", "*", "*"))
|
||||
|
||||
-5
@@ -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())
|
||||
}
|
||||
|
||||
-1
@@ -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,
|
||||
|
||||
-7
@@ -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})
|
||||
|
||||
Generated
Vendored
-2
@@ -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
|
||||
|
||||
+10
-20
@@ -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
|
||||
}
|
||||
|
||||
+2
-12
@@ -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
|
||||
}
|
||||
|
||||
+1
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user