LSSTApplications  18.1.0
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | List of all members
lsst.daf.persistence.access.Access Class Reference
Inheritance diagram for lsst.daf.persistence.access.Access:

Public Member Functions

def cfg (cls, storageCfg)
 
def __init__ (self, cfg)
 
def __repr__ (self)
 
def mapperClass (self)
 
def root (self)
 
def locationWithRoot (self, location)
 
def setCfg (self, repoCfg)
 
def loadCfg (self)
 
def write (self, butlerLocation, obj)
 
def read (self, butlerLocation)
 
def exists (self, location)
 
def lookup (self, args, kwargs)
 

Public Attributes

 storage
 

Detailed Description

Implements an butler framework interface for Transport, Storage, and Registry

.. warning::

    Access is 'wet paint' and very likely to change. Use of it in production
    code other than via the 'old butler' API is strongly discouraged.

Definition at line 37 of file access.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.daf.persistence.access.Access.__init__ (   self,
  cfg 
)
Initializer

:param cfg: a Policy that defines the configuration for this class. It is recommended that the cfg be
    created by calling Access.cfg()
:return:

Definition at line 56 of file access.py.

56  def __init__(self, cfg):
57  """Initializer
58 
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()
61  :return:
62  """
63  self.storage = cfg['storageCfg.cls'](cfg['storageCfg'])
64 
def __init__(self, minimum, dataRange, Q)

Member Function Documentation

◆ __repr__()

def lsst.daf.persistence.access.Access.__repr__ (   self)

Definition at line 65 of file access.py.

65  def __repr__(self):
66  return 'Access(storage=%s)' % self.storage
67 

◆ cfg()

def lsst.daf.persistence.access.Access.cfg (   cls,
  storageCfg 
)
Helper func to create a properly formatted Policy to configure an Access instance.

:param storageCfg: a cfg to instantiate a storage.
:return:

Definition at line 48 of file access.py.

48  def cfg(cls, storageCfg):
49  """Helper func to create a properly formatted Policy to configure an Access instance.
50 
51  :param storageCfg: a cfg to instantiate a storage.
52  :return:
53  """
54  return AccessCfg(cls=cls, storageCfg=storageCfg)
55 

◆ exists()

def lsst.daf.persistence.access.Access.exists (   self,
  location 
)
Query if a location exists.

As of this writing the only storage type is PosixStorage, and it works to say that 'location' is a
simple locaiton descriptor. In the case of PosixStorage that's a path. If this needs to become more
complex it could be changed to be a butlerLocation, or something else, as needed.
:param location: a simple location descriptor, type is dependent on Storage.
:return: True if location exists, else False.

Definition at line 126 of file access.py.

126  def exists(self, location):
127  """Query if a location exists.
128 
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.
134  """
135  return self.storage.exists(location)
136 

◆ loadCfg()

def lsst.daf.persistence.access.Access.loadCfg (   self)
Reads the repository configuration from Storage.

:return: the Policy cfg

Definition at line 102 of file access.py.

102  def loadCfg(self):
103  """Reads the repository configuration from Storage.
104 
105  :return: the Policy cfg
106  """
107  return self.storage.loadCfg()
108 

◆ locationWithRoot()

def lsst.daf.persistence.access.Access.locationWithRoot (   self,
  location 
)
Given a location, get a fully qualified handle to location including storage root.

Note; at the time of this writing the only existing storage type is PosixStorage. This returns the
root+location.
:param location:
:return:

Definition at line 84 of file access.py.

84  def locationWithRoot(self, location):
85  """Given a location, get a fully qualified handle to location including storage root.
86 
87  Note; at the time of this writing the only existing storage type is PosixStorage. This returns the
88  root+location.
89  :param location:
90  :return:
91  """
92  return self.storage.locationWithRoot(location)
93 

◆ lookup()

def lsst.daf.persistence.access.Access.lookup (   self,
  args,
  kwargs 
)
Perform a lookup in the registry.

Returns a list of dataId for each valid lookup (right? TODO VERIFY)

Definition at line 137 of file access.py.

137  def lookup(self, *args, **kwargs):
138  """Perform a lookup in the registry.
139 
140  Returns a list of dataId for each valid lookup (right? TODO VERIFY)"""
141  return self.storage.lookup(*args, **kwargs)
142 

◆ mapperClass()

def lsst.daf.persistence.access.Access.mapperClass (   self)
Get the mapper class associated with a repository root.

:return: the mapper class

Definition at line 68 of file access.py.

68  def mapperClass(self):
69  """Get the mapper class associated with a repository root.
70 
71  :return: the mapper class
72  """
73  return self.storage.mapperClass()
74 

◆ read()

def lsst.daf.persistence.access.Access.read (   self,
  butlerLocation 
)
Reads an object from storage

:param butlerLocation: describes the location & how to load the object.
:return:

Definition at line 118 of file access.py.

118  def read(self, butlerLocation):
119  """Reads an object from storage
120 
121  :param butlerLocation: describes the location & how to load the object.
122  :return:
123  """
124  return self.storage.read(butlerLocation=butlerLocation)
125 

◆ root()

def lsst.daf.persistence.access.Access.root (   self)
Get the repository root as defined by the Storage class, this refers to the 'top' of a persisted
repository. The exact type of Root can vary based on Storage type.

:return: the root of the persisted repository.

Definition at line 75 of file access.py.

75  def root(self):
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.
78 
79  :return: the root of the persisted repository.
80  """
81 
82  return self.storage.root
83 

◆ setCfg()

def lsst.daf.persistence.access.Access.setCfg (   self,
  repoCfg 
)
Writes the repository configuration to Storage.

:param repoCfg: the Policy cfg to be written
:return: None

Definition at line 94 of file access.py.

94  def setCfg(self, repoCfg):
95  """Writes the repository configuration to Storage.
96 
97  :param repoCfg: the Policy cfg to be written
98  :return: None
99  """
100  self.storage.setCfg(repoCfg)
101 

◆ write()

def lsst.daf.persistence.access.Access.write (   self,
  butlerLocation,
  obj 
)
Passes an object to Storage to be written into the repository.

:param butlerLocation: the location & formatting for the object to be written.
:param obj: the object to be written.
:return: None

Definition at line 109 of file access.py.

109  def write(self, butlerLocation, obj):
110  """Passes an object to Storage to be written into the repository.
111 
112  :param butlerLocation: the location & formatting for the object to be written.
113  :param obj: the object to be written.
114  :return: None
115  """
116  self.storage.write(butlerLocation, obj)
117 

Member Data Documentation

◆ storage

lsst.daf.persistence.access.Access.storage

Definition at line 63 of file access.py.


The documentation for this class was generated from the following file: