Skip to content

Commit

Permalink
Merge pull request #4847 from kobergj/AddIsVersionToUploadReady
Browse files Browse the repository at this point in the history
Add IsVersion flag to UploadReadyEvent
  • Loading branch information
kobergj authored Sep 17, 2024
2 parents cedd4ef + 5371b2b commit f8ace8c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/unreleased/add-version-to-urevent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add IsVersion to UploadReadyEvent

Adds an IsVersion flag indicating that this upload is a version of an existing file

https://github.com/cs3org/reva/pull/4847
3 changes: 2 additions & 1 deletion pkg/events/postprocessing.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ type UploadReady struct {
SpaceOwner *user.UserId
ExecutingUser *user.User
FileRef *provider.Reference
Failed bool
Timestamp *types.Timestamp
Failed bool
IsVersion bool
// add reference here? We could use it to inform client pp is finished
}

Expand Down
9 changes: 9 additions & 0 deletions pkg/storage/utils/decomposedfs/decomposedfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,14 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {

fs.sessionStore.Cleanup(ctx, session, revertNodeMetadata, keepUpload, unmarkPostprocessing)

var isVersion bool
if session.NodeExists() {
info, err := session.GetInfo(ctx)
if err == nil && info.MetaData["versionsPath"] != "" {
isVersion = true
}
}

if err := events.Publish(
ctx,
fs.stream,
Expand All @@ -376,6 +384,7 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
},
Timestamp: utils.TimeToTS(now),
SpaceOwner: n.SpaceOwnerOrManager(ctx),
IsVersion: isVersion,
},
); err != nil {
sublog.Error().Err(err).Msg("Failed to publish UploadReady event")
Expand Down

0 comments on commit f8ace8c

Please sign in to comment.