The internal REST API used between the proxy server and the account, container and object server is almost identical to public Swift REST API, but with a few internal extensions (for example, update an account with a new container).
The pluggable back-end APIs for the three REST API servers (account, container, object) abstracts the needs for servicing the various REST APIs from the details of how data is laid out and stored on-disk.
The APIs are documented in the reference implementations for all three servers. For historical reasons, the object server backend reference implementation module is named diskfile, while the account and container server backend reference implementation modules are named appropriately.
This API is still under development and not yet finalized.
Pluggable Back-end for Account Server
Encapsulates working with an account database.
Create account_stat table which is specific to the account DB. Not a part of Pluggable Back-ends, internal to the baseline code.
Parameters: |
|
---|
Create container table which is specific to the account DB.
Parameters: | conn – DB connection object |
---|
Create policy_stat table which is specific to the account DB. Not a part of Pluggable Back-ends, internal to the baseline code.
Parameters: | conn – DB connection object |
---|
Check if the account DB is empty.
Returns: | True if the database has no active containers. |
---|
Get global data for the account.
Returns: | dict with keys: account, created_at, put_timestamp, delete_timestamp, status_changed_at, container_count, object_count, bytes_used, hash, id |
---|
Get global policy stats for the account.
Parameters: | do_migrations – boolean, if True the policy stat dicts will always include the ‘container_count’ key; otherwise it may be omitted on legacy databases until they are migrated. |
---|---|
Returns: | dict of policy stats where the key is the policy index and the value is a dictionary like {‘object_count’: M, ‘bytes_used’: N, ‘container_count’: L} |
Only returns true if the status field is set to DELETED.
Get a list of containers sorted by name starting at marker onward, up to limit entries. Entries will begin with the prefix and will not have the delimiter after the prefix.
Parameters: |
|
---|---|
Returns: | list of tuples of (name, object_count, bytes_used, 0) |
Merge items into the container table.
Parameters: |
|
---|
Create a container with the given attributes.
Parameters: |
|
---|
Pluggable Back-ends for Container Server
Encapsulates working with a container database.
Create the container_info table which is specific to the container DB. Not a part of Pluggable Back-ends, internal to the baseline code. Also creates the container_stat view.
Parameters: |
|
---|
Create the object table which is specific to the container DB. Not a part of Pluggable Back-ends, internal to the baseline code.
Parameters: | conn – DB connection object |
---|
Create policy_stat table.
Parameters: |
|
---|
Mark an object deleted.
Parameters: |
|
---|
Check if container DB is empty.
Returns: | True if the database has no active objects, False otherwise |
---|
Get global data for the container.
Returns: | dict with keys: account, container, created_at, put_timestamp, delete_timestamp, status_changed_at, object_count, bytes_used, reported_put_timestamp, reported_delete_timestamp, reported_object_count, reported_bytes_used, hash, id, x_container_sync_point1, x_container_sync_point2, and storage_policy_index. |
---|
Get the is_deleted status and info for the container.
Returns: | a tuple, in the form (info, is_deleted) info is a dict as returned by get_info and is_deleted is a boolean. |
---|
Get a list of objects which are in a storage policy different from the container’s storage policy.
Parameters: |
|
---|---|
Returns: | list of dicts with keys: name, created_at, size, content_type, etag, storage_policy_index |
Get a list of objects sorted by name starting at marker onward, up to limit entries. Entries will begin with the prefix and will not have the delimiter after the prefix.
Parameters: |
|
---|---|
Returns: | list of tuples of (name, created_at, size, content_type, etag) |
Merge items into the object table.
Parameters: |
|
---|
Creates an object in the DB with its metadata.
Parameters: |
|
---|
Update reported stats, available with container’s get_info.
Parameters: |
|
---|
Update the container_stat policy_index and status_changed_at.
Compare the data and meta related timestamps of a new object item with the timestamps of an existing object record, and update the new item with data and/or meta related attributes from the existing record if their timestamps are newer.
The multiple timestamps are encoded into a single string for storing in the ‘created_at’ column of the objects db table.
Parameters: |
|
---|---|
Returns: | True if any attributes of the new item dict were found to be newer than the existing and therefore not updated, otherwise False implying that the updated item is equal to the existing. |