class DBBinding(ABC):
Known subclasses: acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBinding
This abstract class defines the interface for database bindings.
| Method | add |
Add a batch notification to the database. |
| Method | add |
Add an originator to the database. |
| Method | backup |
Backup the database to a directory. |
| Method | close |
Close the database. |
| Method | count |
Return the number of batch notifications for a resource and notification URI. |
| Method | count |
Return the number of resources in the database. |
| Method | delete |
Delete an identifier from the identifiers DB. |
| Method | delete |
Remnove all stored requests from the database. |
| Method | delete |
Delete a resource from the database. |
| Method | discover |
Search for resources by a filter function. This goes through all resources in the database and applies the filter function to each resource. If the filter function returns True, the resource is added to the result list. |
| Method | get |
Get an action representation by resource ID. |
| Method | get |
Return all action representations. |
| Method | get |
Return the batch notifications for a resource and notification URI. |
| Method | get |
Get an originator and its information from the database. |
| Method | get |
Get requests for a resource ID, or all requests. |
| Method | get |
Get a schedule from the database. |
| Method | get |
Get all schedules from the database. |
| Method | has |
Check if a resource exists in the database. |
| Method | insert |
Add a request to the requests database. |
| Method | insert |
Insert a resource into the database. |
| Method | purge |
Purge the database. Remove all data |
| Method | purge |
Purge the statistics DB. |
| Method | remove |
Remove an action representation. |
| Method | remove |
Remove the batch notifications for a resource and notification URI. |
| Method | remove |
Remove a child resource from the childResources DB. |
| Method | remove |
Remove old requests from the database. |
| Method | remove |
Remove an originator from the database. |
| Method | remove |
Remove a schedule from the database. |
| Method | remove |
Remove a subscription representation from the database. |
| Method | search |
Search for action representations by subject. |
| Method | search |
Search and return all resources that match the given dictionary/document. |
| Method | search |
Search for child resources by parent resource ID and optional type. |
| Method | search |
Search for an resource ID OR for a structured name in the identifiers DB. |
| Method | search |
Search for resources by structured resource name, resource ID, CSE-ID, parent resource ID, resource type, or application entity ID. |
| Method | search |
Search for schedules in the database. |
| Method | search |
Search for statistics. |
| Method | search |
Search for subscription representations by resource ID or parent resource ID. |
| Method | update |
Update an action representation. |
| Method | update |
Update a resource in the database. Only the fields that are not None will be updated. |
| Method | upsert |
Update or insert an action representation. |
| Method | upsert |
Add a child resource to the childResources DB. |
| Method | upsert |
Insert or update an identifier into the identifiers DB and a structured resource name into the structuredResourceNames DB. |
| Method | upsert |
Update or insert a resource into the database. |
| Method | upsert |
Add or update a schedule in the database. |
| Method | upsert |
Update or insert statistics. |
| Method | upsert |
Update or insert a subscription representation into the database. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingAdd a batch notification to the database.
| Parameters | |
batchJSON | The batch notification to add. |
| Returns | |
bool | True if the batch notification was added, False otherwise. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingAdd an originator to the database.
| Parameters | |
originatorJSON | The originator structure to add. |
originator:str | The originator to add. |
| Returns | |
bool | Boolean value to indicate success or failure. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingBackup the database to a directory.
| Parameters | |
dir:str | The directory to backup to. |
| Returns | |
bool | Boolean value to indicate success or failure. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingClose the database.
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingReturn the number of batch notifications for a resource and notification URI.
| Parameters | |
ri:str | The resource ID of the resource. |
nu:str | The notification URI. |
| Returns | |
int | The number of batch notifications for the resource and notification URI. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingReturn the number of resources in the database.
| Returns | |
int | The number of resources in the database. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingDelete an identifier from the identifiers DB.
| Parameters | |
ri:str | The resource ID of the resource. |
srn:str | The structured resource name of the resource. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingRemnove all stored requests from the database.
| Parameters | |
ri:str | None | Optional resouce ID. Only requests for this resource ID will be deleted. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingDelete a resource from the database.
| Parameters | |
ri:str | The resource ID of the resource. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingSearch for resources by a filter function. This goes through all resources in the database and applies the filter function to each resource. If the filter function returns True, the resource is added to the result list.
| Parameters | |
func:Callable[ | The filter function to use. |
| Returns | |
list[ | A list of found resource documents, or an empty list. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingGet an action representation by resource ID.
| Parameters | |
ri:str | The resource ID of the action representation. |
| Returns | |
JSON | None | The action representation, or None if not found. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingReturn all action representations.
| Returns | |
list[ | A list of action representations, or None if not found. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingReturn the batch notifications for a resource and notification URI.
| Parameters | |
ri:str | The resource ID of the resource. |
nu:str | The notification URI. |
| Returns | |
list[ | A list of batch notifications for the resource and notification URI. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingGet an originator and its information from the database.
| Parameters | |
originator:str | The originator to search for. |
| Returns | |
tuple[ | Tuple containing the originator and its type, or None if not found. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingGet requests for a resource ID, or all requests.
| Parameters | |
ri:str | None | The target resource's resource ID. If None or empty, then all requests are returned |
| Returns | |
list[ | List of Documents. May be empty. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingGet a schedule from the database.
| Parameters | |
ri:str | The resource ID of the schedule. |
| Returns | |
JSON | None | The schedule, or None if not found. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingGet all schedules from the database.
| Returns | |
list[ | List of Documents. May be empty. |
str | None = None, srn: str | None = None, ty: int | None = None) -> bool:
¶
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingCheck if a resource exists in the database.
Only one of the parameters may be used at a time. The order of precedence is: structured resource name, resource ID, resource type.
| Parameters | |
ri:str | None | A resource ID. |
srn:str | None | A structured resource name. |
ty:int | None | A resource type. |
| Returns | |
bool | True if the resource exists, False otherwise. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingAdd a request to the requests database.
| Parameters | |
req:JSON | The request to store. |
ts:float | The timestamp of the request. |
| Returns | |
bool | Boolean value to indicate success or failure. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingInsert a resource into the database.
| Parameters | |
resource:JSON | The resource to insert. |
ri:str | The resource ID of the resource. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingPurge the database. Remove all data
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingPurge the statistics DB.
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingRemove an action representation.
| Parameters | |
ri:str | The action's resource ID. |
| Returns | |
bool | True if the action representation was removed, False otherwise. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingRemove the batch notifications for a resource and notification URI.
| Parameters | |
ri:str | The resource ID of the resource. |
nu:str | The notification URI. |
| Returns | |
bool | True if the batch notifications were removed, False otherwise. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingRemove a child resource from the childResources DB.
| Parameters | |
ri:str | The resource ID of the resource. |
pi:str | The resource ID of the parent resource. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingRemove old requests from the database.
| Parameters | |
maxint | The maximum number of requests to keep. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingRemove an originator from the database.
| Parameters | |
originator:str | The originator to remove. |
| Returns | |
bool | Boolean value to indicate success or failure. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingRemove a schedule from the database.
| Parameters | |
ri:str | The resource ID of the schedule to remove. |
| Returns | |
bool | True if the schedule was removed, False otherwise. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingRemove a subscription representation from the database.
| Parameters | |
ri:str | The resource ID of the original SUB resource. |
| Returns | |
bool | True if the subscription representation was removed, False otherwise. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingSearch for action representations by subject.
| Parameters | |
subjectstr | The resource ID of the action representation's subject. |
| Returns | |
Sequence[ | A list of action representations, or an empty list if not found. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingSearch and return all resources that match the given dictionary/document.
| Parameters | |
dct:dict | The dictionary/document to search for. |
| Returns | |
list[ | A list of found resources, or an empty list. |
str, ty: ResourceTypes | list[ ResourceTypes] | None = None) -> list[ str]:
¶
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingSearch for child resources by parent resource ID and optional type.
| Parameters | |
pi:str | The parent resource ID. |
ty:ResourceTypes | list[ | The resource type of the child resources to search for, or a list of resource types. |
| Returns | |
list[ | A list of child resource IDs, or an empty list if not found. |
str | None = None, srn: str | None = None) -> list[ JSON]:
¶
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingSearch for an resource ID OR for a structured name in the identifiers DB.
Either ri or srn shall be given. If both are given then srn is taken.
| Parameters | |
ri:str | None | Resource ID to search for. |
srn:str | None | Structured path to search for. |
| Returns | |
list[ | A list of found identifier documents (see upsertIdentifier), or an empty list if not found. |
str | None = None, csi: str | None = None, srn: str | None = None, pi: str | None = None, ty: int | None = None, aei: str | None = None) -> list[ JSON]:
¶
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingSearch for resources by structured resource name, resource ID, CSE-ID, parent resource ID, resource type, or application entity ID.
Only one of the parameters may be used at a time. The order of precedence is: structured resource name, resource ID, CSE-ID, structured resource name, parent resource ID, resource type, application entity ID.
| Parameters | |
ri:str | None | A resource ID. |
csi:str | None | A CSE ID. |
srn:str | None | A structured resource name. |
pi:str | None | A parent resource ID. |
ty:int | None | A resource type. |
aei:str | None | An application entity ID. |
| Returns | |
list[ | A list of found resource documents, or an empty list. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingSearch for schedules in the database.
| Parameters | |
pi:str | The resource ID of the parent resource. |
| Returns | |
list[ | List of Documents. May be empty. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingSearch for statistics.
| Returns | |
JSON | The statistics, or None if not found. |
str | None = None, pi: str | None = None) -> list[ JSON] | None:
¶
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingSearch for subscription representations by resource ID or parent resource ID.
Only one of the parameters may be used at a time. The order of precedence is: resource ID, parent resource ID.
| Parameters | |
ri:str | None | A resource ID. |
pi:str | None | A parent resource ID. |
| Returns | |
list[ | A list of found subscription representations, or None. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingUpdate an action representation.
| Parameters | |
actionJSON | The action representation to update. |
| Returns | |
bool | True if the action representation was updated, False otherwise. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingUpdate or insert an action representation.
| Parameters | |
actionJSON | The action representation to update or insert. |
ri:str | The resource ID of the action representation. |
| Returns | |
bool | True if the action representation was updated or inserted, False otherwise. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingAdd a child resource to the childResources DB.
| Parameters | |
childJSON | The resource to add as a child. |
ri:str | The resource ID of the resource. |
JSON, structuredPathMapping: JSON, ri: str, srn: str):
¶
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingInsert or update an identifier into the identifiers DB and a structured resource name into the structuredResourceNames DB.
| Parameters | |
identifierJSON | The identifier mapping to insert. |
structuredJSON | The structured path mapping to insert. |
ri:str | The resource ID of the resource. |
srn:str | The structured resource name of the resource. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingUpdate or insert a resource into the database.
| Parameters | |
resource:JSON | The resource to upate or insert. |
ri:str | The resource ID of the resource. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingAdd or update a schedule in the database.
| Parameters | |
schedule:JSON | The schedule to store. |
ri:str | The resource ID of the schedule. |
| Returns | |
bool | True if the schedule was added or updated, False otherwise. |
acme.plugins.database.PostgreSQLBinding.PostgreSQLBinding, acme.plugins.database.TinyDBBinding.TinyDBBindingUpdate or insert statistics.
| Parameters | |
stats:JSON | The statistics to update or insert. |
| Returns | |
bool | True if the statistics were updated or inserted, False otherwise. |