Commit ac9f0335 authored by Adin Schmahmann's avatar Adin Schmahmann Committed by Steven Allen

cleanup: documentation and code cleanup for search/getvalue quorum defaulting to zero

parent 5358a4fb
......@@ -463,7 +463,7 @@ func TestSearchValue(t *testing.T) {
ctxT, cancel = context.WithTimeout(ctx, time.Second*2)
defer cancel()
valCh, err := dhtA.SearchValue(ctxT, "/v/hello", Quorum(-1))
valCh, err := dhtA.SearchValue(ctxT, "/v/hello", Quorum(0))
if err != nil {
t.Fatal(err)
}
......
......@@ -168,7 +168,7 @@ func (dht *IpfsDHT) SearchValue(ctx context.Context, key string, opts ...routing
responsesNeeded := 0
if !cfg.Offline {
responsesNeeded = getQuorum(&cfg, 0)
responsesNeeded = getQuorum(&cfg, defaultQuorum)
}
stopCh := make(chan struct{})
......
......@@ -7,9 +7,10 @@ type quorumOptionKey struct{}
const defaultQuorum = 0
// Quorum is a DHT option that tells the DHT how many peers it needs to get
// values from before returning the best one.
// values from before returning the best one. Zero means the DHT query
// should complete instead of returning early.
//
// Default: 16
// Default: 0
func Quorum(n int) routing.Option {
return func(opts *routing.Options) error {
if opts.Other == nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment