23 from builtins
import object, super
31 yaml_tag =
u"!AccessCfg" 34 super().
__init__({
'storageCfg': storageCfg,
'cls': cls})
38 """Implements an butler framework interface for Transport, Storage, and Registry 42 Access is 'wet paint' and very likely to change. Use of it in production 43 code other than via the 'old butler' API is strongly discouraged. 48 def cfg(cls, storageCfg):
49 """Helper func to create a properly formatted Policy to configure an Access instance. 51 :param storageCfg: a cfg to instantiate a storage. 54 return AccessCfg(cls=cls, storageCfg=storageCfg)
59 :param cfg: a Policy that defines the configuration for this class. It is recommended that the cfg be 60 created by calling Access.cfg() 63 self.
storage = cfg[
'storageCfg.cls'](cfg[
'storageCfg'])
66 return 'Access(storage=%s)' % self.
storage 69 """Get the mapper class associated with a repository root. 71 :return: the mapper class 76 """Get the repository root as defined by the Storage class, this refers to the 'top' of a persisted 77 repository. The exact type of Root can vary based on Storage type. 79 :return: the root of the persisted repository. 85 """Given a location, get a fully qualified handle to location including storage root. 87 Note; at the time of this writing the only existing storage type is PosixStorage. This returns the 95 """Writes the repository configuration to Storage. 97 :param repoCfg: the Policy cfg to be written 103 """Reads the repository configuration from Storage. 105 :return: the Policy cfg 109 def write(self, butlerLocation, obj):
110 """Passes an object to Storage to be written into the repository. 112 :param butlerLocation: the location & formatting for the object to be written. 113 :param obj: the object to be written. 118 def read(self, butlerLocation):
119 """Reads an object from storage 121 :param butlerLocation: describes the location & how to load the object. 124 return self.
storage.
read(butlerLocation=butlerLocation)
127 """Query if a location exists. 129 As of this writing the only storage type is PosixStorage, and it works to say that 'location' is a 130 simple locaiton descriptor. In the case of PosixStorage that's a path. If this needs to become more 131 complex it could be changed to be a butlerLocation, or something else, as needed. 132 :param location: a simple location descriptor, type is dependent on Storage. 133 :return: True if location exists, else False. 138 """Perform a lookup in the registry. 140 Returns a list of dataId for each valid lookup (right? TODO VERIFY)"""
def exists(self, location)
def write(self, butlerLocation, obj)
def read(self, butlerLocation)
def lookup(self, args, kwargs)
def __init__(self, cls, storageCfg)
def locationWithRoot(self, location)
def setCfg(self, repoCfg)