Interface AtomicDataAccessor

The AtomicDataAccessor interface has identical function signatures as the DataAccessor, with the additional constraint that every function call must be atomic in its effect: either the call fully succeeds, reaching the desired new state; or it fails, upon which the resulting state remains identical to the one before the call.

interface AtomicDataAccessor {
    canHandle: ((representation: Representation) => Promise<void>);
    deleteResource: ((identifier: ResourceIdentifier) => Promise<void>);
    getChildren: ((identifier: ResourceIdentifier) => AsyncIterableIterator<RepresentationMetadata>);
    getData: ((identifier: ResourceIdentifier) => Promise<Guarded<Readable>>);
    getMetadata: ((identifier: ResourceIdentifier) => Promise<RepresentationMetadata>);
    writeContainer: ((identifier: ResourceIdentifier, metadata: RepresentationMetadata) => Promise<void>);
    writeDocument: ((identifier: ResourceIdentifier, data: Guarded<Readable>, metadata: RepresentationMetadata) => Promise<void>);
    writeMetadata: ((identifier: ResourceIdentifier, metadata: RepresentationMetadata) => Promise<void>);
}

Hierarchy (view full)

Implemented by

Properties

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

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

Type declaration

    • (representation): Promise<void>
    • Parameters

      Returns Promise<void>

BadRequestHttpError If it does not support the incoming data.

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

Deletes the resource and its corresponding metadata.

Solid, §5.4: "When a contained resource is deleted, the server MUST also remove the corresponding containment triple, which has the effect of removing the deleted resource from the containing container." https://solid.github.io/specification/protocol#deleting-resources

Type declaration

    • (identifier): Promise<void>
    • Parameters

      Returns Promise<void>

getChildren: ((identifier: ResourceIdentifier) => AsyncIterableIterator<RepresentationMetadata>)

Returns metadata for all resources in the requested container. This should not be all metadata of those resources (but it can be), but instead the main metadata you want to show in situations where all these resources are presented simultaneously. Generally this would be metadata that is present for all of these resources, such as resource type or last modified date.

It can be safely assumed that the incoming identifier will always correspond to a container.

Type declaration

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.

Type declaration

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

Returns the metadata corresponding to the identifier. If possible, it is suggested to add a posix:size triple to the metadata indicating the binary size. This is necessary for range requests.

Type declaration

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.

Type declaration

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.

Type declaration

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

Writes metadata for a resource. It can safely be assumed that the subject resource already exists.

Type declaration