Index
DiffFusionServer._INFO_STRINGDiffFusionServer._NO_HTTP_ERRORDiffFusionServer.OptionsDiffFusionServer._check_for_alias_in_repositoryDiffFusionServer._check_for_header_fieldDiffFusionServer._error_alias_not_foundDiffFusionServer._error_build_async_failDiffFusionServer._error_build_object_failDiffFusionServer._error_bulk_element_list_not_foundDiffFusionServer._error_bulk_list_not_foundDiffFusionServer._error_create_json_failDiffFusionServer._error_create_json_string_failDiffFusionServer._error_create_ordered_dict_failDiffFusionServer._error_key_not_foundDiffFusionServer._error_object_serialisation_failDiffFusionServer._error_operation_not_implementedDiffFusionServer._error_option_not_implementedDiffFusionServer._error_server_is_busyDiffFusionServer.api_bulk_getDiffFusionServer.api_bulk_postDiffFusionServer.api_deleteDiffFusionServer.api_getDiffFusionServer.api_get_aliasesDiffFusionServer.api_get_infoDiffFusionServer.api_postDiffFusionServer.initial_optionsDiffFusionServer.initial_repositoryDiffFusionServer.router
DiffFusionServer._INFO_STRING — Constant
const _INFO_STRINGAn info string with API details.
DiffFusionServer._NO_HTTP_ERROR — Constant
const _NO_HTTP_ERRORDefault return status code.
DiffFusionServer.Options — Type
mutable struct Options
is_busy::Bool
endA 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.
DiffFusionServer._check_for_alias_in_repository — Method
_check_for_alias_in_repository(alias::AbstractString, d::AbstractDict)Return valid alias from repository or a response that returns error message.
DiffFusionServer._check_for_header_field — Method
_check_for_header_field(req::HTTP.Request, key::AbstractString)Return valid alias from rquest header or a response that returns error message.
DiffFusionServer._error_alias_not_found — Method
_error_alias_not_found(alias::AbstractString)Create error response for missing alias.
DiffFusionServer._error_build_async_fail — Method
_error_build_async_fail(alias::AbstractString, e::Exception)Create an error response for a failing BUILD_ASYNC operation.
DiffFusionServer._error_build_object_fail — Method
_error_build_object_fail(alias::AbstractString, e::Exception)Create an error response for a failing BUILD operation.
This error indicates a wrong DiffFuion call.
DiffFusionServer._error_bulk_element_list_not_found — Method
_error_bulk_element_list_not_found(elem::Any)Create an error response for a missing list containing alias and request details for usee in bulk request.
DiffFusionServer._error_bulk_list_not_found — Method
_error_bulk_list_not_found(body::Any)Create an error response for a missing list for a bulk request.
DiffFusionServer._error_create_json_fail — Method
_error_create_json_fail(alias::AbstractString, e::Exception)Create error response for a failing JSON read operation.
DiffFusionServer._error_create_json_string_fail — Method
_error_create_json_string_fail(alias::AbstractString, e::Exception)Create an error response for a failing JSON write.
DiffFusionServer._error_create_ordered_dict_fail — Method
_error_create_ordered_dict_fail(alias::AbstractString, e::Exception)Create an error response for a failing dictionary setup.
This error may occur during COPY operation.
DiffFusionServer._error_key_not_found — Method
_error_key_not_found(key::AbstractString)Create error response for missing http header key.
DiffFusionServer._error_object_serialisation_fail — Method
_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.
DiffFusionServer._error_operation_not_implemented — Method
_error_operation_not_implemented(op::AbstractString)Create error response for unknown server operation in http header.
Allowed operations are COPY and BUILD and BUILD_ASYNC.
DiffFusionServer._error_option_not_implemented — Method
_error_option_not_implemented(option_field::AbstractString, option_value::AbstractString)Create error response for unknown server option/value combination in http header.
DiffFusionServer._error_server_is_busy — Method
_error_server_is_busy()Create an error response for a rejected (POST) operation due to is_busy flag.
DiffFusionServer.api_bulk_get — Method
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.
DiffFusionServer.api_bulk_post — Method
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.
DiffFusionServer.api_delete — Method
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.
DiffFusionServer.api_get — Method
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.
DiffFusionServer.api_get_aliases — Method
api_get_aliases(
request::HTTP.Request,
repository::AbstractDict,
options::Options,
)Return all aliases from the repository in body of response.
DiffFusionServer.api_get_info — Method
api_get_info(request::HTTP.Request)Return an info string about the API as response.
DiffFusionServer.api_post — Method
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.
DiffFusionServer.initial_options — Function
initial_options(
is_busy::Bool = false,
)Create an Options object and initialise with default settings.
DiffFusionServer.initial_repository — Method
initial_repository()Create an object repository and initialise with some static objects.
DiffFusionServer.router — Function
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.