Index

DiffFusionServer.OptionsType
mutable struct Options
    is_busy::Bool
end

A container that holds flags and data which control the behaviour of the router.

The options object is created at inception of the router and passed to the various handler functions.

Options element is_busy specifies that the server currently does not accept POST requests. The flag may be set via the is_busy header field in a POST request. The flag may be de-activated via the is_busy header field in (subsequent) GET request.

source
DiffFusionServer._error_object_serialisation_failMethod
_error_object_serialisation_fail(alias::AbstractString, e::Exception)

Create an error response for a failing object serialisation.

This error indicates an unsupported object beeing applied to DiffFusion's serialisation method.

source
DiffFusionServer.api_bulk_getMethod
api_bulk_get(
    request::HTTP.Request,
    repository::AbstractDict,
    options::Options,
    )

Return a list of objects for a list of aliases.

This operation does not modify the server repository.

Request header must contain field 'op'. Value of field 'op' is 'COPY' or 'BUILD'.

Request body must contain a list of 'alias'. The list of 'alias' is iterated. For each 'alias' the corresponding object is retrieved from the server repository.

Handling of each individual object follows method api_get.

The result is a Vector of objects. This result is written to JSON and returned via the response body.

source
DiffFusionServer.api_bulk_postMethod
api_bulk_post(
    request::HTTP.Request,
    repository::AbstractDict,
    options::Options,
    )

Create and store a list of objects for a list of aliases.

Request header must contain field 'op'. Value of field 'op' is 'COPY' or 'BUILD'.

Request body must be a JSON representation. The JSON object must be of the form

[
    [alias_1, obj_1],
    [alias_2, obj_2],
    ...
]

The elements alias_k, represent the object aliases used to store the object in the server repository.

The elements obj_k are processed according to COPY or BUILD operation and following the methodology in api_post.

source
DiffFusionServer.api_deleteMethod
api_delete(
    request::HTTP.Request,
    repository::AbstractDict,
    options::Options,
    )

Delete an object from repository.

Request header must contain field 'alias'. The value of field 'alias' is the object alias of requested object in the server repository.

source
DiffFusionServer.api_getMethod
api_get(
    request::HTTP.Request,
    repository::AbstractDict,
    options::Options,
    )

Return the object with requested alias header field in body of response.

This operation does not modify the server repository.

Request header must contain fields 'alias' and 'op'. The value of field 'alias' is the object alias of requested object in the server repository. Value of field 'op' is 'COPY' or 'BUILD'.

For COPY operation, the requested data is directly written to JSON format.

For BUILD operation, the requested data is first serialised using DiffFusion serialise operation. Then the serialised object is written to JSON format.

The resulting JSON object is returned via the response body.

source
DiffFusionServer.api_get_aliasesMethod
api_get_aliases(
    request::HTTP.Request,
    repository::AbstractDict,
    options::Options,
    )

Return all aliases from the repository in body of response.

source
DiffFusionServer.api_postMethod
api_post(
    request::HTTP.Request,
    repository::AbstractDict,
    options::Options,
    )

Create and store an object for a given alias.

Request header must contain fields 'alias' and 'op'. The value of field 'alias' is the object alias used to store the object in the server repository. Value of field 'op' is 'COPY' or 'BUILD'.

Request body must be a JSON representation. The data is normalised by first applying a serialise operation.

For COPY operation, the normalised data is directly stored in the server repository.

For BUILD operation, the normalised data is deserialised via DiffFusion operations. The result is the stored in the server repository.

source
DiffFusionServer.routerFunction
router(
    api_path = _DEFAULT_API_PATH,
    api_version = _DEFAULT_API_VERSION,
    )

Create a handler function router and an initial server repository repository for that router. The function returns the named tuple

(router, repository)

The router is configured to accept requests for the specified end points. Requests are passed on to the corresponding API functions for processing.

The router represents a Handler function which is typically used in HTTP.serve(...).

The repository is a reference to the object repository. The object repository is queried and modified by subsequent requests. The current state of the object repository can be viewed (and modified) by means of the repository object reference.

source