Package zeroinstall :: Package zerostore :: Class Store
[frames] | no frames]

Class Store

source code

A directory for storing implementations.

Instance Methods
 
__init__(self, dir, public=False)
Create a new Store.
source code
 
__str__(self) source code
 
lookup(self, digest) source code
 
get_tmp_dir_for(self, required_digest)
Create a temporary directory in the directory where we would store an implementation with the given digest.
source code
 
add_archive_to_cache(self, required_digest, data, url, extract=None, type=None, start_offset=0, try_helper=False) source code
 
add_dir_to_cache(self, required_digest, path, try_helper=False)
Copy the contents of path to the cache.
source code
 
check_manifest_and_rename(self, required_digest, tmp, extract=None, try_helper=False)
Check that tmp[/extract] has the required_digest.
source code
Method Details

__init__(self, dir, public=False)
(Constructor)

source code 

Create a new Store.

Parameters:
  • dir (str) - directory to contain the implementations
  • public (bool) - deprecated

get_tmp_dir_for(self, required_digest)

source code 

Create a temporary directory in the directory where we would store an implementation with the given digest. This is used to setup a new implementation before being renamed if it turns out OK.

Raises:

add_dir_to_cache(self, required_digest, path, try_helper=False)

source code 

Copy the contents of path to the cache.

Parameters:
  • required_digest (str) - the expected digest
  • path (str) - the root of the tree to copy
  • try_helper (bool) - attempt to use privileged helper before user cache (since 0.26)
Raises:
  • BadDigest - if the contents don't match the given digest.

check_manifest_and_rename(self, required_digest, tmp, extract=None, try_helper=False)

source code 

Check that tmp[/extract] has the required_digest. On success, rename the checked directory to the digest, and make the whole tree read-only.

Parameters:
  • try_helper (bool) - attempt to use privileged helper to import to system cache first (since 0.26)
Raises:
  • BadDigest - if the input directory doesn't match the given digest