egse.persistence
cgse-common
This code is part of the cgse-common package.
egse.persistence
¶
Classes:
| Name | Description |
|---|---|
PersistenceLayer |
The Persistence Layer implements the CRUD paradigm for storing data. |
PersistenceLayer
¶
Bases: ABC
The Persistence Layer implements the CRUD paradigm for storing data.
Methods:
| Name | Description |
|---|---|
close |
Closes the resource. |
create |
Creates an entry in the persistence store. |
delete |
Deletes the entry for index |
exists |
Returns True if the resource exists, False otherwise. |
get_filepath |
If this persistence class is file based, return its file path, otherwise return None. |
open |
Opens the resource. |
read |
Returns a list of all entries in the persistence store. |
update |
Updates the entry for index |
Attributes:
| Name | Type | Description |
|---|---|---|
extension |
The file extension to use for this persistence type. |
extension
class-attribute
instance-attribute
¶
extension = 'no_ext'
The file extension to use for this persistence type.
get_filepath
abstractmethod
¶
get_filepath()
If this persistence class is file based, return its file path, otherwise return None.
read
abstractmethod
¶
read(select=None)
Returns a list of all entries in the persistence store.
The list can be filtered based on a selection from the select argument which
should be a Callable object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
select
|
Callable
|
a filter function to narrow down the list of all entries. |
None
|