Documentation ¶
Index ¶
- func CosineSimilarity(a, b mat.Vector) float64
- func Hash(b []byte) int32
- func HashChunked(prefix string, o []byte) []int
- func SimpleSimilarity(a, b *sparse.Vector) float64
- func Vectorise(q *peer.PeerInfoRequest) *sparse.Vector
- type Discoverer
- func (r *Discoverer) FindByContent(ctx context.Context, contentHash string, opts ...discovery.Option) ([]*peer.PeerInfo, error)
- func (r *Discoverer) FindByFingerprint(ctx context.Context, fingerprint string, opts ...discovery.Option) ([]*peer.PeerInfo, error)
- func (r *Discoverer) LookupPeerInfo(ctx context.Context, q *peer.PeerInfoRequest) ([]*peer.PeerInfo, error)
- type Distance
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CosineSimilarity ¶
CosineSimilarity of two sparse vectors
func Hash ¶
Hash finds the bucket of a given byte slice between scaleMin and scaleMax TODO(geoah) Rewrite, most likely wrong
func HashChunked ¶
HashChunked spilts input in chunks and hashes them individually TODO(geoah) Rewrite, most likely wrong as well
func SimpleSimilarity ¶
SimpleSimilarity of two sparse vectors
Types ¶
type Discoverer ¶
type Discoverer struct {
// contains filtered or unexported fields
}
Discoverer hyperspace
func NewDiscoverer ¶
func NewDiscoverer( ctx context.Context, network net.Network, exc exchange.Exchange, local *net.LocalInfo, bootstrapAddresses []string, ) (*Discoverer, error)
NewDiscoverer returns a new hyperspace discoverer
func (*Discoverer) FindByContent ¶
func (r *Discoverer) FindByContent( ctx context.Context, contentHash string, opts ...discovery.Option, ) ([]*peer.PeerInfo, error)
FindByContent finds and returns peer infos from a content hash
func (*Discoverer) FindByFingerprint ¶
func (r *Discoverer) FindByFingerprint( ctx context.Context, fingerprint string, opts ...discovery.Option, ) ([]*peer.PeerInfo, error)
FindByFingerprint finds and returns peer infos from a fingerprint
func (*Discoverer) LookupPeerInfo ¶
func (r *Discoverer) LookupPeerInfo( ctx context.Context, q *peer.PeerInfoRequest, ) ([]*peer.PeerInfo, error)
LookupPeerInfo does a network lookup given a query
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds peer capabilities with their vectors
func (*Store) FindByContent ¶
FindByContent returns peers that match a given content hash
func (*Store) FindByFingerprint ¶
FindByFingerprint returns peers that are signed by a fingerprint
func (*Store) FindClosest ¶
func (s *Store) FindClosest(q *peer.PeerInfoRequest) []*peer.PeerInfo
FindClosest returns peers that closest resemble the query