The intention of this module is to provide support for the COPY
command to help achieve compatibility to the Solid project.
To allow for clean user experience, we sometimes require very quick operations to allow for instant user interaction, one type of application implementation that will be seen built on top of Solid is to define state machines by utilising the powerful graphing ability of RDF and FaaS.
To achieve a quick response time we could define a way to offload COPY
requests to a backing service, but we will also need to be able to make the resources available from our service immediately if requested.
There are different levels of acceptable outcomes for a COPY
request, here's a quick list of use cases we will cover:
- Agent makes a
COPY
request with headerSource
a resource URI, agent requires the resource to be cloned immediately, and for a shallow copy to be made (this means they do not want us to follow linked resources at all), service is expected to return status code201
, with theLocation
header the URI of the cloned resource. - Agent makes a
COPY
request with headerSource
a resource URI, agent requires the resource to be available immediately, and for a full copy to be made for the origin (this means they do want us to follow linked resources from the same origin), service is expected to return status code201
, with theLocation
header the URI of the symbolic resource. Service must follow an agent accessible pre-defined cloning scheme.
Above, we have defined an entry point for a new set of rules, what a cloning scheme is. We want to seperate this concern as agents that have different requirements will require different ways to clone information.
COPY
:
- Service will make a
HEAD
request toSource
- If the
HEAD
status code is not between200
and299
, and301
to308
, then return400
with headerWarning: Resource not available - ${headResponse.status}
- Service will make a
COPY
request to backing service forSource
- Backing service will create new random
Pointer URI
- Backing service will return status
201
with headerLocation: ${Pointer URI}
- Backing service will set resource at
${Pointer URI}.meta
toDownloading
- Backing service will make a
GET
request toSource
- If
GET
return status is not between200
and299
, and301
to308
, then set resource at${Pointer URI}.meta
toWarning: ${getResponse.text()}
and abort. - Backing service will store download resource at
Pointer URI
once downloaded - Backing service will set resource at
${Pointer URI}.meta
toDownloaded
- Backing service will create new random
- Create resource at
${Target URI}.meta
describing the location of the new resource atPointer URI
- Return
201
with headerLocation: ${Target URI}
.
GET
:
- Service will check if
${Target URI}.meta
describes the location of a resource, if not continue as normal - Service will make a
GET
request to${Pointer URI}.meta
to see the status of the resource - If
GET
response isDownloading
orDownloaded
, then return status302
withLocation: ${Pointer URI}
- If
GET
response isWarning
, then return status404
with headerWarning: ${getResponse.header.get("Warning")
- Backing service will schedule
${Pointer URI}.meta
to be deleted inn
days
- Backing service will schedule
- If
GET
response is notDownloaded
, return - Service will make a
COPY
request to${Target URI}
with headerSource: ${Pointer URI}
, service requires the resource to be cloned immediately - Service will delete the location described in
${Target URI}.meta
- Cloning sets of information from a remote service to a local trusted space, for example if you wanted to browse the internet offline and already know what set of information you'll be using.
- Cloning state machines defined in RDF graphs
- Cloning resources defined within a graph, this could be a full website definiton with backing state machines or defined dependent resources (for example by way of a Ansible or Pupet, or a set of hyperlinked HTML documents
- Cloning documents between personal storage services
- Providing a common strategy whether the primary service is local to the agent, or on remote infrastructure