You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SparqlUpdatePatchHandler should likely not be locking? #137
Then PatchHandler would just accept a representation and output one.
And perhaps it's not even PatchingStore that would operate the lock, but a LockingResourceStore that wraps it. (Although no strong opinion there, but it just seems that one LockingResourceStore over the whole thing would work fine.)
While it would certainly be easy if patchers are “representation in/out”, one drawback is that we cannot have an optimized implementation of (for example) append patches. E.g., an append patch on text/n-triples could literally just append on the filesystem, without having to re-read and re-serialize everything. However, such cases are then tied to a specific kind of storage, so are perhaps better implemented as a subclass of PatchingStore then anyway (which is also a good argument for typing those generically with regard to their source argument, so making PassthroughStore generic).
Yea there's no strong reason why the PatchHandler does it instead of the PatchingStore (except the "optimization" of calling the lock exactly when it is needed). Not sure if we always want the entire LockingResourceStore around, there might be ResourceStores who want to handle the locking themselves?
Sure, then it would indeed not be needed. But we have the AtomicResourceStore to tag them with then.
But what I mean is that in that case the PatchingStore would want to lock when doing the modification even though we don't want to lock over the other functions like a LockingResourceStore would do.
Having SparqlUpdatePatchHandler handle the store directly actually makes it possible to support PATCHing for file stores at the moment.
With the current default config it is not possible to patch resources in a file story: the patch handler outputs Quads which are not supported by the store. We can now put a converting store in between though, which converts those quads to turtle. Except we only want to do this when the input type is internal/quads and not for any other RDF inputs (else incoming jsonld data would also be converted for example). The converting store only checks stored preferences though, so there is no way to configure it like that, except we can configure it to only use the converting store in the patch handler. (Not saying that perhaps we shouldn't think about extending the converting store instead though).
Except we only want to do this when the input type is internal/quads and not for any other RDF inputs (else incoming jsonld data would also be converted for example).
So we put a converting store in between that only goes from internal/quads to Turtle indeed?
except we can configure it to only use the converting store in the patch handler.
But nothing else can possibly give us internal/quads?
Except we only want to do this when the input type is internal/quads and not for any other RDF inputs (else incoming jsonld data would also be converted for example).
So we put a converting store in between that only goes from internal/quads to Turtle indeed?
Yes that would be a cleaner solution, but that is impossible with the current implementation of the converting store. Currently it has 2 possible modes:
Convert all outgoing GET requests to a new content-type based on the incoming preferences
Convert all incoming PUT/POST requests to a new content-type based on the stored preferences.
What we actually would need for this case is:
Convert some (based on stored settings?) incoming PUT/POST requests to a new content-type based on the stored preferences.
Because if we configured the store to want turtle for example, all incoming json-ld data would also be converted. So actually similar to what we want for #276 but going in the other direction.
* Convert _some_ (based on stored settings?) incoming PUT/POST requests to a new content-type based on the stored preferences.
Indeed, let's do this one. Essentially, we would want an internal/quads;q=0 setting for the outgoing part, which should then lead to the right conclusion.
Indeed, let's do this one. Essentially, we would want an internal/quads;q=0 setting for the outgoing part, which should then lead to the right conclusion.
This will require a rework of some converting part somewhere because currently conversion is based on preferences saying what they want, not saying what they don't want.
Something I just thought of: we will have to make sure all links are correct once we fix #355 . Either the patching store/handler should not do any locking and simply be put behind the locking resource store (since that would also cause that resource to be locked before the modification), or the patching store needs to be put before the locking resource store and the store the handlers use needs to be one that bypasses the locking resource store. Otherwise we would end up with deadlocks since our locks are not re-entrant.
Activity
RubenVerborgh commentedon Sep 5, 2020
While it would certainly be easy if patchers are “representation in/out”, one drawback is that we cannot have an optimized implementation of (for example) append patches. E.g., an append patch on text/n-triples could literally just append on the filesystem, without having to re-read and re-serialize everything. However, such cases are then tied to a specific kind of storage, so are perhaps better implemented as a subclass of PatchingStore then anyway (which is also a good argument for typing those generically with regard to their source argument, so making PassthroughStore generic).
jvherweg commentedon Sep 7, 2020
Yea there's no strong reason why the
PatchHandlerdoes it instead of thePatchingStore(except the "optimization" of calling the lock exactly when it is needed). Not sure if we always want the entireLockingResourceStorearound, there might beResourceStores who want to handle the locking themselves?RubenVerborgh commentedon Sep 7, 2020
Sure, then it would indeed not be needed. But we have the
AtomicResourceStoreto tag them with then.jvherweg commentedon Sep 7, 2020
But what I mean is that in that case the
PatchingStorewould want to lock when doing the modification even though we don't want to lock over the other functions like aLockingResourceStorewould do.RubenVerborgh commentedon Sep 7, 2020
Right. Maybe
LockingStoreneeds config arguments.jvherweg commentedon Nov 3, 2020
Having
SparqlUpdatePatchHandlerhandle the store directly actually makes it possible to support PATCHing for file stores at the moment.With the current default config it is not possible to patch resources in a file story: the patch handler outputs Quads which are not supported by the store. We can now put a converting store in between though, which converts those quads to turtle. Except we only want to do this when the input type is
internal/quadsand not for any other RDF inputs (else incoming jsonld data would also be converted for example). The converting store only checks stored preferences though, so there is no way to configure it like that, except we can configure it to only use the converting store in the patch handler. (Not saying that perhaps we shouldn't think about extending the converting store instead though).RubenVerborgh commentedon Nov 3, 2020
So we put a converting store in between that only goes from
internal/quadsto Turtle indeed?But nothing else can possibly give us
internal/quads?jvherweg commentedon Nov 4, 2020
Yes that would be a cleaner solution, but that is impossible with the current implementation of the converting store. Currently it has 2 possible modes:
What we actually would need for this case is:
Because if we configured the store to want turtle for example, all incoming json-ld data would also be converted. So actually similar to what we want for #276 but going in the other direction.
RubenVerborgh commentedon Nov 4, 2020
Indeed, let's do this one. Essentially, we would want an
internal/quads;q=0setting for the outgoing part, which should then lead to the right conclusion.jvherweg commentedon Nov 4, 2020
This will require a rework of some converting part somewhere because currently conversion is based on preferences saying what they want, not saying what they don't want.
RubenVerborgh commentedon Nov 4, 2020
Makes sense; let's branch into issues.
jvherweg commentedon Nov 27, 2020
Something I just thought of: we will have to make sure all links are correct once we fix #355 . Either the patching store/handler should not do any locking and simply be put behind the locking resource store (since that would also cause that resource to be locked before the modification), or the patching store needs to be put before the locking resource store and the store the handlers use needs to be one that bypasses the locking resource store. Otherwise we would end up with deadlocks since our locks are not re-entrant.