mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-12-05 05:43:36 -05:00
Merge pull request #4229 from pbleser-oc/chore/bump-reva-2a704e12acc3
[full-ci] chore: bump reva to 2a704e12acc3
This commit is contained in:
7 files changed
+79
-21
No files matched your search
@@ -69,7 +69,7 @@ require (
|
||||
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.20261119152805-1a7a500a264e
|
||||
github.com/opencloud-eu/reva/v3 v3.0.2-0.20261203145052-691769b98fa2
|
||||
github.com/opencloud-eu/reva/v3 v3.0.2-0.20261204094635-2a704e12acc3
|
||||
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
|
||||
|
||||
@@ -759,8 +759,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.20261119152805-1a7a500a264e h1:5sf3dNw/eYuuvDL8+3c4pbPSX+Pblw6lsylGtq+cw30=
|
||||
github.com/opencloud-eu/libre-graph-api-go v1.0.9-0.20261119152805-1a7a500a264e/go.mod h1:lTM8JeGblNpoMySTW7Lui2+c5TTLI95mwxtdUIHHrhU=
|
||||
github.com/opencloud-eu/reva/v3 v3.0.2-0.20261203145052-691769b98fa2 h1:tlfKPHbeLsKAWx1/gm/D8Z7+bnRR+AN+kyNTQVMNv9o=
|
||||
github.com/opencloud-eu/reva/v3 v3.0.2-0.20261203145052-691769b98fa2/go.mod h1:oqi8rN/Nt2v+Gn/dmY9p2Zct3VHrdvnYtqZWHrjij7M=
|
||||
github.com/opencloud-eu/reva/v3 v3.0.2-0.20261204094635-2a704e12acc3 h1:L5grV/Y39utQi2fqSLPF6tgbjDzkBRVy2GtZnEwpBrA=
|
||||
github.com/opencloud-eu/reva/v3 v3.0.2-0.20261204094635-2a704e12acc3/go.mod h1:oqi8rN/Nt2v+Gn/dmY9p2Zct3VHrdvnYtqZWHrjij7M=
|
||||
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=
|
||||
|
||||
Generated
Vendored
+12
-5
@@ -42,12 +42,12 @@ import (
|
||||
var validate = validator.New()
|
||||
|
||||
type sharesHandler struct {
|
||||
gatewayClient gateway.GatewayAPIClient
|
||||
gatewaySelector *pool.Selector[gateway.GatewayAPIClient]
|
||||
}
|
||||
|
||||
func (h *sharesHandler) init(c *config) error {
|
||||
var err error
|
||||
h.gatewayClient, err = pool.GetGatewayServiceClient(c.GatewaySvc)
|
||||
h.gatewaySelector, err = pool.GatewaySelector(c.GatewaySvc)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -72,7 +72,14 @@ func (h *sharesHandler) CreateShare(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
ctx := r.Context()
|
||||
|
||||
statRes, err := h.gatewayClient.Stat(ctx, &providerpb.StatRequest{
|
||||
// resolve the gateway per request so that an address change is picked up
|
||||
gatewayClient, err := h.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
reqres.WriteError(w, r, reqres.APIErrorServerError, "error selecting gateway client", err)
|
||||
return
|
||||
}
|
||||
|
||||
statRes, err := gatewayClient.Stat(ctx, &providerpb.StatRequest{
|
||||
Ref: &providerpb.Reference{
|
||||
Path: req.SourcePath,
|
||||
},
|
||||
@@ -89,7 +96,7 @@ func (h *sharesHandler) CreateShare(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
recipientProviderInfo, err := h.gatewayClient.GetInfoByDomain(ctx, &ocmprovider.GetInfoByDomainRequest{
|
||||
recipientProviderInfo, err := gatewayClient.GetInfoByDomain(ctx, &ocmprovider.GetInfoByDomainRequest{
|
||||
Domain: req.RecipientHost,
|
||||
})
|
||||
if err != nil {
|
||||
@@ -104,7 +111,7 @@ func (h *sharesHandler) CreateShare(w http.ResponseWriter, r *http.Request) {
|
||||
perm, viewMode := getPermissionsByRole(req.Role)
|
||||
|
||||
log.Debug().Msg("calling gatewayClient.CreateOCMShare from sciencemesh/share.go")
|
||||
shareRes, err := h.gatewayClient.CreateOCMShare(ctx, &ocm.CreateOCMShareRequest{
|
||||
shareRes, err := gatewayClient.CreateOCMShare(ctx, &ocm.CreateOCMShareRequest{
|
||||
ResourceId: statRes.Info.Id,
|
||||
Grantee: &providerpb.Grantee{
|
||||
Type: providerpb.GranteeType_GRANTEE_TYPE_USER,
|
||||
|
||||
Generated
Vendored
+17
-4
@@ -36,8 +36,8 @@ Each `X` is either
|
||||
|
||||
- a plain number, which is a **number of revisions**, always counting from the newest one, or
|
||||
- a number with a unit suffix, which is a **duration**: `w` weeks, `d` days, `h` hours, `m` minutes, `s` seconds.
|
||||
Durations in days or weeks can use an uppercase unit, `D` or `W`, to count from midnight (server time) instead of from now:
|
||||
`1d` means the last 24 hours, `1D` means since yesterday 00:00, `0D` since today 00:00.
|
||||
Durations in days or weeks can use an uppercase unit, `D` or `W`, to count from midnight instead of from now:
|
||||
`1d` means the last 24 hours, `1D` means since yesterday 00:00, `0D` since today 00:00, in the local time zone of the server (see [Time zone](#time-zone)).
|
||||
|
||||
| Strategy | Meaning | Example |
|
||||
|---|---|---|
|
||||
@@ -61,12 +61,25 @@ Rules worth knowing:
|
||||
| last 30 days | one per day |
|
||||
| older | one per week |
|
||||
|
||||
The slots follow the calendar and the clock in the local time zone of the server (see [Time zone](#time-zone)): a day starts at midnight, also on the days with 23 or 25 hours when daylight saving time begins or ends, a week on Monday at midnight, and an hour at the full hour.
|
||||
|
||||
- **A number of revisions is a total**, the protected revisions included: `7d, 10` keeps 10 revisions in total, not 10 on top of the ones from the last 7 days. Revisions within the protected range are never deleted, though, even if there are more of them.
|
||||
- **In `auto, N`, the number `N` applies first, then `auto` thins out what is left.** So `auto, 10` keeps *at most* 10 revisions, usually fewer, and sometimes fewer than `auto` alone: if the 10 newest revisions were all saved within the same minute yesterday, `auto, 10` keeps a single revision, while `auto` keeps one of those plus one per day before. It does *not* mean "thin out first, then keep the 10 newest of what is left". The same goes for a number in `X1, auto, N`.
|
||||
- **Two values of the same kind are rejected** in `X1, X2`, because one of them would have no effect: `5, 10` is the same as `10`, and `7d, 30d` is the same as `30d`. The error message names the equivalent single value.
|
||||
- **In `X1, auto, X2` with two values of the same kind, `X1` must be smaller than `X2`**, otherwise `auto` would never apply.
|
||||
- **`0` deletes all revisions.** Unlike `disable_versioning`, which only stops creating new revisions, this also removes the ones that have accumulated, over time (see [When the cleanup runs](#when-the-cleanup-runs) below).
|
||||
|
||||
### Time zone
|
||||
|
||||
All times of the cleanup are in the local time zone of the process that runs it: midnight for `D` and `W`, and the slots of `auto`.
|
||||
That time zone is the one of the `TZ` environment variable, or else the time zone of the system (`/etc/localtime`), or else UTC.
|
||||
To use UTC on a system with another time zone, run the process with `TZ=UTC`.
|
||||
Container images often have no time zone configured, and then use UTC.
|
||||
|
||||
The times in the reasons of the cleanup (see [Logging](#logging)) are written with their offset to UTC, e.g. `2026-11-19T00:00:00+01:00`.
|
||||
|
||||
An on-demand cleanup (`opencloud storage-users revisions cleanup`) runs in a process of its own: give it the same time zone as the server, otherwise it puts revisions into other slots than the server, and decides differently.
|
||||
|
||||
## How the age of a revision is measured
|
||||
|
||||
A revision's age is the time **it was created**, i.e. when the file was changed and its previous content became the revision, by the clock of the server.
|
||||
@@ -152,9 +165,9 @@ sum(increase(reva_revision_cleanup_purge_failures_total[1h])) > 0
|
||||
- At startup with background workers: one info line `revision cleanup: running in the background` with the strategy, workers, queue size, queue full policy and timeout.
|
||||
- Per cleaned file: one info line `revision cleanup: purged old revisions` with the strategy (`config`), the number and size of the deleted revisions, and how many revisions the file had. Nothing is logged for files where nothing was deleted.
|
||||
- Every deleted revision is logged at debug level (`revision cleanup: purged revision`), with its `size` and the `reason`: which rule of the strategy deleted it, and the boundary it was evaluated with. This is particularly useful to understand the time slots of `auto`. Examples:
|
||||
- `deleted by "30d": older than 2026-09-14T10:00:00Z`
|
||||
- `deleted by "30d": older than 2026-09-14T12:00:00+02:00`
|
||||
- `deleted by "10": beyond the 10 newest, counting the 3 protected ones`
|
||||
- `deleted by "auto" (last hour): its slot of 1 minute starting 2026-10-14T09:05:00Z already keeps an older revision`
|
||||
- `deleted by "auto" (last hour): its slot of 1 minute starting 2026-10-14T11:05:00+02:00 already keeps an older revision`
|
||||
- A revision dated in the future is logged as a warning (`revision cleanup: revision dated in the future, it counts as the newest one`), every time its file is cleaned up, and its reason ends in `dated in the future (...), so it counts as the newest`. Its time is when it was created, by the clock of the server, so this only happens when that clock was set back. Such a revision takes the first places of a number of revisions to keep, and no duration deletes it before its date has passed, which can make the cleanup delete the actual newest revisions instead: check the clock of the server.
|
||||
- With `drop`, or when `block` gives up after its timeout, a skipped cleanup is logged as a warning; on shutdown, the number of abandoned queued cleanups is logged.
|
||||
|
||||
|
||||
Generated
Vendored
+38
-8
@@ -80,10 +80,42 @@ var defaultPolicy = []bucketPolicy{
|
||||
},
|
||||
}
|
||||
|
||||
// mondayEpoch is the number of the calendar day 2001-01-01, a Monday, counted from 1970-01-01:
|
||||
// slots of days are counted from it, so that slots of 7 days start on Mondays.
|
||||
var mondayEpoch = time.Date(2001, time.January, 1, 0, 0, 0, 0, time.UTC).Unix() / 86400
|
||||
|
||||
// slotOf returns the start of the slot of the given length that t falls into, in the time zone
|
||||
// loc, and a key that tells the slots of that length apart.
|
||||
//
|
||||
// The slots follow the calendar and the wall clock of loc, not the UTC time: a slot of a day
|
||||
// starts at midnight in loc, also on days with 23 or 25 hours when daylight saving time begins or
|
||||
// ends, a slot of 7 days starts on Monday at midnight, and a slot of an hour starts at the full
|
||||
// hour of the wall clock, also in time zones with an offset of half an hour. When the clocks are
|
||||
// set back, the hour that repeats is a single slot of two hours.
|
||||
func slotOf(t time.Time, interval time.Duration, loc *time.Location) (time.Time, int64) {
|
||||
const day = 24 * time.Hour
|
||||
t = t.In(loc)
|
||||
year, month, dayOfMonth := t.Date()
|
||||
if interval >= day && interval%day == 0 {
|
||||
days := int64(interval / day)
|
||||
n := time.Date(year, month, dayOfMonth, 0, 0, 0, 0, time.UTC).Unix()/86400 - mondayEpoch
|
||||
first := n - ((n%days)+days)%days
|
||||
return time.Date(2001, time.January, 1+int(first), 0, 0, 0, 0, loc), first
|
||||
}
|
||||
// the wall clock time of t, written as UTC, so that Truncate cuts it at the full minutes or
|
||||
// hours of the wall clock
|
||||
wall := time.Date(year, month, dayOfMonth, t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), time.UTC).Truncate(interval)
|
||||
start := time.Date(wall.Year(), wall.Month(), wall.Day(), wall.Hour(), wall.Minute(), wall.Second(), wall.Nanosecond(), loc)
|
||||
return start, wall.UnixNano()
|
||||
}
|
||||
|
||||
// evaluateRetention thins revisions across dynamic time tiers based on interval slots.
|
||||
// Every decision in the returned Plan comes with a reason that names the tier and, for tiers
|
||||
// with slots, the slot, so that the outcome of this not quite trivial bucket system can be
|
||||
// explained (e.g. in the debug log or in verbose output).
|
||||
//
|
||||
// The slots are those of the time zone of now, i.e. the local time zone of the server (see
|
||||
// slotOf), like the midnight of "1D" (see computeCutoffFromRetention).
|
||||
func evaluateRetention(revisions []Revision, policies []bucketPolicy, now time.Time) Plan {
|
||||
// First, iterate over all revisions to group/sort them into discrete,
|
||||
// mutually exclusive buckets (one revision can only ever be in one bucket).
|
||||
@@ -148,8 +180,7 @@ func evaluateRetention(revisions []Revision, policies []bucketPolicy, now time.T
|
||||
// duration of ${interval}, and then count the number of revisions in each slot
|
||||
// to determine which to delete (or not)
|
||||
|
||||
// we will use unix nano timestamps as the keys for the map of slots,
|
||||
// just as a performance improvement to avoid using time.Duration objects
|
||||
// the number of revisions kept in each slot, by the key of the slot (see slotOf)
|
||||
slotCounts := make(map[int64]int)
|
||||
|
||||
// The oldest revisions of each slot are kept, so the revisions are visited oldest
|
||||
@@ -159,12 +190,11 @@ func evaluateRetention(revisions []Revision, policies []bucketPolicy, now time.T
|
||||
// for months as soon as the file is saved twice within the same slot, keeping only
|
||||
// the content of the few seconds in between.
|
||||
for _, rev := range slices.Backward(items) {
|
||||
// we take the revision's time, but truncate it to the interval for this
|
||||
// bucket (e.g. 1m or 1h), in order to count how many revisions we have
|
||||
// in each slot within the bucket; note that we also transform the
|
||||
// time.Duration into an int64 to use that as the key in the slot map
|
||||
slotKey := rev.CreationTime().Truncate(policy.interval).UnixNano()
|
||||
slot := fmt.Sprintf("its slot of %s starting %s", humanDuration(policy.interval), formatTime(time.Unix(0, slotKey).UTC()))
|
||||
// the slot of the interval of this bucket (e.g. 1m or 1h) that the revision
|
||||
// was created in, in order to count how many revisions we have in each slot
|
||||
// within the bucket
|
||||
start, slotKey := slotOf(rev.CreationTime(), policy.interval, now.Location())
|
||||
slot := fmt.Sprintf("its slot of %s starting %s", humanDuration(policy.interval), formatTime(start))
|
||||
|
||||
count := slotCounts[slotKey]
|
||||
switch {
|
||||
|
||||
+8
@@ -40,6 +40,14 @@ var (
|
||||
// today and yesterday; "0D" means since today 00:00, and "1W" since 00:00 seven days ago.
|
||||
// Depending on the time of day, "ND" thus spans between N and N+1 days.
|
||||
//
|
||||
// "auto" keeps one version per slot of 10 seconds, a minute, an hour, a day or a week, depending
|
||||
// on the age of the versions. Its slots also follow the server's local time zone: a slot of a day
|
||||
// starts at midnight, a slot of a week on Monday at midnight, and a slot of an hour at the full
|
||||
// hour of the local wall clock.
|
||||
//
|
||||
// The server's local time zone is the one of the process: the TZ environment variable, or else
|
||||
// the time zone of the system (/etc/localtime), or else UTC. For UTC, run it with TZ=UTC.
|
||||
//
|
||||
// Supported forms:
|
||||
// - "auto": Default, default clean-up pattern applies
|
||||
// - "X": Delete all versions beyond X: keep the X newest versions, or delete versions
|
||||
|
||||
Vendored
+1
-1
@@ -1352,7 +1352,7 @@ github.com/opencloud-eu/icap-client
|
||||
# github.com/opencloud-eu/libre-graph-api-go v1.0.9-0.20261119152805-1a7a500a264e
|
||||
## explicit; go 1.23
|
||||
github.com/opencloud-eu/libre-graph-api-go
|
||||
# github.com/opencloud-eu/reva/v3 v3.0.2-0.20261203145052-691769b98fa2
|
||||
# github.com/opencloud-eu/reva/v3 v3.0.2-0.20261204094635-2a704e12acc3
|
||||
## explicit; go 1.26.0
|
||||
github.com/opencloud-eu/reva/v3/cmd/revad/internal/grace
|
||||
github.com/opencloud-eu/reva/v3/cmd/revad/runtime
|
||||
|
||||
Reference in new issue
Block a user