-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kad Import #2
Kad Import #2
Conversation
Awesome, thanks @guillaumemichel! This is how I thought the first step could look like. Love the Some comments:
|
kad/kad.go
Outdated
type RoutingProtocol[K Key[K], N NodeID[K], A Address[A]] interface { | ||
FindNode(ctx context.Context, to N, target K) (NodeInfo[K, A], []N, error) | ||
Ping(ctx context.Context, to N) error | ||
} | ||
|
||
type RecordProtocol[K Key[K], N NodeID[K]] interface { | ||
Get(ctx context.Context, to N, target K) ([]Record, []N, error) | ||
Put(ctx context.Context, to N, record Record) error | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iand I guess we went away from this pattern?
Co-authored-by: Dennis Trautwein <[email protected]>
What are the benefits of a shallow package hierarchy? The benefit I see for the current hierarchy are that users can choose to import only one type of
What is the process to pull these?
In this case I suggest to remove the following types:
We can implement the necessary types in |
My preference is also for shallower package hierarchies. But I think having a package for distinct types of key makes sense. I see an analogy with the crypto or hash package hierarches in the Go standard lib However the current types names are awkward to work with and leads to stuttering:
I would prefer:
key256 is hard to rename but perhaps this would be nicer
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved but I would like to see the naming of the key packages and types improved as per my comment
Recent changes:
WDYT @dennis-tra |
Hmm I'd still prefer a single key package :D the crypto packages are more sophisticated than what we're doing with our keys but it seems I'm outvoted :) Fine with me to merge 👍 |
See probe-lab/go-kademlia#120 (comment) for reference.
Importing basic Kademlia types, as well as the
trie
,key
andtriert
packages.