mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-07 08:23:08 +00:00
* feat(sqlite): parameterized prep statement exec
- from nim-eth
* feat(store): sql-only-store
- add getPage(...) to sql-message-store
- acts as separate store impl that can be activated with
`--sqlite-store=true`
* test(store): new test-suite for sql message store
* test(store): waku_store test SQL-store compatible
* perf(store): avoid builing an additional B-tree in sql query
- use `receiverTime` as the last ORDER BY column to fully utilize the
primary key sorting
feat(store): retention time
- retention time in seconds can be specified via `--sqlite-retention-time=`
28 lines
1.1 KiB
Nim
28 lines
1.1 KiB
Nim
{.push raises: [Defect].}
|
|
|
|
import
|
|
std/options,
|
|
stew/results,
|
|
../../../protocol/waku_message,
|
|
../../../protocol/waku_store/waku_store_types,
|
|
../../../utils/time,
|
|
../../../utils/pagination
|
|
|
|
## This module defines a message store interface. Implementations of
|
|
## MessageStore are used by the `WakuStore` protocol to store and
|
|
## retrieve historical messages
|
|
|
|
type
|
|
DataProc* = proc(receiverTimestamp: Timestamp, msg: WakuMessage, pubsubTopic: string) {.closure, raises: [Defect].}
|
|
|
|
MessageStoreResult*[T] = Result[T, string]
|
|
|
|
MessageStore* = ref object of RootObj
|
|
|
|
# MessageStore interface
|
|
method put*(db: MessageStore, cursor: Index, message: WakuMessage, pubsubTopic: string): MessageStoreResult[void] {.base.} = discard
|
|
method getAll*(db: MessageStore, onData: DataProc): MessageStoreResult[bool] {.base.} = discard
|
|
method getPage*(db: MessageStore, pred: QueryFilterMatcher, pagingInfo: PagingInfo): MessageStoreResult[(seq[WakuMessage], PagingInfo, HistoryResponseError)] {.base.} = discard
|
|
method getPage*(db: MessageStore, pagingInfo: PagingInfo): MessageStoreResult[(seq[WakuMessage], PagingInfo, HistoryResponseError)] {.base.} = discard
|
|
|