Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface DataAccessor

A DataAccessor is the building block closest to the actual data storage. It should not worry about most Solid logic, most of that will be handled before it is called. There are a few things it still needs to do, and it is very important every implementation does this:

  • If the input identifier ends with a slash, it should be assumed the identifier is targeting a container.
  • Similarly, if there is no trailing slash it should assume a document.
  • It should always throw a NotFoundHttpError if it does not have data matching the input identifier.
  • DataAccessors are responsible for generating the relevant containment triples for containers.

Hierarchy

  • DataAccessor

Index

Properties

canHandle

canHandle: (representation: Representation) => Promise<void>

Should throw a NotImplementedHttpError if the DataAccessor does not support storing the given Representation.

param

Incoming Representation.

throws

BadRequestHttpError If it does not support the incoming data.

Type declaration

deleteResource

deleteResource: (identifier: ResourceIdentifier) => Promise<void>

Deletes the resource and its corresponding metadata.

param

Resource to delete.

Type declaration

getData

getData: (identifier: ResourceIdentifier) => Promise<Guarded<Readable>>

Returns a data stream stored for the given identifier. It can be assumed that the incoming identifier will always correspond to a document.

param

Identifier for which the data is requested.

Type declaration

getMetadata

getMetadata: (identifier: ResourceIdentifier) => Promise<RepresentationMetadata>

Returns the metadata corresponding to the identifier.

param

Identifier for which the metadata is requested.

Type declaration

writeContainer

writeContainer: (identifier: ResourceIdentifier, metadata: RepresentationMetadata) => Promise<void>

Writes metadata for a container. If the container does not exist yet it should be created, if it does its metadata should be overwritten, except for the containment triples.

param

Identifier of the container.

param

Metadata to store.

Type declaration

writeDocument

writeDocument: (identifier: ResourceIdentifier, data: Guarded<Readable>, metadata: RepresentationMetadata) => Promise<void>

Writes data and metadata for a document. If any data and/or metadata exist for the given identifier, it should be overwritten.

param

Identifier of the resource.

param

Data to store.

param

Metadata to store.

Type declaration