lsst.daf.persistence  13.0-11-gfc17871
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
lsst.daf.persistence.posixStorage.PosixStorage Class Reference
Inheritance diagram for lsst.daf.persistence.posixStorage.PosixStorage:
lsst::daf::persistence::Storage

Public Member Functions

def __init__
 
def __repr__
 
def write
 
def read
 
def butlerLocationExists
 
def exists
 
def locationWithRoot
 
def copyFile
 
def getLocalFile
 
def instanceSearch
 
- Public Member Functions inherited from lsst::daf::persistence::Storage
virtual ~Storage (void)
 Minimal destructor. More...
 
virtual void setPolicy (lsst::pex::policy::Policy::Ptr policy)=0
 Allow a Policy to be used to configure the Storage. More...
 
virtual void setPersistLocation (LogicalLocation const &location)=0
 Set the destination for persistence. More...
 
virtual void setRetrieveLocation (LogicalLocation const &location)=0
 Set the source for retrieval. More...
 
virtual void startTransaction (void)=0
 Begin an atomic transaction. More...
 
virtual void endTransaction (void)=0
 End an atomic transaction. More...
 

Static Public Member Functions

def relativePath
 
def absolutePath
 
def getRepositoryCfg
 
def putRepositoryCfg
 
def getMapperClass
 
def getParentSymlinkPath
 
def v1RepoExists
 
def search
 
def storageExists
 
- Static Public Member Functions inherited from lsst::daf::persistence::Storage
static Ptr createInstance (std::string const &name, LogicalLocation const &location, bool persist, lsst::pex::policy::Policy::Ptr policy)
 Create and configure a Storage subclass instance. More...
 

Public Attributes

 log
 
 root
 
 persistence
 

Additional Inherited Members

- Public Types inherited from lsst::daf::persistence::Storage
typedef std::shared_ptr< StoragePtr
 
typedef std::vector< PtrList
 
- Protected Member Functions inherited from lsst::daf::persistence::Storage
 Storage (std::type_info const &type)
 Constructor. More...
 
void verifyPathName (std::string const &pathName)
 Ensure that all directories along a path exist, creating them if necessary. More...
 

Detailed Description

Definition at line 45 of file posixStorage.py.

Constructor & Destructor Documentation

def lsst.daf.persistence.posixStorage.PosixStorage.__init__ (   self,
  uri 
)
Initializer

:return:

Definition at line 47 of file posixStorage.py.

Member Function Documentation

def lsst.daf.persistence.posixStorage.PosixStorage.__repr__ (   self)

Definition at line 61 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.absolutePath (   fromPath,
  relativePath 
)
static
Get an absolute path for the path from fromUri to toUri

Parameters
----------
fromPath : the starting location
    A location at which to start. It can be a relative path or an
    absolute path.
relativePath : the location relative to fromPath
    A relative path.

Returns
-------
string
    Path that is an absolute path representation of fromPath +
    relativePath, if one exists. If relativePath is absolute or if
    fromPath is not related to relativePath then relativePath will be
    returned.

Definition at line 90 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.butlerLocationExists (   self,
  location 
)
Implementaion of PosixStorage.exists for ButlerLocation objects.

Definition at line 413 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.copyFile (   self,
  fromLocation,
  toLocation 
)
Copy a file from one location to another on the local filesystem.

Parameters
----------
fromLocation : path
    Path and name of existing file.
 toLocation : path
    Path and name of new file.

Returns
-------
None

Definition at line 474 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.exists (   self,
  location 
)
Check if location exists.

Parameters
----------
location : ButlerLocation or string
    A a string or a ButlerLocation that describes the location of an
    object in this storage.

Returns
-------
bool
    True if exists, else False.

Definition at line 427 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.getLocalFile (   self,
  path 
)
Get the path to a local copy of the file, downloading it to a
temporary if needed.

Parameters
----------
A path the the file in storage, relative to root.

Returns
-------
A path to a local copy of the file. May be the original file (if
storage is local).

Definition at line 490 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.getMapperClass (   root)
static
Get the mapper class associated with a repository root.

