Skip to content

Instantly share code, notes, and snippets.

@prashanthpai
Created October 6, 2014 21:06
Show Gist options
  • Save prashanthpai/def0b5c07a9da29f4ec1 to your computer and use it in GitHub Desktop.
Save prashanthpai/def0b5c07a9da29f4ec1 to your computer and use it in GitHub Desktop.
swift object name mapping to on-disk file path

Calculating object hash:

>>> from swift.common.utils import hash_path
>>> print hash_path("AUTH_abc/c1/o4")
c2b307d78b6c419c0c1b76d91c08c69f

The corresponding on-disk object path derived from the above hash:

/mnt/sdb1/./3/node/sdb3/objects/778/69f/c2b307d78b6c419c0c1b76d91c08c69f/1412628708.01757.data

The on-disk object path template:

/<device>/objects-<sp_index>/<partition-number>/<last-3-characters-of-hash>/<hash>/<timestamp>.data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment