Skip to content

Implement a file-based ResourceStore #46

Closed

Description

@jvherweg

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.

Activity

  1. added
    ☀️ enhancement
    on Jul 28, 2020
  2. RubenVerborgh commented on Jul 28, 2020

    @RubenVerborgh
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ☀️ enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions