Object Server for Swift
Bases: object
Manage object files on disk.
Parameters: |
|
---|
Returns an iterator over the data file for range (start, stop)
Close the file. Will handle quarantining file if necessary.
Parameters: | verify_file – Defaults to True. If false, will not check file to see if it needs quarantining. |
---|
Method for no-oping buffer cache drop method.
Returns the os.path.getsize for the file. Raises an exception if this file does not match the Content-Length stored in the metadata. Or if self.data_file does not exist.
Returns: | file size as an int |
---|---|
Raises: |
|
Check if the file is deleted.
Returns: | True if the file doesn’t exist or has been flagged as deleted. |
---|
Contextmanager to make a temporary file.
Finalize writing the file on disk, and renames it from the temp file to the real location. This should be called after the data has been written to the temp file.
Params fd: | file descriptor of the temp file |
---|---|
Parameters: |
|
In the case that a file is corrupted, move it to a quarantined area to allow replication to fix it.
Returns: | if quarantine is successful, path to quarantined directory otherwise None |
---|
Remove any older versions of the object file. Any file that has an older timestamp than timestamp will be deleted.
Parameters: | timestamp – timestamp to compare with each file |
---|
Bases: object
Implements the WSGI application for the Swift Object Server.
Handle HTTP DELETE requests for the Swift Object Server.
Handle HTTP GET requests for the Swift Object Server.
Handle HTTP HEAD requests for the Swift Object Server.
Handle HTTP POST requests for the Swift Object Server.
Handle HTTP PUT requests for the Swift Object Server.
Handle REPLICATE requests for the Swift Object Server. This is used by the object replicator to get hashes for directories.
Sends or saves an async update.
Parameters: |
|
---|
Update the container when objects are updated.
Parameters: |
|
---|
Update the expiring objects container when objects are updated.
Parameters: |
|
---|
paste.deploy app factory for creating WSGI object server apps
Helper function to read the pickled metadata from an object file.
Parameters: | fd – file descriptor to load the metadata from |
---|---|
Returns: | dictionary of metadata |
Helper function to write pickled metadata for an object file.
Parameters: |
|
---|
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 to see if the ring has been updated
Returns: | boolean indicating whether or not the ring has changed |
---|
Returns a sorted list of jobs (dictionaries) that specify the partitions, nodes, etc to be rsynced.
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.
Loop that runs in the background during replication. It periodically logs progress.
Utility function that kills all coroutines currently running.
Run a replication pass
Synchronize local suffix directories from a partition with a remote node.
Parameters: |
|
---|---|
Returns: | boolean indicating success or failure |
Logs various stats for the currently running replication pass.
High-level method that replicates a single partition.
Parameters: | job – a dict containing info about the partition to be replicated |
---|
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 |
---|
Get a list of hashes for the suffix dir. do_listdir causes it to mistrust the hash cache for suffix existence at the (unexpectedly high) cost of a listdir. reclaim_age is just passed on to hash_suffix.
Parameters: |
|
---|---|
Returns: | tuple of (number of suffix dirs hashed, dictionary of hashes) |
Performs reclamation and returns an md5 of all (remaining) files.
Parameters: | reclaim_age – age in seconds at which to remove tombstones |
---|
Invalidates the hash for a suffix_dir in the partition’s hashes file.
Parameters: | suffix_dir – absolute path to suffix dir whose hash needs invalidating |
---|
In the case that a file is corrupted, move it to a quarantined area to allow replication to fix it.
Params device_path: | |
---|---|
The path to the device the corrupted file is on. | |
Params corrupted_file_path: | |
The path to the file you want quarantined. | |
Returns: | path (str) of directory the file was moved to |
Raises OSError: | re-raises non errno.EEXIST / errno.ENOTEMPTY exceptions from rename |
Hack to work around Eventlet’s tpool not catching and reraising Timeouts.
Bases: swift.common.daemon.Daemon
Update object information in container listings.
Get the container ring. Load it, if it hasn’t been yet.
If there are async pendings on the device, walk each one and update.
Parameters: | device – path to device |
---|
Perform the object update to the container
Parameters: |
|
---|
Process the object information to be updated and update.
Parameters: |
|
---|
Run the updater continuously.
Run the updater once
Bases: object
Walk through file system to audit object
Audits the given object path.
Parameters: |
|
---|