Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Marconi.Core.Indexer.SQLiteAggregateQuery
Description
A SQLiteAggregateQuery
provides a way to query the content of several SQLiteIndexer
s
as if they were a single indexer.
Note that SQLiteAggregateQuery doesn't implement
IsIndex@: it won't index anything,
and won't pass any information to the indexers it relies on.
It's sole purpose is to provide a unified access for queries.
Synopsis
- mkSQLiteAggregateQuery :: Map String (SQLiteSourceProvider m point) -> IO (SQLiteAggregateQuery m point event)
- data SQLiteSourceProvider m point = forall indexer event.(IsSourceProvider m event indexer, Point event ~ point) => SQLiteSourceProvider (MVar (indexer event))
- type IsSourceProvider m event indexer = (IsSync m event indexer, HasDatabasePath indexer)
- data SQLiteAggregateQuery m point event = SQLiteAggregateQuery {
- _databases :: [SQLiteSourceProvider m point]
- _aggregateConnection :: Pool Connection
- aggregateConnection :: Lens' (SQLiteAggregateQuery m point event) (Pool Connection)
- withResource :: Pool a -> (a -> IO r) -> IO r
- class HasDatabasePath indexer where
- getDatabasePath :: indexer event -> SQLiteDBLocation
Documentation
Arguments
:: Map String (SQLiteSourceProvider m point) | A map of indexers. The keys are used as an alias int the attach statement |
-> IO (SQLiteAggregateQuery m point event) |
Build a SQLiteSourceProvider
from a map that attaches
each database of the provided sources to the corresponding alias
data SQLiteSourceProvider m point #
A wrapper around indexers.
Its purpose is mainly to allow the use of a heterogenerous lists of indexers as a source for a
SQLiteAggregateQuery
.
Constructors
forall indexer event.(IsSourceProvider m event indexer, Point event ~ point) => SQLiteSourceProvider (MVar (indexer event)) |
type IsSourceProvider m event indexer = (IsSync m event indexer, HasDatabasePath indexer) #
Alias to gather typeclasses required to be a source provider
data SQLiteAggregateQuery m point event #
An aggregation of SQLite indexers used to build query across indexers.
Constructors
SQLiteAggregateQuery | |
Fields
|
Instances
(MonadIO m, Ord point, point ~ Point event) => IsSync m event (SQLiteAggregateQuery m point) # | |
Defined in Marconi.Core.Indexer.SQLiteAggregateQuery Methods lastStablePoint :: SQLiteAggregateQuery m point event -> m (Point event) # lastSyncPoint :: SQLiteAggregateQuery m point event -> m (Point event) # | |
MonadIO m => Closeable m (SQLiteAggregateQuery m point) # | |
Defined in Marconi.Core.Indexer.SQLiteAggregateQuery Methods close :: SQLiteAggregateQuery m point event -> m () # | |
(MonadIO m, MonadTrans t, Monad (t m), Ord point, point ~ Point event) => IsSync (t m) event (SQLiteAggregateQuery m point) # | |
Defined in Marconi.Core.Indexer.SQLiteAggregateQuery Methods lastStablePoint :: SQLiteAggregateQuery m point event -> t m (Point event) # lastSyncPoint :: SQLiteAggregateQuery m point event -> t m (Point event) # |
aggregateConnection :: Lens' (SQLiteAggregateQuery m point event) (Pool Connection) #
The connection that provides a read access accross the different databases
withResource :: Pool a -> (a -> IO r) -> IO r #
class HasDatabasePath indexer where #
A class for indexer that has access to a SQLite database and know the path to this database
Methods
getDatabasePath :: indexer event -> SQLiteDBLocation #
Retrieve the database path from the indexer