Peragro-AT
 All Classes Namespaces Functions Pages
Functions | Variables
damn_at.bld Namespace Reference

Functions

def block_hashes_for_file
 
def block_hashes_from_file
 
def block_hashes_to_file
 
def hash_to_dir
 
def blocks_for_file
 
def blocks_to_file
 
def filter_existing_block_hashes
 
def walk
 
def statistics
 
def verify
 

Variables

int BLOCK_SIZE = 2048
 
tuple test_files_dir
 
tuple file_hash = calculate_hash_for_file(path)
 
tuple block_hashes
 
string new_path = '/tmp/out/'
 
tuple new_file_hash = calculate_hash_for_file(new_path)
 

Detailed Description

Block-level deplucation utility functions.

Function Documentation

def damn_at.bld.block_hashes_for_file (   an_uri)
Calculate the hash for each block in the given file
as well as the hash for the entire file and return it.
:param an_uri: the URI pointing to the file
:rtype: string, list<string>

Here is the caller graph for this function:

def damn_at.bld.block_hashes_from_file (   an_uri)
Deserialize the saved block hashes from the given file.
:param an_uri: the URI pointing to the file
:rtype: list<string>

Here is the caller graph for this function:

def damn_at.bld.block_hashes_to_file (   file_hash,
  block_hashes,
  an_uri 
)
Serialize the given block hashes to the given uri destination.
:param file_hash: the complete file's hash
:param block_hashes: a list of block hashes to serialize
:param an_uri: the file path which to save to
:rtype: list<string>

Here is the caller graph for this function:

def damn_at.bld.blocks_for_file (   an_uri,
  destination 
)
Write all blocks for the given file to the destination.
:param an_uri: the URI pointing to the file to split
:param destination: the destination directory for the block files
:rtype: list<string> the paths to the written blocks

Here is the call graph for this function:

Here is the caller graph for this function:

def damn_at.bld.blocks_to_file (   an_uri,
  block_hashes,
  destination 
)
Combine the referenced blocks into a given destination file.
:param an_uri: the directory containing the blocks
:param block_hashes: a list of block hashes
:param destination: the destination file path

Here is the call graph for this function:

Here is the caller graph for this function:

def damn_at.bld.filter_existing_block_hashes (   an_uri,
  block_hashes 
)
Check the given uri if it contains the given
blocks and filter out the existing.
:param an_uri: the directory containing the blocks
:param block_hashes: the list of block hashes to check for existence
:rtype: list<string> a list of block hashes that do not exist

Here is the call graph for this function:

def damn_at.bld.hash_to_dir (   hash)
Transforms a given hash to a relative path and filename
ex: '002badb952000339cdcf1b61a3205b221766bf49' ->
    '00/2badb952000339cdcf1b61a3205b221766bf49'
:param hash: the hash to split
:rtype: string

Here is the caller graph for this function:

Variable Documentation

list damn_at.bld.block_hashes
Initial value:
1 = block_hashes_from_file('/tmp/files/' +
2  hash_to_dir(file_hash))
def block_hashes_from_file
Definition: bld.py:42
def hash_to_dir
Definition: bld.py:70
tuple damn_at.bld.test_files_dir
Initial value:
1 = os.path.join(os.path.dirname(__file__),
2  '../../../peragro-test-files')