Some instances of ReadableFromDB
for reading
PCLT catalog and related objects from DB.
DBMS is PostgreSQL v8.4. Not earlier, since PCLT-DB relies on a feature that
appeared in PostgresSQL only in v8.4. - the WITH
clause for SELECT
query
(also WITH RECURSIVE
).
- newtype RawCatalogDataReadFromDBResult = RawCatalogDataReadFromDBResult (PCLT_RawCatalogData, [AddPCLT_toPCLT_Error])
- newtype CatalogReadFromDBResult = CatalogReadFromDBResult (PCLT_Catalog, [ErrorWithPCSCatalog ReadPCSCatalogError], [AddPCLT_toPCLT_Error])
- newtype CatalogNeedsToBeUpdated_DoesIt = CatalogNeedsToBeUpdated_DoesIt Bool
- data DropFlag_CatalogNeedsToBeUpdated_Error
- data AddressedDropFlag_CatalogNeedsToBeUpdated_Error = AddressedDropFlag_CatalogNeedsToBeUpdated_Error DropFlag_CatalogNeedsToBeUpdated_Error PCLT_CatalogID
- dropFlag_CatalogNeedsToBeUpdated :: Connection -> PCLT_CatalogID -> IO (Maybe AddressedDropFlag_CatalogNeedsToBeUpdated_Error)
- data CatalogUpdateFromDBErrors = CatalogUpdateFromDBErrors {}
- emptyCUE :: CatalogUpdateFromDBErrors -> Bool
- defaultCatalogUpdateFromDBErrors :: PCLT_CatalogID -> CatalogUpdateFromDBErrors
- cfhie2cue :: CatalogFromHSRTInitErrors -> CatalogUpdateFromDBErrors
- considerCatalogUpdate :: Connection -> PCLT_CatalogID -> IO (Maybe PCLT_Catalog, Maybe CatalogUpdateFromDBErrors)
Instances of ReadableFromDB
newtype RawCatalogDataReadFromDBResult Source
Container for data, that is read from DB, that goes on input to catalog formation routine.
newtype CatalogReadFromDBResult Source
Container for PCLT catalog, that is read from DB.
newtype CatalogNeedsToBeUpdated_DoesIt Source
Container for a flag, that is read from DB.
For each catalog in DB there is stored a special flag "catalog data or config changed". The flag gets raised by an army of triggers, that watches every table, and is thought to get dropped by a program, which uses DB catalog. Drop the flag right before catalog update from DB.
Unfortunately, the current implementation of this flagging system constraints the number of agents that update their catalogs from DB by only one (because, when agent updates it's catalog, it drops the flag, and other agents don't know that flag was risen, so they can't know if version of catalog in their operative memory is older then in DB or is it not).
But this limitation removal is planned as a first ToDo in the next version of PCLT-DB.
Drop flag "catalog data or config changed" in DB
data DropFlag_CatalogNeedsToBeUpdated_Error Source
Errors that may occur, when performing dropFlag_CatalogNeedsToBeUpdated
.
data AddressedDropFlag_CatalogNeedsToBeUpdated_Error Source
Wrapper around DropFlag_CatalogNeedsToBeUpdated_Error
,
added PCLT_CatalogID
, for which "drop flag" operation failed.
dropFlag_CatalogNeedsToBeUpdated :: Connection -> PCLT_CatalogID -> IO (Maybe AddressedDropFlag_CatalogNeedsToBeUpdated_Error)Source
Drop that flag in DB.
Consider catalog update
data CatalogUpdateFromDBErrors Source
The container for all types of errors that may result, when trying to update a catalog from DB.
emptyCUE :: CatalogUpdateFromDBErrors -> BoolSource
Checks if catalog is read without a single error.
defaultCatalogUpdateFromDBErrors :: PCLT_CatalogID -> CatalogUpdateFromDBErrorsSource
An empty form to be filled.
cfhie2cue :: CatalogFromHSRTInitErrors -> CatalogUpdateFromDBErrorsSource
There is a one way relation from
CatalogFromHSRTInitErrors
to CatalogUpdateFromDBErrors
. That's because subject operations are
similar it their abstractions.
considerCatalogUpdate :: Connection -> PCLT_CatalogID -> IO (Maybe PCLT_Catalog, Maybe CatalogUpdateFromDBErrors)Source
Check if the flag "catalog data or config changed" is up in DB. If so, drop it and try to read from DB