Table Of Contents

Previous topic

Account DB and Container DB

Next topic

Misc

This Page

Object

Object Server

Object Server for Swift

class swift.obj.server.ObjectController(conf)

Bases: object

Implements the WSGI application for the Swift Object Server.

DELETE(*a, **kw)

Handle HTTP DELETE requests for the Swift Object Server.

GET(*a, **kw)

Handle HTTP GET requests for the Swift Object Server.

HEAD(*a, **kw)

Handle HTTP HEAD requests for the Swift Object Server.

POST(*a, **kw)

Handle HTTP POST requests for the Swift Object Server.

PUT(*a, **kw)

Handle HTTP PUT requests for the Swift Object Server.

REPLICATE(*a, **kw)

Handle REPLICATE requests for the Swift Object Server. This is used by the object replicator to get hashes for directories.

async_update(op, account, container, obj, host, partition, contdevice, headers_out, objdevice)

Sends or saves an async update.

Parameters:
  • op – operation performed (ex: ‘PUT’, or ‘DELETE’)
  • account – account name for the object
  • container – container name for the object
  • obj – object name
  • host – host that the container is on
  • partition – partition that the container is on
  • contdevice – device name that the container is on
  • headers_out – dictionary of headers to send in the container request
  • objdevice – device name that the object is in
container_update(op, account, container, obj, request, headers_out, objdevice)

Update the container when objects are updated.

Parameters:
  • op – operation performed (ex: ‘PUT’, or ‘DELETE’)
  • account – account name for the object
  • container – container name for the object
  • obj – object name
  • request – the original request object driving the update
  • headers_out – dictionary of headers to send in the container request(s)
  • objdevice – device name that the object is in
delete_at_update(op, delete_at, account, container, obj, request, objdevice)

Update the expiring objects container when objects are updated.

Parameters:
  • op – operation performed (ex: ‘PUT’, or ‘DELETE’)
  • delete_at – scheduled delete in UNIX seconds, int
  • account – account name for the object
  • container – container name for the object
  • obj – object name
  • request – the original request driving the update
  • objdevice – device name that the object is in
swift.obj.server.app_factory(global_conf, **local_conf)

paste.deploy app factory for creating WSGI object server apps

Object Replicator

class swift.obj.replicator.ObjectReplicator(conf)

Bases: swift.common.daemon.Daemon

Replicate objects.

Encapsulates most logic and data needed by the object replication process. Each call to .replicate() performs one replication pass. It’s up to the caller to do this in a loop.

check_ring()

Check to see if the ring has been updated

Returns:boolean indicating whether or not the ring has changed
collect_jobs()

Returns a sorted list of jobs (dictionaries) that specify the partitions, nodes, etc to be rsynced.

detect_lockups()

In testing, the pool.waitall() call very occasionally failed to return. This is an attempt to make sure the replicator finishes its replication pass in some eventuality.

heartbeat()

Loop that runs in the background during replication. It periodically logs progress.

kill_coros()

Utility function that kills all coroutines currently running.

replicate(override_devices=None, override_partitions=None)

Run a replication pass

rsync(node, job, suffixes)

Synchronize local suffix directories from a partition with a remote node.

Parameters:
  • node – the “dev” entry for the remote node to sync with
  • job – information about the partition being synced
  • suffixes – a list of suffixes which need to be pushed
Returns:

boolean indicating success or failure

run_forever(*args, **kwargs)
run_once(*args, **kwargs)
stats_line()

Logs various stats for the currently running replication pass.

update(job)

High-level method that replicates a single partition.

Parameters:job – a dict containing info about the partition to be replicated
update_deleted(job)

High-level method that replicates a single partition that doesn’t belong on this node.

Parameters:job – a dict containing info about the partition to be replicated

Object Updater

class swift.obj.updater.ObjectUpdater(conf)

Bases: swift.common.daemon.Daemon

Update object information in container listings.

get_container_ring()

Get the container ring. Load it, if it hasn’t been yet.

object_sweep(device)

If there are async pendings on the device, walk each one and update.

Parameters:device – path to device
object_update(node, part, op, obj, headers)

Perform the object update to the container

Parameters:
  • node – node dictionary from the container ring
  • part – partition that holds the container
  • op – operation performed (ex: ‘POST’ or ‘DELETE’)
  • obj – object name being updated
  • headers – headers to send with the update
process_object_update(update_path, device)

Process the object information to be updated and update.

Parameters:
  • update_path – path to pickled object update file
  • device – path to device
run_forever(*args, **kwargs)

Run the updater continuously.

run_once(*args, **kwargs)

Run the updater once.

swift.obj.updater.random() → x in the interval [0, 1).

Object Auditor

class swift.obj.auditor.AuditorWorker(conf, logger, zero_byte_only_at_fps=0)

Bases: object

Walk through file system to audit object

audit_all_objects(mode='once')
failsafe_object_audit(path, device, partition)

Entrypoint to object_audit, with a failsafe generic exception handler.

object_audit(path, device, partition)

Audits the given object path.

Parameters:
  • path – a path to an object
  • device – the device the path is on
  • partition – the partition the path is on
record_stats(obj_size)

Based on config’s object_size_stats will keep track of how many objects fall into the specified ranges. For example with the following:

object_size_stats = 10, 100, 1024

and your system has 3 objects of sizes: 5, 20, and 10000 bytes the log will look like: {“10”: 1, “100”: 1, “1024”: 0, “OVER”: 1}

class swift.obj.auditor.ObjectAuditor(conf, **options)

Bases: swift.common.daemon.Daemon

Audit objects.

run_forever(*args, **kwargs)

Run the object audit until stopped.

run_once(*args, **kwargs)

Run the object audit once.