Constructor
new BaseEngine(name)
Instantiates a new BaseEngine.
Parameters
-
name
StringThe name of this storage engine.
Source
Members
config*
The configuration object for the storage engine.
Type
-
*
Source
logLogger
Type
Source
nameString
The name of this StashKu engine. This name is used in debugging and log output.
Type
-
String
Source
Methods
configure(config, loggeropt)
Sets the storage engine configuration property. This function is called automatically by StashKu when the engine is initialized or when the configuration source has been changed.
Parameters
-
config
*The configuration object for the storage engine.
-
logger
Logger<optional>
Optional
Loggerinstance to set on the engine. This is usually assigned to the same instance as the StashKu parent.
Source
delete(request) → {Promise.<Response>}
Run a DELETE request and deletes all objects in storage matching the DELETE request criteria.
Parameters
-
request
DeleteRequestThe DELETE request to send to the storage engine.
Returns
-
Promise.<Response>Returns the data objects from storage that were deleted with the request criteria.
Throws
-
A 501 REST error if not overriden and supported by the storage engine.
-
A 400 REST error if the request is missing or not a
DeleteRequest. -
A 400 REST error if the request missing required metadata.
-
A 400 REST error if the request metadata is missing a required "from" value.
-
A 400 REST error if the request metadata is missing "where" conditions to match objects in storage and is not enabled to affect all objects.
Source
destroy()
Standardized method to clean up resources within a storage engine. This is called from the StashKu instance when an engine is replaced or removed, or the instance is destroyed.
Source
get(request) → {Promise.<Response>}
Run a GET request and returns objects from storage that match the GET request criteria.
Parameters
-
request
GetRequestThe GET request to send to the storage engine.
Returns
-
Promise.<Response>Returns the data objects from storage matching request criteria.
Throws
-
A 501 REST error if not overriden and supported by the storage engine.
-
A 400 REST error if the request is missing or not a
GetRequest. -
A 400 REST error if the request missing required metadata.
-
A 400 REST error if the request metadata is missing a required "from" value.
Source
options(request) → {Promise.<Response>}
Run an OPTIONS request which returns a dynamically constructed model type which defines how StashKu can
interact with the target (from) resource.
Parameters
-
request
OptionsRequestThe OPTIONS request to send to the storage engine.
Returns
-
Promise.<Response>Returns a response with a single data object- the dynamically created model configuration.
Throws
-
A 501 REST error if not overriden and supported by the storage engine.
-
A 400 REST error if the request is missing or not a
OptionsRequest. -
A 400 REST error if the request missing required metadata.
-
A 400 REST error if the request metadata is missing a required "from" value.
-
A 400 REST error if the request metadata is missing "where" conditions to match objects in storage and is not enabled to affect all objects.
Source
patch(request) → {Promise.<Response>}
Run a PATCH request and updates all objects in storage matching the PATCH request criteria. A count of the
number of objects affected is returned.
Parameters
-
request
PatchRequestThe PATCH request to send to the storage engine.
Returns
-
Promise.<Response>Returns a response with the total number of the objects affected in storage. No data objects are typically returned with this request.
Throws
-
A 501 REST error if not overriden and supported by the storage engine.
-
A 400 REST error if the request is missing or not a
PatchRequest. -
A 400 REST error if the request missing required metadata.
-
A 400 REST error if the request metadata is missing a required "to" value.
-
A 400 REST error if the request metadata is missing a "template" object.
-
A 400 REST error if the request metadata is missing "where" conditions to match objects in storage and is not enabled to affect all objects.
Source
post(request) → {Promise.<Response>}
Run a POST request and creates (then returns) objects in storage.
Parameters
-
request
PostRequestThe POST request to send to the storage engine.
Returns
-
Promise.<Response>Returns the data objects from storage that were created with the request criteria.
Throws
-
A 501 REST error if not overriden and supported by the storage engine.
-
A 400 REST error if the request is missing or not a
PostRequest. -
A 400 REST error if the request missing required metadata.
-
A 400 REST error if the request metadata is missing a required "to" value.
Source
put(request) → {Promise.<Response>}
Run a PUT request and updates (then returns) objects in storage.
Parameters
-
request
PutRequestThe PUT request to send to the storage engine.
Returns
-
Promise.<Response>Returns the data objects from storage that were updated with the request criteria. This may not exactly match the objects requested to be updated, as some may have been deleted from storage or some may not match the key criteria.
Throws
-
A 501 REST error if not overriden and supported by the storage engine.
-
A 400 REST error if the request is missing or not a
PutRequest. -
A 400 REST error if the request missing required metadata.
-
A 400 REST error if the request metadata is missing a required "to" value.
-
A 400 REST error if the request metadata is missing at least one "pk" value.
Source
resources() → {Promise.<Array.<String>>}
Returns an array of strings naming the resources available in the storage medium accessible by the engine.
Returns
-
Promise.<Array.<String>>