Account

Account Auditor

class swift.account.auditor.AccountAuditor(conf, logger=None)

Bases: swift.common.daemon.Daemon

Audit accounts.

account_audit(path)

Audits the given account path

Parameters:path – the path to an account db
run_forever(*args, **kwargs)

Run the account audit until stopped.

run_once(*args, **kwargs)

Run the account audit once.

validate_per_policy_counts(broker)
swift.account.auditor.random() → x in the interval [0, 1).

Account Backend

Pluggable Back-end for Account Server

class swift.account.backend.AccountBroker(db_file, timeout=25, logger=None, account=None, container=None, pending_timeout=None, stale_reads_ok=False)

Bases: swift.common.db.DatabaseBroker

Encapsulates working with an account database.

create_account_stat_table(conn, put_timestamp)

Create account_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
  • put_timestamp – put timestamp
create_container_table(conn)

Create container table which is specific to the account DB.

Parameters:conn – DB connection object
create_policy_stat_table(conn)

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
db_contains_type = 'container'
db_reclaim_timestamp = 'delete_timestamp'
db_type = 'account'
empty()

Check if the account DB is empty.

Returns:True if the database has no active containers.
get_db_version(conn)
get_info()

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_policy_stats(do_migrations=False)

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}
is_status_deleted()

Only returns true if the status field is set to DELETED.

list_containers_iter(limit, marker, end_marker, prefix, delimiter, reverse=False)

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:
  • limit – maximum number of entries to get
  • marker – marker query
  • end_marker – end marker query
  • prefix – prefix query
  • delimiter – delimiter for query
  • reverse – reverse the result order.
Returns:

list of tuples of (name, object_count, bytes_used, 0)

make_tuple_for_pickle(record)
merge_items(item_list, source=None)

Merge items into the container table.

Parameters:
  • item_list – list of dictionaries of {‘name’, ‘put_timestamp’, ‘delete_timestamp’, ‘object_count’, ‘bytes_used’, ‘deleted’, ‘storage_policy_index’}
  • source – if defined, update incoming_sync with the source
put_container(name, put_timestamp, delete_timestamp, object_count, bytes_used, storage_policy_index)

Create a container with the given attributes.

Parameters:
  • name – name of the container to create
  • put_timestamp – put_timestamp of the container to create
  • delete_timestamp – delete_timestamp of the container to create
  • object_count – number of objects in the container
  • bytes_used – number of bytes used by the container
  • storage_policy_index – the storage policy for this container

Account Reaper

Account Server

Table Of Contents

Previous topic

Proxy

Next topic

Container

This Page