-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac0b55d
commit 4fdc6cf
Showing
3 changed files
with
212 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1 @@ | ||
package brdcst | ||
|
||
import ( | ||
"github.com/plprobelab/go-kademlia/kad" | ||
|
||
"github.com/libp2p/go-libp2p-kad-dht/v2/internal/coord/coordt" | ||
"github.com/libp2p/go-libp2p-kad-dht/v2/internal/coord/query" | ||
) | ||
|
||
// BroadcastState is the state of a bootstrap. | ||
type BroadcastState interface { | ||
broadcastState() | ||
} | ||
|
||
type StateBroadcastFindCloser[K kad.Key[K], N kad.NodeID[K]] struct { | ||
QueryID coordt.QueryID | ||
Target K // the key that the query wants to find closer nodes for | ||
NodeID N // the node to send the message to | ||
Stats query.QueryStats | ||
} | ||
|
||
type StateBroadcastStoreRecord[K kad.Key[K], N kad.NodeID[K], M coordt.Message] struct { | ||
QueryID coordt.QueryID | ||
NodeID N | ||
Message M | ||
} | ||
|
||
type StateBroadcastWaiting struct { | ||
QueryID coordt.QueryID | ||
} | ||
|
||
type StateBroadcastFinished[K kad.Key[K], N kad.NodeID[K]] struct { | ||
QueryID coordt.QueryID | ||
Contacted []N | ||
Errors map[string]struct { | ||
Node N | ||
Err error | ||
} | ||
} | ||
|
||
type StateBroadcastIdle struct{} | ||
|
||
func (*StateBroadcastFindCloser[K, N]) broadcastState() {} | ||
func (*StateBroadcastStoreRecord[K, N, M]) broadcastState() {} | ||
func (*StateBroadcastWaiting) broadcastState() {} | ||
func (*StateBroadcastFinished[K, N]) broadcastState() {} | ||
func (*StateBroadcastIdle) broadcastState() {} |
Oops, something went wrong.