diff --git a/go.mod b/go.mod index bf55aeede..be4695c38 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,7 @@ require ( github.com/onsi/ginkgo/v2 v2.23.0 github.com/onsi/gomega v1.36.2 github.com/open-policy-agent/opa v1.2.0 - github.com/opencloud-eu/reva/v2 v2.28.1-0.20250318145617-dd5b9b6fb606 + github.com/opencloud-eu/reva/v2 v2.28.1-0.20250319144557-ae6d4d54cb01 github.com/orcaman/concurrent-map v1.0.0 github.com/owncloud/libre-graph-api-go v1.0.5-0.20240829135935-80dc00d6f5ea github.com/pkg/errors v0.9.1 @@ -253,7 +253,7 @@ require ( github.com/minio/crc64nvme v1.0.1 // indirect github.com/minio/highwayhash v1.0.3 // indirect github.com/minio/md5-simd v1.1.2 // indirect - github.com/minio/minio-go/v7 v7.0.87 // indirect + github.com/minio/minio-go/v7 v7.0.88 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect diff --git a/go.sum b/go.sum index 335738fa6..a945180f1 100644 --- a/go.sum +++ b/go.sum @@ -785,8 +785,8 @@ github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= -github.com/minio/minio-go/v7 v7.0.87 h1:nkr9x0u53PespfxfUqxP3UYWiE2a41gaofgNnC4Y8WQ= -github.com/minio/minio-go/v7 v7.0.87/go.mod h1:33+O8h0tO7pCeCWwBVa07RhVVfB/3vS4kEX7rwYKmIg= +github.com/minio/minio-go/v7 v7.0.88 h1:v8MoIJjwYxOkehp+eiLIuvXk87P2raUtoU5klrAAshs= +github.com/minio/minio-go/v7 v7.0.88/go.mod h1:33+O8h0tO7pCeCWwBVa07RhVVfB/3vS4kEX7rwYKmIg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= @@ -861,8 +861,8 @@ github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= github.com/open-policy-agent/opa v1.2.0 h1:88NDVCM0of1eO6Z4AFeL3utTEtMuwloFmWWU7dRV1z0= github.com/open-policy-agent/opa v1.2.0/go.mod h1:30euUmOvuBoebRCcJ7DMF42bRBOPznvt0ACUMYDUGVY= -github.com/opencloud-eu/reva/v2 v2.28.1-0.20250318145617-dd5b9b6fb606 h1:ASUV6F7hHgar1RrnPfTQhtd+/KMeTCn7LhLzda0+HKY= -github.com/opencloud-eu/reva/v2 v2.28.1-0.20250318145617-dd5b9b6fb606/go.mod h1:XWp81Uok1opSID0HeITjvxJqdorltHVx+iJv4IlWzPo= +github.com/opencloud-eu/reva/v2 v2.28.1-0.20250319144557-ae6d4d54cb01 h1:XhxHB2APcLCFaYFP1AEXwPSld6aUyK4PgGkT+AvxVGI= +github.com/opencloud-eu/reva/v2 v2.28.1-0.20250319144557-ae6d4d54cb01/go.mod h1:IWorhegiAG25pT0L3tbXeTqP70a8ALJNBOXa4t4QG14= 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= diff --git a/vendor/github.com/minio/minio-go/v7/api-datatypes.go b/vendor/github.com/minio/minio-go/v7/api-datatypes.go index 8a8fd8898..2118c7c77 100644 --- a/vendor/github.com/minio/minio-go/v7/api-datatypes.go +++ b/vendor/github.com/minio/minio-go/v7/api-datatypes.go @@ -212,6 +212,8 @@ type ObjectInfo struct { // not to be confused with `Expires` HTTP header. Expiration time.Time ExpirationRuleID string + // NumVersions is the number of versions of the object. + NumVersions int Restore *RestoreInfo diff --git a/vendor/github.com/minio/minio-go/v7/api-list.go b/vendor/github.com/minio/minio-go/v7/api-list.go index 31b6edf2e..da387d7ec 100644 --- a/vendor/github.com/minio/minio-go/v7/api-list.go +++ b/vendor/github.com/minio/minio-go/v7/api-list.go @@ -22,6 +22,7 @@ import ( "fmt" "net/http" "net/url" + "slices" "time" "github.com/minio/minio-go/v7/pkg/s3utils" @@ -421,20 +422,17 @@ func (c *Client) listObjectVersions(ctx context.Context, bucketName string, opts var ( keyMarker = "" versionIDMarker = "" + preName = "" + preKey = "" + perVersions []Version + numVersions int ) - - for { - // Get list of objects a maximum of 1000 per request. - result, err := c.listObjectVersionsQuery(ctx, bucketName, opts, keyMarker, versionIDMarker, delimiter) - if err != nil { - sendObjectInfo(ObjectInfo{ - Err: err, - }) - return + send := func(vers []Version) { + if opts.WithVersions && opts.ReverseVersions { + slices.Reverse(vers) + numVersions = len(vers) } - - // If contents are available loop through and send over channel. - for _, version := range result.Versions { + for _, version := range vers { info := ObjectInfo{ ETag: trimEtag(version.ETag), Key: version.Key, @@ -448,6 +446,7 @@ func (c *Client) listObjectVersions(ctx context.Context, bucketName string, opts UserTags: version.UserTags, UserMetadata: version.UserMetadata, Internal: version.Internal, + NumVersions: numVersions, } select { // Send object version info. @@ -457,6 +456,38 @@ func (c *Client) listObjectVersions(ctx context.Context, bucketName string, opts return } } + } + for { + // Get list of objects a maximum of 1000 per request. + result, err := c.listObjectVersionsQuery(ctx, bucketName, opts, keyMarker, versionIDMarker, delimiter) + if err != nil { + sendObjectInfo(ObjectInfo{ + Err: err, + }) + return + } + if opts.WithVersions && opts.ReverseVersions { + for _, version := range result.Versions { + if preName == "" { + preName = result.Name + preKey = version.Key + } + if result.Name == preName && preKey == version.Key { + // If the current name is same as previous name, + // we need to append the version to the previous version. + perVersions = append(perVersions, version) + continue + } + // Send the file versions. + send(perVersions) + perVersions = perVersions[:0] + perVersions = append(perVersions, version) + preName = result.Name + preKey = version.Key + } + } else { + send(result.Versions) + } // Send all common prefixes if any. // NOTE: prefixes are only present if the request is delimited. @@ -480,10 +511,20 @@ func (c *Client) listObjectVersions(ctx context.Context, bucketName string, opts versionIDMarker = result.NextVersionIDMarker } - // Listing ends result is not truncated, return right here. - if !result.IsTruncated { + // If context is canceled, return here. + if contextCanceled(ctx) { return } + + // Listing ends result is not truncated, return right here. + if !result.IsTruncated { + // sent the lasted file with versions + if opts.ReverseVersions && len(perVersions) > 0 { + send(perVersions) + } + return + } + } }(resultCh) return resultCh @@ -683,6 +724,8 @@ func (c *Client) listObjectsQuery(ctx context.Context, bucketName, objectPrefix, // ListObjectsOptions holds all options of a list object request type ListObjectsOptions struct { + // ReverseVersions - reverse the order of the object versions + ReverseVersions bool // Include objects versions in the listing WithVersions bool // Include objects metadata in the listing diff --git a/vendor/github.com/minio/minio-go/v7/api.go b/vendor/github.com/minio/minio-go/v7/api.go index a4f214232..d7b065fdc 100644 --- a/vendor/github.com/minio/minio-go/v7/api.go +++ b/vendor/github.com/minio/minio-go/v7/api.go @@ -155,7 +155,7 @@ type Options struct { // Global constants. const ( libraryName = "minio-go" - libraryVersion = "v7.0.87" + libraryVersion = "v7.0.88" ) // User Agent should always following the below style. diff --git a/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go b/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go index 65a2f75e9..0239782e5 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go @@ -868,8 +868,20 @@ type ReplQNodeStats struct { XferStats map[MetricName]XferStats `json:"transferSummary"` TgtXferStats map[string]map[MetricName]XferStats `json:"tgtTransferStats"` - QStats InQueueMetric `json:"queueStats"` - MRFStats ReplMRFStats `json:"mrfStats"` + QStats InQueueMetric `json:"queueStats"` + MRFStats ReplMRFStats `json:"mrfStats"` + Retries CounterSummary `json:"retries"` + Errors CounterSummary `json:"errors"` +} + +// CounterSummary denotes the stats counter summary +type CounterSummary struct { + // Counted last 1hr + Last1hr uint64 `json:"last1hr"` + // Counted last 1m + Last1m uint64 `json:"last1m"` + // Total counted since uptime + Total uint64 `json:"total"` } // ReplQueueStats holds stats for replication queue across nodes @@ -914,8 +926,10 @@ type ReplQStats struct { XferStats map[MetricName]XferStats `json:"xferStats"` TgtXferStats map[string]map[MetricName]XferStats `json:"tgtXferStats"` - QStats InQueueMetric `json:"qStats"` - MRFStats ReplMRFStats `json:"mrfStats"` + QStats InQueueMetric `json:"qStats"` + MRFStats ReplMRFStats `json:"mrfStats"` + Retries CounterSummary `json:"retries"` + Errors CounterSummary `json:"errors"` } // QStats returns cluster level stats for objects in replication queue @@ -958,6 +972,12 @@ func (q ReplQueueStats) QStats() (r ReplQStats) { r.MRFStats.LastFailedCount += node.MRFStats.LastFailedCount r.MRFStats.TotalDroppedCount += node.MRFStats.TotalDroppedCount r.MRFStats.TotalDroppedBytes += node.MRFStats.TotalDroppedBytes + r.Retries.Last1hr += node.Retries.Last1hr + r.Retries.Last1m += node.Retries.Last1m + r.Retries.Total += node.Retries.Total + r.Errors.Last1hr += node.Errors.Last1hr + r.Errors.Last1m += node.Errors.Last1m + r.Errors.Total += node.Errors.Total r.Uptime += node.Uptime } if len(q.Nodes) > 0 { @@ -971,4 +991,18 @@ type MetricsV2 struct { Uptime int64 `json:"uptime"` CurrentStats Metrics `json:"currStats"` QueueStats ReplQueueStats `json:"queueStats"` + DowntimeInfo DowntimeInfo `json:"downtimeInfo"` +} + +// DowntimeInfo represents the downtime info +type DowntimeInfo struct { + Duration Stat `json:"duration"` + Count Stat `json:"count"` +} + +// Stat represents the aggregates +type Stat struct { + Total int64 `json:"total"` + Avg int64 `json:"avg"` + Max int64 `json:"max"` } diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/config/config.go b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/config/config.go index 4d6de02c5..fbdd6918d 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/config/config.go +++ b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/config/config.go @@ -27,7 +27,6 @@ type Config struct { FavoriteStorageDrivers map[string]map[string]interface{} `mapstructure:"favorite_storage_drivers"` Version string `mapstructure:"version"` VersionString string `mapstructure:"version_string"` - Edition string `mapstructure:"edition"` Product string `mapstructure:"product"` ProductName string `mapstructure:"product_name"` ProductVersion string `mapstructure:"product_version"` diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/status.go b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/status.go index c14afc3e4..8f3fadae1 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/status.go +++ b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/status.go @@ -34,7 +34,6 @@ func (s *svc) doStatus(w http.ResponseWriter, r *http.Request) { NeedsDBUpgrade: false, Version: s.c.Version, VersionString: s.c.VersionString, - Edition: s.c.Edition, ProductName: s.c.ProductName, ProductVersion: s.c.ProductVersion, Product: s.c.Product, diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocs/handlers/cloud/capabilities/capabilities.go b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocs/handlers/cloud/capabilities/capabilities.go index d8b4fcf33..054bf074e 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocs/handlers/cloud/capabilities/capabilities.go +++ b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocs/handlers/cloud/capabilities/capabilities.go @@ -69,9 +69,6 @@ func (h *Handler) Init(c *config.Config) { if h.c.Capabilities.Core.Status.VersionString == "" { h.c.Capabilities.Core.Status.VersionString = "10.0.11" // TODO make build determined } - if h.c.Capabilities.Core.Status.Edition == "" { - h.c.Capabilities.Core.Status.Edition = "" // TODO make build determined - } if h.c.Capabilities.Core.Status.ProductName == "" { h.c.Capabilities.Core.Status.ProductName = "reva" // TODO make build determined } @@ -220,7 +217,6 @@ func (h *Handler) Init(c *config.Config) { Minor: 0, Micro: 11, String: "10.0.11", - Edition: "", Product: "reva", ProductVersion: "", } diff --git a/vendor/github.com/opencloud-eu/reva/v2/pkg/micro/ocdav/option.go b/vendor/github.com/opencloud-eu/reva/v2/pkg/micro/ocdav/option.go index 72ed1c9b7..ea99267a7 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/pkg/micro/ocdav/option.go +++ b/vendor/github.com/opencloud-eu/reva/v2/pkg/micro/ocdav/option.go @@ -297,13 +297,6 @@ func VersionString(val string) Option { } } -// Edition provides a function to set the Edition config option. -func Edition(val string) Option { - return func(o *Options) { - o.config.Edition = val - } -} - // Product provides a function to set the Product config option. func Product(val string) Option { return func(o *Options) { diff --git a/vendor/github.com/opencloud-eu/reva/v2/pkg/owncloud/ocs/capabilities.go b/vendor/github.com/opencloud-eu/reva/v2/pkg/owncloud/ocs/capabilities.go index 8d754cd75..3dd9ab93b 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/pkg/owncloud/ocs/capabilities.go +++ b/vendor/github.com/opencloud-eu/reva/v2/pkg/owncloud/ocs/capabilities.go @@ -142,7 +142,6 @@ type Status struct { NeedsDBUpgrade ocsBool `json:"needsDbUpgrade" xml:"needsDbUpgrade"` Version string `json:"version" xml:"version"` VersionString string `json:"versionstring" xml:"versionstring"` - Edition string `json:"edition" xml:"edition"` ProductName string `json:"productname" xml:"productname"` Product string `json:"product" xml:"product"` ProductVersion string `json:"productversion" xml:"productversion"` @@ -309,7 +308,6 @@ type Version struct { Minor int `json:"minor" xml:"minor"` Micro int `json:"micro" xml:"micro"` // = patch level String string `json:"string" xml:"string"` - Edition string `json:"edition" xml:"edition"` Product string `json:"product" xml:"product"` ProductVersion string `json:"productversion" xml:"productversion"` } diff --git a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/posix.go b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/posix.go index 9b9a0df5f..69977f477 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/posix.go +++ b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/posix.go @@ -139,7 +139,7 @@ func New(m map[string]interface{}, stream events.Stream, log *zerolog.Logger) (s Permissions: p, EventStream: stream, UserMapper: um, - DisableVersioning: false, + DisableVersioning: o.DisableVersioning, Trashbin: trashbin, } diff --git a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/revisions.go b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/revisions.go index e98a3b81d..1ca30aded 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/revisions.go +++ b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/revisions.go @@ -62,7 +62,18 @@ func (tp *Tree) CreateRevision(ctx context.Context, n *node.Node, version string defer sf.Close() vf, err := os.OpenFile(versionPath, os.O_CREATE|os.O_WRONLY|os.O_EXCL, 0600) if err != nil { - return "", err + if os.IsExist(err) { + err := os.Remove(versionPath) + if err != nil { + return "", err + } + vf, err = os.OpenFile(versionPath, os.O_CREATE|os.O_WRONLY|os.O_EXCL, 0600) + if err != nil { + return "", err + } + } else { + return "", err + } } defer vf.Close() if _, err := io.Copy(vf, sf); err != nil { diff --git a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/tree/revisions.go b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/tree/revisions.go index 855cb37f7..1552a03fd 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/tree/revisions.go +++ b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/tree/revisions.go @@ -61,7 +61,18 @@ func (tp *Tree) CreateRevision(ctx context.Context, n *node.Node, version string // create version node vf, err := os.OpenFile(versionPath, os.O_CREATE|os.O_EXCL, 0600) if err != nil { - return "", err + if os.IsExist(err) { + err := os.Remove(versionPath) + if err != nil { + return "", err + } + vf, err = os.OpenFile(versionPath, os.O_CREATE|os.O_WRONLY|os.O_EXCL, 0600) + if err != nil { + return "", err + } + } else { + return "", err + } } defer vf.Close() diff --git a/vendor/modules.txt b/vendor/modules.txt index ccdebb826..226ed6f33 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -942,7 +942,7 @@ github.com/minio/highwayhash # github.com/minio/md5-simd v1.1.2 ## explicit; go 1.14 github.com/minio/md5-simd -# github.com/minio/minio-go/v7 v7.0.87 +# github.com/minio/minio-go/v7 v7.0.88 ## explicit; go 1.22 github.com/minio/minio-go/v7 github.com/minio/minio-go/v7/pkg/cors @@ -1191,7 +1191,7 @@ github.com/open-policy-agent/opa/v1/types github.com/open-policy-agent/opa/v1/util github.com/open-policy-agent/opa/v1/util/decoding github.com/open-policy-agent/opa/v1/version -# github.com/opencloud-eu/reva/v2 v2.28.1-0.20250318145617-dd5b9b6fb606 +# github.com/opencloud-eu/reva/v2 v2.28.1-0.20250319144557-ae6d4d54cb01 ## explicit; go 1.24.1 github.com/opencloud-eu/reva/v2/cmd/revad/internal/grace github.com/opencloud-eu/reva/v2/cmd/revad/runtime