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

Class Store

source code

object --+
         |
        Store

A directory for storing implementations.

Instance Methods
 
__init__(self, dir, public=False)
Create a new Store.
source code
 
__str__(self)
str(x)
source code
str
lookup(self, digest) source code
str
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, dry_run=False) source code
 
add_dir_to_cache(self, required_digest, path, try_helper=False, dry_run=False)
Copy the contents of path to the cache.
source code
 
check_manifest_and_rename(self, required_digest, tmp, extract=None, try_helper=False, dry_run=False)
Check that tmp[/extract] has the required_digest.
source code
 
__repr__(self)
repr(x)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties

Inherited from object: __class__

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
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

lookup(self, digest)

source code 
Parameters:
  • digest (str)
Returns: str

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.

Parameters:
  • required_digest (str)
Returns: str
Raises:

add_archive_to_cache(self, required_digest, data, url, extract=None, type=None, start_offset=0, try_helper=False, dry_run=False)

source code 
Parameters:
  • dry_run (bool)
  • url (str)
  • required_digest (str)
  • start_offset (int)
  • data (file)
  • type (str | None)
  • try_helper (bool)
  • extract (str | None)

add_dir_to_cache(self, required_digest, path, try_helper=False, dry_run=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)
  • dry_run (bool)
Raises:
  • BadDigest - if the contents don't match the given digest.

check_manifest_and_rename(self, required_digest, tmp, extract=None, try_helper=False, dry_run=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)
  • dry_run (bool) - just print what we would do to stdout (and delete tmp)
  • tmp (str)
  • required_digest (str)
  • extract (str | None)
Raises:
  • BadDigest - if the input directory doesn't match the given digest

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)