2019-01-24 20:15:10 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-06-22 14:33:57 +01:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package dht
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2018-09-18 05:39:06 +01:00
|
|
|
"storj.io/storj/pkg/pb"
|
2018-11-29 18:39:27 +00:00
|
|
|
"storj.io/storj/pkg/storj"
|
2018-06-22 14:33:57 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// DHT is the interface for the DHT in the Storj network
|
|
|
|
type DHT interface {
|
2019-01-28 22:53:37 +00:00
|
|
|
FindNear(ctx context.Context, start storj.NodeID, limit int, restrictions ...pb.Restriction) ([]*pb.Node, error)
|
2018-06-22 14:33:57 +01:00
|
|
|
Bootstrap(ctx context.Context) error
|
2018-09-18 05:39:06 +01:00
|
|
|
Ping(ctx context.Context, node pb.Node) (pb.Node, error)
|
2018-11-29 18:39:27 +00:00
|
|
|
FindNode(ctx context.Context, ID storj.NodeID) (pb.Node, error)
|
2018-11-20 16:54:52 +00:00
|
|
|
Seen() []*pb.Node
|
2018-06-22 14:33:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Bucket is a set of methods to act on kademlia k buckets
|
|
|
|
type Bucket interface {
|
2018-09-18 05:39:06 +01:00
|
|
|
Routing() []pb.Node
|
|
|
|
Cache() []pb.Node
|
2018-11-29 18:39:27 +00:00
|
|
|
// TODO: should this be a NodeID?
|
2018-06-22 14:33:57 +01:00
|
|
|
Midpoint() string
|
2018-09-18 05:39:06 +01:00
|
|
|
Nodes() []*pb.Node
|
2018-06-22 14:33:57 +01:00
|
|
|
}
|