oio.rdir package
Submodules
oio.rdir.client module
-
class
oio.rdir.client.
RdirClient
(conf, **kwargs)[source] Bases:
oio.api.base.HttpApi
Client class for rdir services.
-
admin_clear
(volume, clear_all=False, before_incident=False, repair=False, **kwargs)[source]
-
admin_incident_get
(volume, **kwargs)[source]
-
admin_incident_set
(volume, date, **kwargs)[source]
-
admin_lock
(volume, who, **kwargs)[source]
-
admin_show
(volume, **kwargs)[source]
-
admin_unlock
(volume, **kwargs)[source]
-
base_url
= {'meta2': 'rdir/meta2', 'rawx': 'rdir'}
-
chunk_delete
(volume_id, container_id, content_id, chunk_id, **kwargs)[source] Unreference a chunk from the reverse directory
-
chunk_fetch
(volume, limit=1000, rebuild=False, container_id=None, max_attempts=3, start_after=None, shuffle=False, **kwargs)[source] Fetch the list of chunks belonging to the specified volume.
Parameters: - volume (str) – the volume to get chunks from
- limit (int) – maximum number of results to return per request to the rdir server.
- rebuild (bool) – fetch only the chunks that were there before the last incident.
- container_id (str) – get only chunks belonging to the specified container
- start_after (str) – fetch only chunk that appear after this container ID
-
chunk_push
(volume_id, container_id, content_id, chunk_id, headers=None, **data)[source] Reference a chunk in the reverse directory
-
create
(volume_id, service_type='rawx', **kwargs)[source] Create the database for volume_id on the appropriate rdir
-
meta2_index_create
(volume_id, **kwargs)[source] Create a new meta2 rdir index.
Parameters: volume_id – The meta2 volume.
-
meta2_index_delete
(volume_id, container_path=None, container_id=None, **kwargs)[source] Remove a meta2 record from the volume’s index. Either the container ID or the container path have to be given.
Parameters: - volume_id – The meta2 volume.
- container_id – The container ID.
- container_path – The container path
-
meta2_index_fetch
(volume_id, prefix=None, marker=None, limit=4096, **kwargs)[source] Fetch specific meta2 records, or a range of records.
Parameters: - volume_id – The meta2 volume.
- prefix – The prefix all meta2 records should have.
- marker – The container path from which the API will start the listing. The marker will not be included in the result.
- limit – The number of records to be returned. Capped at 4096
Returns: A dictionary containing the following entries: - records: A list containing the actual records. - truncated: A boolean value representing whether there are still records left that fulfill this query.
-
meta2_index_fetch_all
(volume_id, **kwargs)[source] A wrapper around meta2_index_fetch that loops until no more records are available, returning all the records in a certain volume’s index.
WARNING: For testing purposes only
-
meta2_index_push
(volume_id, container_url, container_id, mtime, **kwargs)[source] Add a newly created container to the list of containers handled by the meta2 server in question.
Parameters: - volume_id – The meta2 volume.
- container_url – The container path (NS/account/container)
- container_id – The container ID.
- mtime – The last time it was spotted on this volume.
- headers – Optional headers to pass along to the request.
-
status
(volume, max=1000, prefix=None, marker=None, max_attempts=3, **kwargs)[source] Get the status of chunks belonging to the specified volume.
Parameters: - volume (str) – the volume to get chunks from
- max (int) – maximum number of results to return per request to the rdir server.
- prefix (str) – get only chunks belonging to the specified prefix
- marker (str) – fetch only chunk that appear after this marker
-
-
class
oio.rdir.client.
RdirDispatcher
(conf, rdir_client=None, **kwargs)[source] Bases:
object
-
assign_all_meta2
(max_per_rdir=None, **kwargs)[source] Assign an rdir service to all meta2 servers that aren’t already assigned one.
Parameters: max_per_rdir (int) – Maximum number of services an rdir can handle. Returns: The list of meta2 that were assigned rdir services.
-
assign_all_rawx
(max_per_rdir=None, **kwargs)[source] Find an rdir service for all rawx that don’t have one already.
Parameters: max_per_rdir (int) – maximum number or rawx services that an rdir can be linked to
-
assign_services
(service_type, max_per_rdir=None, min_dist=None, **kwargs)[source] Assign an rdir service to all service_type servers that aren’t already assigned one.
Parameters: - max_per_rdir (int) – Maximum number of services an rdir can handle.
- min_dist (int) – minimum required distance between any service and its assigned rdir service.
Returns: The list of service_type services that were assigned rdir services.
-
cs
-
get_assignments
(service_type, **kwargs)[source] Get rdir assignments for all services of the specified type.
Returns: a tuple with a list all services of the specified type, and a list of all rdir services. Return type: tuple<list<dict>,list<dict>>
-