Skip to content

feat: Create multiple configs supporting different store backends - #296

Merged
jvherweg merged 3 commits into
masterfrom
configs
Nov 4, 2020
Merged

jvherweg merged 3 commits into
masterfrom
configs

Conversation

@jvherweg

@jvherweg jvherweg commented Nov 2, 2020

Copy link
Copy Markdown
Member

Create multiple configurations that can be used, in preparation for #281

@RubenVerborgh RubenVerborgh self-assigned this Nov 2, 2020
Base automatically changed from smessie-sparql-resource-store to master November 2, 2020 14:04

@RubenVerborgh RubenVerborgh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work.

Maybe we want to document in the README what boots up when we start the default server?

Question: will it fail if I have no SPARQL endpoint running? (Probably will, and that's ok, let's just document.)

Comment thread config/config-default.json Resolved
Comment thread config/presets/data-conversion.json Resolved
Comment thread config/presets/storage-file.json Resolved
@jvherweg

jvherweg commented Nov 2, 2020

Copy link
Copy Markdown
Member Author

Question: will it fail if I have no SPARQL endpoint running? (Probably will, and that's ok, let's just document.)

Yes an error gets thrown if the variable does not contain a valid endpoint (where this error gets thrown depends on if the value is defined, is an URL, and is up).

@jvherweg
jvherweg force-pushed the configs branch 2 times, most recently from 1bdd1ce to 4c3a191 Compare November 3, 2020 11:05
@jvherweg

jvherweg commented Nov 3, 2020

Copy link
Copy Markdown
Member Author

Updates to now also have 2 routing related configs and some cleanup. Still have to update the readme.

Doing this (cleanly) was more difficult than anticipated. The problem is that some config parts use an URI in the assumption that it will be filled in by an other config. E.g., the final store will have the URI ...:ResourceStore and the 3 different versions (sparql, memory, file) then fill in the triples for this URI. This becomes a problem when we want to use multiple stores at the same time. You can see my current solution in config-default.json and the related configs. This way the store used can be configured in the root config without seeing everything else around it. Maybe some other "variables" could be put there in the future. This does make it a bit less clean though.

The other thing is that some configs now have a routing store and some don't. This has a similar issue as above, in that one config part was linked directly to the backend part and there was no clean way to sometimes put something in between. So what I do now is assume there is always going to be a ...:RoutingResourceStore, and in the cases there isn't, this gets mapped to a PassthroughStore (of which I just discovered we use different indentation for Passthrough than Node.js btw). We can probably do this for several of the big blocks that have a high chance of being there (such as the converting store perhaps). It will be impossible to cover all cases, but it might make building configs from separate blocks easier (with the tradeoff of having some passthrough stores in there but if you really don't want those you can still make a custom config without them).

@jvherweg

jvherweg commented Nov 3, 2020 •

Copy link
Copy Markdown
Member Author

I have also updated the SparqlPatchUpdateHandler to write to a store that always converts incoming data to turtle as described in #137 (comment) . This allows us to resolve PATCH requests on file stores. This is now slightly more inefficient in memory and sparql stores since it's not needed there (and sparql stores are just going to convert it back to quads again). But this only happens for PATCH requests.

The cool thing was how easy it was to add such a store in there though.

@RubenVerborgh

Copy link
Copy Markdown
Member

The problem is that some config parts use an URI in the assumption that it will be filled in by an other config. E.g., the final store will have the URI ...:ResourceStore and the 3 different versions (sparql, memory, file) then fill in the triples for this URI. This becomes a problem when we want to use multiple stores at the same time. You can see my current solution in config-default.json and the related configs.

I didn't fully understand this bit; things look fine to me.

So what I do now is assume there is always going to be a ...:RoutingResourceStore, and in the cases there isn't, this gets mapped to a PassthroughStore

That sounds good.

different indentation for Passthrough than Node.js

??

We can probably do this for several of the big blocks that have a high chance of being there

Yes!

It will be impossible to cover all cases, but it might make building configs from separate blocks easier

That is good enough. Also, not all configs have to fit each other.

It's possible/likely that we ship with different config hierarchies, so people can start from any of them. And worst case, they write their own.

@RubenVerborgh RubenVerborgh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good 👍👍

Comment thread config/config-default.json Resolved
Comment thread config/config-regex.json Resolved
Comment thread config/config-rdf-to-sparql.json Resolved
Comment thread config/config-sparql.json Resolved
@RubenVerborgh

Copy link
Copy Markdown
Member

I have also updated the SparqlPatchUpdateHandler to write to a store that always converts incoming data to turtle as described in #137 (comment) . This allows us to resolve PATCH requests on file stores. This is now slightly more inefficient in memory and sparql stores since it's not needed there (and sparql stores are just going to convert it back to quads again). But this only happens for PATCH requests.

So why don't we just put this conversion store only in front of the file store? So file store has a conversion store from quads to Turtle in front of it?

@jvherweg

jvherweg commented Nov 4, 2020 •

Copy link
Copy Markdown
Member Author

different indentation for Passthrough than Node.js

??

The node class is called PassThrough, our class is called PassthroughStore. 😄

So why don't we just put this conversion store only in front of the file store? So file store has a conversion store from quads to Turtle in front of it?

For reference sake: I replied to this in #137

@RubenVerborgh

Copy link
Copy Markdown
Member

Note: in the future, we can also use variables with default assignment for such things (as opposed to passthrough): LinkedSoftwareDependencies/Components.js#23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants