mirror of https://github.com/waku-org/nwaku.git
Cleaning imports of the waku store module (#673)
* cleans up store modules * removes endians2 as an unused imports * reorganizes imports * fixes an ambiguous import * adds comments re imports order * adds message_store
This commit is contained in:
parent
4b9b654655
commit
32a8ffb867
|
@ -61,7 +61,7 @@ proc toWakuRelayMessage*(message: WakuMessage, symkey: Option[SymKey], privateKe
|
||||||
let
|
let
|
||||||
keyInfo = if symkey.isSome(): KeyInfo(kind: Symmetric, symKey: symkey.get())
|
keyInfo = if symkey.isSome(): KeyInfo(kind: Symmetric, symKey: symkey.get())
|
||||||
elif privateKey.isSome(): KeyInfo(kind: Asymmetric, privKey: privateKey.get())
|
elif privateKey.isSome(): KeyInfo(kind: Asymmetric, privKey: privateKey.get())
|
||||||
else: KeyInfo(kind: None)
|
else: KeyInfo(kind: KeyKind.None)
|
||||||
decoded = decodePayload(message, keyInfo)
|
decoded = decodePayload(message, keyInfo)
|
||||||
|
|
||||||
WakuRelayMessage(payload: decoded.get().payload,
|
WakuRelayMessage(payload: decoded.get().payload,
|
||||||
|
|
|
@ -4,21 +4,36 @@
|
||||||
|
|
||||||
{.push raises: [Defect].}
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
|
# Group by std, external then internal imports
|
||||||
import
|
import
|
||||||
|
# std imports
|
||||||
std/[tables, times, sequtils, algorithm, options],
|
std/[tables, times, sequtils, algorithm, options],
|
||||||
|
# external imports
|
||||||
bearssl,
|
bearssl,
|
||||||
chronos, chronicles, metrics, stew/[results, byteutils, endians2],
|
chronicles,
|
||||||
|
chronos,
|
||||||
libp2p/crypto/crypto,
|
libp2p/crypto/crypto,
|
||||||
libp2p/protocols/protocol,
|
libp2p/protocols/protocol,
|
||||||
libp2p/protobuf/minprotobuf,
|
libp2p/protobuf/minprotobuf,
|
||||||
libp2p/stream/connection,
|
libp2p/stream/connection,
|
||||||
|
metrics,
|
||||||
|
stew/[results, byteutils],
|
||||||
|
# internal imports
|
||||||
../../node/storage/message/message_store,
|
../../node/storage/message/message_store,
|
||||||
../waku_swap/waku_swap,
|
../../node/peer_manager/peer_manager,
|
||||||
./waku_store_types,
|
|
||||||
../../utils/requests,
|
../../utils/requests,
|
||||||
../../node/peer_manager/peer_manager
|
../waku_swap/waku_swap,
|
||||||
|
./waku_store_types
|
||||||
|
|
||||||
|
|
||||||
export waku_store_types, message_store
|
# export all modules whose types are used in public functions/types
|
||||||
|
export
|
||||||
|
options,
|
||||||
|
chronos,
|
||||||
|
bearssl,
|
||||||
|
minprotobuf,
|
||||||
|
peer_manager,
|
||||||
|
waku_store_types
|
||||||
|
|
||||||
declarePublicGauge waku_store_messages, "number of historical messages", ["type"]
|
declarePublicGauge waku_store_messages, "number of historical messages", ["type"]
|
||||||
declarePublicGauge waku_store_peers, "number of store peers"
|
declarePublicGauge waku_store_peers, "number of store peers"
|
||||||
|
|
|
@ -1,17 +1,28 @@
|
||||||
## Types for waku_store protocol.
|
## Types for waku_store protocol.
|
||||||
|
|
||||||
|
# Group by std, external then internal imports
|
||||||
import
|
import
|
||||||
|
# external imports
|
||||||
bearssl,
|
bearssl,
|
||||||
libp2p/peerinfo,
|
libp2p/peerinfo,
|
||||||
libp2p/protocols/protocol,
|
libp2p/protocols/protocol,
|
||||||
../waku_swap/waku_swap_types,
|
stew/results,
|
||||||
../waku_message,
|
# internal imports
|
||||||
../../node/storage/message/message_store,
|
../../node/storage/message/message_store,
|
||||||
../../utils/pagination,
|
../../utils/pagination,
|
||||||
../../node/peer_manager/peer_manager
|
../../node/peer_manager/peer_manager,
|
||||||
|
../waku_swap/waku_swap_types,
|
||||||
|
../waku_message
|
||||||
|
|
||||||
export waku_message
|
# export all modules whose types are used in public functions/types
|
||||||
export pagination
|
export
|
||||||
|
bearssl,
|
||||||
|
results,
|
||||||
|
peer_manager,
|
||||||
|
waku_swap_types,
|
||||||
|
message_store,
|
||||||
|
waku_message,
|
||||||
|
pagination
|
||||||
|
|
||||||
# Constants required for pagination -------------------------------------------
|
# Constants required for pagination -------------------------------------------
|
||||||
const MaxPageSize* = uint64(100) # Maximum number of waku messages in each page
|
const MaxPageSize* = uint64(100) # Maximum number of waku messages in each page
|
||||||
|
|
Loading…
Reference in New Issue