Supports the legacy _parent symlink search (which was only ever posix-only. This should not be used by
new code and repositories; they should use the Repository parentCfg mechanism.

Parameters
----------
root : string
    The location of a persisted ReositoryCfg is (new style repos), or
    the location where a _mapper file is (old style repos).

Returns
-------
A class object or a class instance, depending on the state of the
mapper when the repository was created.

Definition at line 192 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.getParentSymlinkPath (   root)
static
For Butler V1 Repositories only, if a _parent symlink exists, get the location pointed to by the
symlink.

Parameters
----------
root : string
    A path to the folder on the local filesystem.

Returns
-------
string or None
    A path to the parent folder indicated by the _parent symlink, or None if there is no _parent
    symlink at root.

Definition at line 243 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.getRepositoryCfg (   uri)
static
Get a persisted RepositoryCfg

Parameters
----------
uri : URI or path to a RepositoryCfg
    Description

Returns
-------
A RepositoryCfg instance or None

Definition at line 138 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.instanceSearch (   self,
  path 
)
Search for the given path in this storage instance.

If the path contains an HDU indicator (a number in brackets before the
dot, e.g. 'foo.fits[1]', this will be stripped when searching and so
will match filenames without the HDU indicator, e.g. 'foo.fits'. The
path returned WILL contain the indicator though, e.g. ['foo.fits[1]'].

Parameters
----------
path : string
    A filename (and optionally prefix path) to search for within root.

Returns
-------
string or None
    The location that was found, or None if no location was found.

Definition at line 509 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.locationWithRoot (   self,
  location 
)
Get the full path to the location.

:param location:
:return:

Definition at line 447 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.putRepositoryCfg (   cfg,
  loc = None 
)
static
Serialize a RepositoryCfg to a location.

When loc == cfg.root, the RepositoryCfg is to be writtenat the root
location of the repository. In that case, root is not written, it is
implicit in the location of the cfg. This allows the cfg to move from
machine to machine without modification.

Parameters
----------
cfg : RepositoryCfg instance
    The RepositoryCfg to be serailized.
loc : None, optional
    The location to write the RepositoryCfg. If loc is None, the
    location will be read from the root parameter of loc.

Returns
-------
None

Definition at line 157 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.read (   self,
  butlerLocation 
)
Read from a butlerLocation.

Parameters
----------
butlerLocation : ButlerLocation
    The location & formatting for the object(s) to be read.

Returns
-------
A list of objects as described by the butler location. One item for
each location in butlerLocation.getLocations()

Definition at line 336 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.relativePath (   fromPath,
  toPath 
)
static
Get a relative path from a location to a location.

Parameters
----------
fromPath : string
    A path at which to start. It can be a relative path or an
    absolute path.
toPath : string
    A target location. It can be a relative path or an absolute path.

Returns
-------
string
    A relative path that describes the path from fromPath to toPath.

Definition at line 70 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.search (   root,
  path,
  searchParents = False 
)
static
Look for the given path in the current root.

Also supports searching for the path in Butler v1 repositories by
following the Butler v1 _parent symlink

If the path contains an HDU indicator (a number in brackets, e.g.
'foo.fits[1]', this will be stripped when searching and so
will match filenames without the HDU indicator, e.g. 'foo.fits'. The
path returned WILL contain the indicator though, e.g. ['foo.fits[1]'].

Parameters
----------
root : string
    The path to the root directory.
path : string
    The path to the file within the root directory.
searchParents : bool, optional
    For Butler v1 repositories only, if true and a _parent symlink
    exists, then the directory at _parent will be searched if the file
    is not found in the root repository. Will continue searching the
    parent of the parent until the file is found or no additional
    parent exists.

Returns
-------
string or None
    The location that was found, or None if no location was found.

Definition at line 530 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.storageExists (   uri)
static
Ask if a storage at the location described by uri exists

Parameters
----------
root : string
    URI to the the root location of the storage

Returns
-------
bool
    True if the storage exists, false if not

Definition at line 611 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.v1RepoExists (   root)
static
Test if a Version 1 Repository exists.

Version 1 Repositories only exist in posix storages and do not have a RepositoryCfg file.
To "exist" the folder at root must exist and contain files or folders.

Parameters
----------
root : string
    A path to a folder on the local filesystem.

Returns
-------
bool
    True if the repository at root exists, else False.

Definition at line 456 of file posixStorage.py.

def lsst.daf.persistence.posixStorage.PosixStorage.write (   self,
  butlerLocation,
  obj 
)
Writes an object to a location and persistence format specified by
ButlerLocation

Parameters
----------
butlerLocation : ButlerLocation
    The location & formatting for the object to be written.
obj : object instance
    The object to be written.

Definition at line 268 of file posixStorage.py.

Member Data Documentation

lsst.daf.persistence.posixStorage.PosixStorage.log

Definition at line 52 of file posixStorage.py.

lsst.daf.persistence.posixStorage.PosixStorage.persistence

Definition at line 59 of file posixStorage.py.

lsst.daf.persistence.posixStorage.PosixStorage.root

Definition at line 53 of file posixStorage.py.


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