Storages abstracts#
Storage abstraction include some methods to perform storage validation and collection.
- class diskette.core.storages.StorageMixin[source]#
Storage manager is in charge to collect storage file paths.
Note
self.storages_basepath
value determine if storages are valid (they must be a children of it) and how they will be stored in archive since they are made relative from thestorages_basepath
- validate_storages()[source]#
Validate every storage path defined from settings.
A storage path must be a Path object, exists on filesystem and must be a directory.
- Raises:
DumperError – In case of error with a storage path.
- Returns:
Returns True if all storage has been validated.
- Return type:
boolean
- class diskette.core.storages.StorageManager(storages_basepath=None, storages=None, storages_excludes=None, logger=None)[source]#
Concrete basic implementation for
StorageMixin
.- Keyword Arguments:
storages_basepath (Path) – Basepath for reference in some path resolution. Currently used by storage dump to make relative path for storage files. On default this is based on current working directory. If given, the storage paths must be in the same leaf else this will be an error.
storages (list) – A list of storage Path objects.
storages_excludes (list) – A list of patterns to exclude storage files from dump.
logger (object) – Instance of a logger object to use. Logger object must implement common logging message methods (like error, info, etc..). See
diskette.utils.loggers
for available loggers. If not given, a dummy logger will be used that ignores any messages and won’t output anything.