Bases: swift.common.daemon.Daemon
Audit accounts.
Audits the given account path
Parameters: | path – the path to an account db |
---|
Run the account audit until stopped.
Run the account audit once.
Pluggable Back-end for Account Server
Bases: swift.common.db.DatabaseBroker
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: |
|
---|
Bases: swift.common.daemon.Daemon
Removes data from status=DELETED accounts. These are accounts that have been asked to be removed by the reseller via services remove_storage_account XMLRPC call.
The account is not deleted immediately by the services call, but instead the account is simply marked for deletion by setting the status column in the account_stat table of the account database. This account reaper scans for such accounts and removes the data in the background. The background deletion process will occur on the primary account server for the account.
Parameters: |
|
---|
See the etc/account-server.conf-sample for information on the possible configuration parameters.
The account swift.common.ring.Ring for the cluster.
The container swift.common.ring.Ring for the cluster.
Get the ring identified by the policy index
Parameters: | policy_idx – Storage policy index |
---|---|
Returns: | A ring matching the storage policy |
Called once per pass for each account this server is the primary for and attempts to delete the data for the given account. The reaper will only delete one account at any given time. It will call reap_container() up to sqrt(self.concurrency) times concurrently while reaping the account.
If there is any exception while deleting a single container, the process will continue for any other containers and the failed containers will be tried again the next time this function is called with the same parameters.
If there is any exception while listing the containers for deletion, the process will stop (but will obviously be tried again the next time this function is called with the same parameters). This isn’t likely since the listing comes from the local database.
After the process completes (successfully or not) statistics about what was accomplished will be logged.
This function returns nothing and should raise no exception but only update various self.stats_* values for what occurs.
Parameters: |
|
---|
See also
swift.account.backend.AccountBroker for the broker class.
See also
swift.common.ring.Ring.get_nodes() for a description of the node dicts.
Deletes the data and the container itself for the given container. This will call reap_object() up to sqrt(self.concurrency) times concurrently for the objects in the container.
If there is any exception while deleting a single object, the process will continue for any other objects in the container and the failed objects will be tried again the next time this function is called with the same parameters.
If there is any exception while listing the objects for deletion, the process will stop (but will obviously be tried again the next time this function is called with the same parameters). This is a possibility since the listing comes from querying just the primary remote container server.
Once all objects have been attempted to be deleted, the container itself will be attempted to be deleted by sending a delete request to all container nodes. The format of the delete request is such that each container server will update a corresponding account server, removing the container from the account’s listing.
This function returns nothing and should raise no exception but only update various self.stats_* values for what occurs.
Parameters: |
|
---|
Called once per pass for each device on the server. This will scan the accounts directory for the device, looking for partitions this device is the primary for, then looking for account databases that are marked status=DELETED and still have containers and calling reap_account(). Account databases marked status=DELETED that no longer have containers will eventually be permanently removed by the reclaim process within the account replicator (see swift.db_replicator).
Parameters: | device – The device to look for accounts to be deleted. |
---|
Deletes the given object by issuing a delete request to each node for the object. The format of the delete request is such that each object server will update a corresponding container server, removing the object from the container’s listing.
This function returns nothing and should raise no exception but only update various self.stats_* values for what occurs.
Parameters: |
|
---|
Main entry point when running the reaper in normal daemon mode.
This repeatedly calls reap_once() no quicker than the configuration interval.
Main entry point when running the reaper in ‘once’ mode, where it will do a single pass over all accounts on the server. This is called repeatedly by run_forever(). This will call reap_device() once for each device on the server.
Bases: swift.common.base_storage_server.BaseStorageServer
WSGI controller for the account server.
Handle HTTP DELETE request.
Handle HTTP GET request.
Handle HTTP HEAD request.
Handle HTTP POST request.
Handle HTTP PUT request.
Handle HTTP REPLICATE request. Handler for RPC calls for account replication.
paste.deploy app factory for creating WSGI account server apps