ApdbReplica¶
- class lsst.dax.apdb.ApdbReplica¶
Bases:
ABC
Abstract interface for APDB replication methods.
Methods Summary
Return version number for current ApdbReplica implementation.
deleteReplicaChunks
(chunks)Remove replication chunks from the database.
from_config
(config)Create ApdbReplica instance from configuration object.
from_uri
(uri)Make ApdbReplica instance from a serialized configuration.
Return collection of replication chunks known to the database.
getTableDataChunks
(table, chunks)Return catalog of new records for a table from given replica chunks.
getTableUpdateChunks
(table, chunks)Return the list of record updates for a table from given replica chunks.
Return version number of the database schema.
Methods Documentation
- abstract classmethod apdbReplicaImplementationVersion() VersionTuple ¶
Return version number for current ApdbReplica implementation.
- Returns:
- version
VersionTuple
Version of the code defined in implementation class.
- version
- abstract deleteReplicaChunks(chunks: Iterable[int]) None ¶
Remove replication chunks from the database.
Notes
This method causes Apdb to forget about specified chunks. If there are any auxiliary data associated with the identifiers, it is also removed from database (but data in regular tables is not removed). This method should be called after successful transfer of data from APDB to PPDB to free space used by replicas.
- classmethod from_config(config: ApdbConfig) ApdbReplica ¶
Create ApdbReplica instance from configuration object.
- Parameters:
- config
ApdbConfig
Configuration object, type of this object determines type of the ApdbReplica implementation.
- config
- Returns:
- replica
ApdbReplica
Instance of
ApdbReplica
class.
- replica
- classmethod from_uri(uri: str | ParseResult | ResourcePath | Path) ApdbReplica ¶
Make ApdbReplica instance from a serialized configuration.
- Parameters:
- uri
ResourcePathExpression
URI or local file path pointing to a file with serialized configuration, or a string with a “label:” prefix. In the latter case, the configuration will be looked up from an APDB index file using the label name that follows the prefix. The APDB index file’s location is determined by the
DAX_APDB_INDEX_URI
environment variable.
- uri
- Returns:
- replica
ApdbReplica
Instance of
ApdbReplica
class, the type of the returned instance is determined by configuration.
- replica
- abstract getReplicaChunks() list[lsst.dax.apdb.apdbReplica.ReplicaChunk] | None ¶
Return collection of replication chunks known to the database.
- Returns:
- chunks
list
[ReplicaChunk
] orNone
List of chunks, they may be time-ordered if database supports ordering.
None
is returned if database is not configured for replication.
- chunks
- abstract getTableDataChunks(table: ApdbTables, chunks: Iterable[int]) ApdbTableData ¶
Return catalog of new records for a table from given replica chunks.
- Parameters:
- table
ApdbTables
Table for which to return the data. Acceptable tables are
ApdbTables.DiaObject
,ApdbTables.DiaSource
, andApdbTables.DiaForcedSource
.- chunks
Iterable
[int
] Chunk identifiers to return.
- table
- Returns:
- data
ApdbTableData
Catalog containing table records. In addition to all regular columns it will contain
apdb_replica_chunk
column.
- data
Notes
This method returns new records that have been added to the table by
Apdb.store()
method. Updates to the records that happen at later time are available fromgetTableUpdateChunks
method.This part of API may not be very stable and can change before the implementation finalizes.
- abstract getTableUpdateChunks(table: ApdbTables, chunks: Iterable[int]) ApdbTableData ¶
Return the list of record updates for a table from given replica chunks.
- Parameters:
- table
ApdbTables
Table for which to return the updates. Acceptable tables are
ApdbTables.DiaObject
,ApdbTables.DiaSource
, andApdbTables.DiaForcedSource
.- chunks
Iterable
[int
] Chunk identifiers to return.
- table
- Returns:
- data
ApdbTableData
Catalog containing table updates.
- data
This part of API may not be very stable and can change before the implementation finalizes.
- abstract schemaVersion() VersionTuple ¶
Return version number of the database schema.
- Returns:
- version
VersionTuple
Version of the database schema.
- version