hyperspace

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentHashesBloomRequestType = "nimona.io/discovery/hyperspace/bloom.request"
)
View Source
const (
	ContentHashesBloomType = "nimona.io/discovery/hyperspace/bloom"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentHashesBloom added in v0.4.0

type ContentHashesBloom struct {
	BloomFilter []int             `json:"bloomFilter:ai"`
	Signature   *crypto.Signature `json:"@signature:o"`
}

ContentHashesBloom -

func (*ContentHashesBloom) Bloom added in v0.4.0

func (ch *ContentHashesBloom) Bloom() []int

func (*ContentHashesBloom) FromObject added in v0.4.0

func (s *ContentHashesBloom) FromObject(o object.Object) error

FromObject populates the struct from a f12n object

func (ContentHashesBloom) GetType added in v0.4.0

func (s ContentHashesBloom) GetType() string

GetType returns the object's type

func (ContentHashesBloom) ToObject added in v0.4.0

func (s ContentHashesBloom) ToObject() object.Object

ToObject returns a f12n object

type ContentHashesBloomRequest added in v0.4.0

type ContentHashesBloomRequest struct {
	BloomFilter []int `json:"bloomFilter:ai"`
}

ContentHashesBloomRequest -

func (*ContentHashesBloomRequest) Bloom added in v0.4.0

func (ch *ContentHashesBloomRequest) Bloom() []int

func (*ContentHashesBloomRequest) FromObject added in v0.4.0

func (s *ContentHashesBloomRequest) FromObject(o object.Object) error

FromObject populates the struct from a f12n object

func (ContentHashesBloomRequest) GetType added in v0.4.0

func (s ContentHashesBloomRequest) GetType() string

GetType returns the object's type

func (ContentHashesBloomRequest) ToObject added in v0.4.0

ToObject returns a f12n object

type CryptoFingerprintContentHashesBloomSyncMap added in v0.4.0

type CryptoFingerprintContentHashesBloomSyncMap struct {
	// contains filtered or unexported fields
}

CryptoFingerprintContentHashesBloomSyncMap -

func NewCryptoFingerprintContentHashesBloomSyncMap added in v0.4.0

func NewCryptoFingerprintContentHashesBloomSyncMap() *CryptoFingerprintContentHashesBloomSyncMap

NewCryptoFingerprintContentHashesBloomSyncMap constructs a new SyncMap

func (*CryptoFingerprintContentHashesBloomSyncMap) Delete added in v0.4.0

Delete -

func (*CryptoFingerprintContentHashesBloomSyncMap) Get added in v0.4.0

Get -

func (*CryptoFingerprintContentHashesBloomSyncMap) Put added in v0.4.0

Put -

func (*CryptoFingerprintContentHashesBloomSyncMap) Range added in v0.4.0

Range -

type CryptoFingerprintPeerPeerSyncMap added in v0.4.0

type CryptoFingerprintPeerPeerSyncMap struct {
	// contains filtered or unexported fields
}

CryptoFingerprintPeerPeerSyncMap -

func NewCryptoFingerprintPeerPeerSyncMap added in v0.4.0

func NewCryptoFingerprintPeerPeerSyncMap() *CryptoFingerprintPeerPeerSyncMap

NewCryptoFingerprintPeerPeerSyncMap constructs a new SyncMap

func (*CryptoFingerprintPeerPeerSyncMap) Delete added in v0.4.0

Delete -

func (*CryptoFingerprintPeerPeerSyncMap) Get added in v0.4.0

Get -

func (*CryptoFingerprintPeerPeerSyncMap) Put added in v0.4.0

Put -

func (*CryptoFingerprintPeerPeerSyncMap) Range added in v0.4.0

Range -

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 *peer.LocalPeer,
	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,
) ([]crypto.Fingerprint, error)

FindByContent finds and returns peer infos from a content hash

func (*Discoverer) FindByFingerprint

func (r *Discoverer) FindByFingerprint(
	ctx context.Context,
	fingerprint crypto.Fingerprint,
	opts ...discovery.Option,
) ([]*peer.Peer, error)

FindByFingerprint finds and returns peer infos from a fingerprint

func (*Discoverer) LookupContentProvider added in v0.4.0

func (r *Discoverer) LookupContentProvider(
	ctx context.Context,
	q bloom.Bloomer,
) ([]crypto.Fingerprint, error)

LookupContentProvider searches the network for content given a bloom filter

func (*Discoverer) LookupPeer added in v0.4.0

func (r *Discoverer) LookupPeer(
	ctx context.Context,
	q *peer.PeerRequest,
) ([]*peer.Peer, error)

LookupPeer does a network lookup given a query

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store holds peer content blooms and their fingerprints

func NewStore

func NewStore() *Store

NewStore retuns empty store

func (*Store) AddContentHashes added in v0.4.0

func (s *Store) AddContentHashes(c *ContentHashesBloom)

Add content hashes

func (*Store) AddPeer added in v0.4.0

func (s *Store) AddPeer(peer *peer.Peer)

Add peers

func (*Store) FindByContent

func (s *Store) FindByContent(b bloom.Bloomer) []*ContentHashesBloom

FindByContent returns peers that match a given content hash

func (*Store) FindByFingerprint

func (s *Store) FindByFingerprint(
	fingerprint crypto.Fingerprint,
) []*peer.Peer

FindByFingerprint returns peers that are signed by a fingerprint

func (*Store) FindClosestContentProvider added in v0.4.0

func (s *Store) FindClosestContentProvider(q bloom.Bloomer) []*ContentHashesBloom

FindClosestContentProvider returns peers that are "closet" to the given content

func (*Store) FindClosestPeer added in v0.4.0

func (s *Store) FindClosestPeer(f crypto.Fingerprint) []*peer.Peer

FindClosestPeer returns peers that closest resemble the query

type StringSyncList added in v0.4.0

type StringSyncList struct {
	// contains filtered or unexported fields
}

StringSyncList -

func NewStringValueTypeSyncMap added in v0.4.0

func NewStringValueTypeSyncMap() *StringSyncList

NewStringValueTypeSyncMap constructs a new SyncMap

func (*StringSyncList) Delete added in v0.4.0

func (m *StringSyncList) Delete(k string)

Delete -

func (*StringSyncList) Exists added in v0.4.0

func (m *StringSyncList) Exists(k string) bool

Exists -

func (*StringSyncList) Put added in v0.4.0

func (m *StringSyncList) Put(k string)

Put -

func (*StringSyncList) Range added in v0.4.0

func (m *StringSyncList) Range(i func(k string) bool)

Range -

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL