-
Notifications
You must be signed in to change notification settings - Fork 18
database: prohibit PUT of source data that would lead to conflict #168
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
base: main
Are you sure you want to change the base?
Conversation
a4f46e4 to
f1c6f18
Compare
| @@ -0,0 +1,128 @@ | |||
| package sourcedatafs | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct answer is always one more filesystem
2ce8c72 to
29c03d7
Compare
See #141. Previously, it was possible to create a state in the database that would unconditionally fail when we tried to build a bundle from that. Now, any PUT will be validated against the current state of the database. Signed-off-by: Stephan Renatus <[email protected]>
Note that we currently still hold on to it, so we need to be able to keep all the (raw JSON) data in memory. Let's figure out a better way... Signed-off-by: Stephan Renatus <[email protected]>
This should let us avoid dealing with most of the files most of the time. Signed-off-by: Stephan Renatus <[email protected]>
But this seems to take forever for my 12k files experiment. I'll explore returning the relevant prefixed files instead. (It takes 5 min to load the 12k files on-the-fly.) Signed-off-by: Stephan Renatus <[email protected]>
f035b95 to
1ca846f
Compare
This might be a good compromise between extra effort and usability. Signed-off-by: Stephan Renatus <[email protected]>
1ca846f to
f501f32
Compare
|
|
||
| // deal with (1.), downwards conflicts | ||
| // NB(sr): We don't need to consult the data itself to determine errors here, | ||
| // so we only check existing paths. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out this is too restrictive. There are valid data combinations that this model refuses, for example:
users/admins/alice/data.json: {"name": "Alice"}
users/data.json: {"admins": {"bob": "foo"}}
In that order, the PUT of the second request would be forbidden. If ordered the other way around, it would work. This isn't good. 😵 Back to the drawing table.
See #141.
Previously, it was possible to create a state in the database that would unconditionally fail when we tried to build a bundle from that. Now, any PUT will be validated against the current state of the database.