Skip to content
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

Implement a file-based ResourceStore #46

Closed
joachimvh opened this issue Jul 28, 2020 · 1 comment · Fixed by #52
Closed

Implement a file-based ResourceStore #46

joachimvh opened this issue Jul 28, 2020 · 1 comment · Fixed by #52
Labels
☀️ enhancement New feature or request

Comments

@joachimvh
Copy link
Member

We need a ResourceStore that makes use of the file system backend, similarly to how the current Solid server operates. There currently already is a basic in-memory store, but note that several shortcuts are taken there that should not be copied.

Some of the required features:

  • Read the developer notes. Specifically the architecture document describes how ResourceStores should function.
  • The interface lists each of the required functions.
  • Containers should be represented by folders, while resources as the files in those folders.
  • Metadata about a container can be stored in a .metadata file in that folder. Similarly, metadata about a (binary) file can be stored in ${filename}.metadata.
  • The CRUD operations on the resources should mostly correspond to those on files. E.g., getting a resource should return a file stream, deleting a resource should delete the file, etc.

Things to take into account:

  • Make sure the correct libraries are used for handling file paths and URLs, since the first are handled differently by Windows and Unix systems, while the second are handled the same.
  • The SimpleResourceStore does some data conversions between Quads and text/turtle. In general ResourceStores should not do this since the plan is to have specific stores to handle the data conversion (to prevent repetition), so simply supporting BinaryRepresentation for in- and output is sufficient.
  • Conditions don't have to be supported in the first implementation, but take into account that this will need to be added at some point later.
  • The modifyResource function should simply throw an error so it can be handled by an external PatchingStore.
  • Make sure there are no unexpected errors being thrown due to e.g. files not existing.
@joachimvh joachimvh added the ☀️ enhancement New feature or request label Jul 28, 2020
@RubenVerborgh
Copy link
Member

Also relevant here is the mapping from URLs to files and back, as described here https://www.w3.org/DesignIssues/HTTPFilenameMapping.html The component in the achitecture is ResourceMapper.

You might be able to reuse https://github.com/solid/node-solid-server/blob/v5.4.0/test/unit/resource-mapper-test.js, which is supposed to encode the mapping described in that document. You might find https://github.com/solid/node-solid-server/blob/v5.4.0/lib/resource-mapper.js interesting as inspiration for the implementation, although the code has rotted somewhat over time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☀️ enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants