| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Network.LibP2P.DHT.Types
Description
Core types for the Kademlia DHT.
Defines the DHT keyspace (256-bit SHA-256 keys), routing table entry structure, and protocol constants (k=20, alpha=10).
Synopsis
- newtype DHTKey = DHTKey ByteString
- data BucketEntry = BucketEntry {
- entryPeerId :: !PeerId
- entryKey :: !DHTKey
- entryAddrs :: ![Multiaddr]
- entryLastSeen :: !UTCTime
- entryConnType :: !ConnectionType
- data ConnectionType
- data InsertResult
- = Inserted
- | Updated
- | BucketFull !PeerId
- kValue :: Int
- alphaValue :: Int
- numBuckets :: Int
Documentation
256-bit key in the DHT keyspace (always exactly 32 bytes, SHA-256 output).
Constructors
| DHTKey ByteString |
data BucketEntry Source #
A single entry in a k-bucket.
Constructors
| BucketEntry | |
Fields
| |
Instances
| Show BucketEntry Source # | |
Defined in Network.LibP2P.DHT.Types Methods showsPrec :: Int -> BucketEntry -> ShowS # show :: BucketEntry -> String # showList :: [BucketEntry] -> ShowS # | |
| Eq BucketEntry Source # | |
Defined in Network.LibP2P.DHT.Types | |
data ConnectionType Source #
Connection status of a peer (from DHT protobuf spec).
Constructors
| NotConnected | 0: no connection, no extra info |
| Connected | 1: live connection |
| CanConnect | 2: recently connected |
| CannotConnect | 3: recently failed to connect |
Instances
| Bounded ConnectionType Source # | |
Defined in Network.LibP2P.DHT.Types | |
| Enum ConnectionType Source # | |
Defined in Network.LibP2P.DHT.Types Methods succ :: ConnectionType -> ConnectionType # pred :: ConnectionType -> ConnectionType # toEnum :: Int -> ConnectionType # fromEnum :: ConnectionType -> Int # enumFrom :: ConnectionType -> [ConnectionType] # enumFromThen :: ConnectionType -> ConnectionType -> [ConnectionType] # enumFromTo :: ConnectionType -> ConnectionType -> [ConnectionType] # enumFromThenTo :: ConnectionType -> ConnectionType -> ConnectionType -> [ConnectionType] # | |
| Show ConnectionType Source # | |
Defined in Network.LibP2P.DHT.Types Methods showsPrec :: Int -> ConnectionType -> ShowS # show :: ConnectionType -> String # showList :: [ConnectionType] -> ShowS # | |
| Eq ConnectionType Source # | |
Defined in Network.LibP2P.DHT.Types Methods (==) :: ConnectionType -> ConnectionType -> Bool # (/=) :: ConnectionType -> ConnectionType -> Bool # | |
data InsertResult Source #
Result of attempting to insert a peer into the routing table.
Constructors
| Inserted | Peer was added to the bucket |
| Updated | Existing peer was moved to tail (most recently seen) |
| BucketFull !PeerId | Bucket is full; returns LRS peer ID for pinging |
Instances
| Show InsertResult Source # | |
Defined in Network.LibP2P.DHT.Types Methods showsPrec :: Int -> InsertResult -> ShowS # show :: InsertResult -> String # showList :: [InsertResult] -> ShowS # | |
| Eq InsertResult Source # | |
Defined in Network.LibP2P.DHT.Types | |
alphaValue :: Int Source #
Concurrency parameter for iterative lookups.
numBuckets :: Int Source #
Number of buckets (one per bit of the 256-bit keyspace).