-
Notifications
You must be signed in to change notification settings - Fork 121
Async Postprocessing #3531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Async Postprocessing #3531
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4bddc00
use decomposedfs pkg from experimental
kobergj 3d4d59b
checkout postprocessing events from experimental
kobergj 0b93073
bring 425 status back
kobergj cbd58c6
changelog
kobergj 1ff975d
get rid of unneccessary lint issue
kobergj 97ee2a4
rework locking when uploading
kobergj 2d407b6
disable 0-byte touches
kobergj 7900594
extract regexp to global var
kobergj 473d092
get rid of *Metadata funcs
kobergj a37d40b
add custom type for PermissionFunc
kobergj 3811191
bring annoying linting message back
kobergj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Enhancement: Async Postprocessing | ||
|
|
||
| Provides functionality for async postprocessing. This will allow the system to do the postprocessing (virusscan, copying of bytes to their final destination, ...) asynchronous to the users request. Major change when active. | ||
|
|
||
| https://github.com/cs3org/reva/pull/3531 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| // Copyright 2018-2022 CERN | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
| // In applying this license, CERN does not waive the privileges and immunities | ||
| // granted to it by virtue of its status as an Intergovernmental Organization | ||
| // or submit itself to any jurisdiction. | ||
|
|
||
| package events | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "time" | ||
|
|
||
| user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" | ||
| provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" | ||
| ) | ||
|
|
||
| type ( | ||
| // Postprocessingstep are the available postprocessingsteps | ||
| Postprocessingstep string | ||
|
|
||
| // PostprocessingOutcome defines the result of the postprocessing | ||
| PostprocessingOutcome string | ||
| ) | ||
|
|
||
| var ( | ||
| // PPStepAntivirus is the step that scans for viruses | ||
| PPStepAntivirus Postprocessingstep = "virusscan" | ||
| // PPStepFTS is the step that indexes files for full text search | ||
| PPStepFTS Postprocessingstep = "fts" | ||
| // PPStepDelay is the step that processing. Useful for testing or user annoyment | ||
| PPStepDelay Postprocessingstep = "delay" | ||
|
|
||
| // PPOutcomeDelete means that the file and the upload should be deleted | ||
| PPOutcomeDelete PostprocessingOutcome = "delete" | ||
| // PPOutcomeAbort means that the upload is cancelled but the bytes are being kept in the upload folder | ||
| PPOutcomeAbort PostprocessingOutcome = "abort" | ||
| // PPOutcomeContinue means that the upload is moved to its final destination (eventually being marked with pp results) | ||
| PPOutcomeContinue PostprocessingOutcome = "continue" | ||
| ) | ||
|
|
||
| // BytesReceived is emitted by the server when it received all bytes of an upload | ||
| type BytesReceived struct { | ||
| UploadID string | ||
| SpaceOwner *user.UserId | ||
| ExecutingUser *user.User | ||
| ResourceID *provider.ResourceId | ||
| Filename string | ||
| Filesize uint64 | ||
| URL string | ||
| } | ||
|
|
||
| // Unmarshal to fulfill umarshaller interface | ||
| func (BytesReceived) Unmarshal(v []byte) (interface{}, error) { | ||
| e := BytesReceived{} | ||
| err := json.Unmarshal(v, &e) | ||
| return e, err | ||
| } | ||
|
|
||
| // VirusscanFinished is emitted by the server when it has completed an antivirus scan | ||
| type VirusscanFinished struct { | ||
| Infected bool | ||
| Outcome PostprocessingOutcome | ||
| UploadID string | ||
| Filename string | ||
| ExecutingUser *user.User | ||
| Description string | ||
| Scandate time.Time | ||
| ResourceID *provider.ResourceId | ||
| ErrorMsg string // empty when no error | ||
| } | ||
|
|
||
| // Unmarshal to fulfill umarshaller interface | ||
| func (VirusscanFinished) Unmarshal(v []byte) (interface{}, error) { | ||
| e := VirusscanFinished{} | ||
| err := json.Unmarshal(v, &e) | ||
| return e, err | ||
| } | ||
|
|
||
| // StartPostprocessingStep can be issued by the server to start a postprocessing step | ||
| type StartPostprocessingStep struct { | ||
| UploadID string | ||
| URL string | ||
| ExecutingUser *user.User | ||
| Filename string | ||
| Filesize uint64 | ||
| Token string // for file retrieval in after upload case | ||
| ResourceID *provider.ResourceId // for file retrieval in after upload case | ||
| RevaToken string // for file retrieval in after upload case | ||
|
|
||
| StepToStart Postprocessingstep | ||
| } | ||
|
|
||
| // Unmarshal to fulfill umarshaller interface | ||
| func (StartPostprocessingStep) Unmarshal(v []byte) (interface{}, error) { | ||
| e := StartPostprocessingStep{} | ||
| err := json.Unmarshal(v, &e) | ||
| return e, err | ||
| } | ||
|
|
||
| // PostprocessingStepFinished can be issued by the server when a postprocessing step is finished | ||
| type PostprocessingStepFinished struct { | ||
| UploadID string | ||
| ExecutingUser *user.User | ||
| Filename string | ||
|
|
||
| FinishedStep Postprocessingstep // name of the step | ||
| Result interface{} // result information | ||
| Error error // possible error of the step | ||
| Outcome PostprocessingOutcome // some services may cause postprocessing to stop | ||
| } | ||
|
|
||
| // Unmarshal to fulfill umarshaller interface | ||
| func (PostprocessingStepFinished) Unmarshal(v []byte) (interface{}, error) { | ||
| e := PostprocessingStepFinished{} | ||
| err := json.Unmarshal(v, &e) | ||
| return e, err | ||
| } | ||
|
|
||
| // PostprocessingFinished is emitted by *some* service which can decide that | ||
| type PostprocessingFinished struct { | ||
| UploadID string | ||
| Filename string | ||
| SpaceOwner *user.UserId | ||
| ExecutingUser *user.User | ||
| Result map[Postprocessingstep]interface{} // it is a map[step]Event | ||
| Outcome PostprocessingOutcome | ||
| } | ||
|
|
||
| // Unmarshal to fulfill umarshaller interface | ||
| func (PostprocessingFinished) Unmarshal(v []byte) (interface{}, error) { | ||
| e := PostprocessingFinished{} | ||
| err := json.Unmarshal(v, &e) | ||
| return e, err | ||
| } | ||
|
|
||
| // UploadReady is emitted by the storage provider when postprocessing is finished | ||
| type UploadReady struct { | ||
| UploadID string | ||
| Filename string | ||
| SpaceOwner *user.UserId | ||
| ExecutingUser *user.User | ||
| FileRef *provider.Reference | ||
| Failed bool | ||
| // add reference here? We could use it to inform client pp is finished | ||
| } | ||
|
|
||
| // Unmarshal to fulfill umarshaller interface | ||
| func (UploadReady) Unmarshal(v []byte) (interface{}, error) { | ||
| e := UploadReady{} | ||
| err := json.Unmarshal(v, &e) | ||
| return e, err | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.