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
Investigate how to simplify DataAccessorBasedStore #998
DataAccessorBasedStore is the store responsible for the "main" Solid behaviour of resources on CRUD requests. The main issue is that this class does a lot, and only works with DataAccessors. Questions is if/how we can split up some of this behaviour and allow for easier reuse, without losing the interactions that are required.
Some options:
Move most of the behaviour to a SolidBehaviourStore and let DataAccessorBasedStore be a very simple store. Issue is that this might be less efficient since there no longer is any direct access to the DataAccessors. This might be mostly ok if the stores are configured so they are completely at the end of the store chain.
Move part of the behaviour to utility functions.
Have different components for each of the store functions and then have 1 store that aggregates them.
I'm leaning towards 3; the goal not being simplification to me, but rather compartmentalization of knowledge and hence better reusability for components that want to implement new backends. DataAccessorBasedStore just knows too much at the moment.
Another (additional) option is that we make DataAccessor the de-factor default interface for implementing back-ends
I would say that is already the case, when adding a new backend it's easiest to create a new DataAccessor, if you want to have full Solid behaviour on your backend (GET/PUT/POST/DELETE, containers, etc.). It's been a while but I think for the hue case not all of that was wanted? Or maybe we didn't even have data accessors then, it's been a while.
One thing we can do is not support the addResource function in the DataAccessorBasedStore. A previous store should interpret such a request and transform it into a setRepresentation. That way everything related to generating a valid identifier is moved out and we have a ResourceStore specifically for POST requests, just like we do for PATCH requests. This would also allow us to solve #288 if this store came before the converting store.
One issue with the above, and probably other suggestions if we split them over multiple stores, is that the same data will be requested multiple times. This is one of the reasons a lot is done in the DataAccessorBasedStore: direct access to the DataAccessor, and reuse of the same objects. The main object that often gets reused is the metadata though, so we could have a CachedResourceStore that caches the metadata, similar to the CachedResourceSet (it could extend that one even). Besides that we would also have to add a getMetadata function to the ResourceStore interface as otherwise we would still always have to request the data stream.
Activity
[-]Investiage how to simplify DataAccessorBasedStore[/-][+]Investigate how to simplify DataAccessorBasedStore[/+]RubenVerborgh commentedon Oct 18, 2021
I'm leaning towards 3; the goal not being simplification to me, but rather compartmentalization of knowledge and hence better reusability for components that want to implement new backends.
DataAccessorBasedStorejust knows too much at the moment.Another (additional) option is that we make
DataAccessorthe de-factor default interface for implementing back-ends, and then projects such as https://github.com/RubenVerborgh/solid-hue should start from an accessor rather than a store. It should be crucial that this does not make their code more complex, but rather simplifies it then.jvherweg commentedon Oct 19, 2021
I would say that is already the case, when adding a new backend it's easiest to create a new
DataAccessor, if you want to have full Solid behaviour on your backend (GET/PUT/POST/DELETE, containers, etc.). It's been a while but I think for the hue case not all of that was wanted? Or maybe we didn't even have data accessors then, it's been a while.RubenVerborgh commentedon Oct 19, 2021
We might not have; I do recall simplifying the CSS API a bit (implementing common helpers) as I was writing the Hue code.
I should rewrite https://github.com/RubenVerborgh/solid-hue/blob/main/src/PhilipsHueStore.ts as an accessor and see if the same is needed.
jvherweg commentedon Nov 4, 2022
Some ideas that followed from each other.
One thing we can do is not support the
addResourcefunction in theDataAccessorBasedStore. A previous store should interpret such a request and transform it into asetRepresentation. That way everything related to generating a valid identifier is moved out and we have aResourceStorespecifically for POST requests, just like we do for PATCH requests. This would also allow us to solve #288 if this store came before the converting store.One issue with the above, and probably other suggestions if we split them over multiple stores, is that the same data will be requested multiple times. This is one of the reasons a lot is done in the
DataAccessorBasedStore: direct access to theDataAccessor, and reuse of the same objects. The main object that often gets reused is the metadata though, so we could have aCachedResourceStorethat caches the metadata, similar to theCachedResourceSet(it could extend that one even). Besides that we would also have to add agetMetadatafunction to theResourceStoreinterface as otherwise we would still always have to request the data stream.