Documentation ¶
Index ¶
- Constants
- Variables
- func NewRendezvousDiscovery(host host.Host) discovery.Discovery
- func TopicPart(key []byte) []byte
- type Cleaner
- func (c *Cleaner) Add(deadlineTime time.Time, key string)
- func (c *Cleaner) Exist(key string) bool
- func (c *Cleaner) Id(index int) string
- func (c *Cleaner) Len() int
- func (c *Cleaner) Less(i, j int) bool
- func (c *Cleaner) Pop() interface{}
- func (c *Cleaner) PopSince(now time.Time) (rst []string)
- func (c *Cleaner) Push(record interface{})
- func (c *Cleaner) Swap(i, j int)
- type DB
- type Iterator
- type RecordsKey
- type Registration
- type RegistrationRecord
- type RendezvousClient
- type RendezvousError
- type RendezvousPoint
- type RendezvousService
- type Storage
- func (s Storage) Add(ns string, id peer.ID, envelope []byte, ttl int, deadline time.Time) (string, error)
- func (s *Storage) GetRandom(ns string, limit int64) (rst []RegistrationRecord, err error)
- func (s *Storage) IterateAllKeys(iterator func(key RecordsKey, Deadline time.Time) error) error
- func (s *Storage) RemoveByKey(key string) error
Constants ¶
View Source
const ( RendezvousID_v001 = protocol.ID("/vac/waku/rendezvous/0.0.1") DefaultTTL = 20 // 20 seconds )
View Source
const ( RecordsPrefix byte = 1 + iota TopicBodyDelimiter = 0xff )
View Source
const ( MaxTTL = 20 // 20sec MaxNamespaceLength = 256 MaxPeerAddressLength = 2048 MaxDiscoverLimit = int64(1000) )
Variables ¶
View Source
var (
DiscoverAsyncInterval = 2 * time.Minute
)
Functions ¶
Types ¶
type Cleaner ¶
type Cleaner struct {
// contains filtered or unexported fields
}
func NewCleaner ¶
func NewCleaner() *Cleaner
definitely rename Rewrite cleaner to operate on a leveldb directly if it is impossible to query on topic+timestamp(big endian) for purging store an additional key
type RecordsKey ¶
type RecordsKey []byte
func NewRecordsKey ¶
func NewRecordsKey(ns string, id peer.ID) RecordsKey
func (RecordsKey) SamePrefix ¶
func (k RecordsKey) SamePrefix(prefix []byte) bool
func (RecordsKey) String ¶
func (k RecordsKey) String() string
type RegistrationRecord ¶
type RendezvousClient ¶
type RendezvousClient interface { Register(ctx context.Context, ns string, ttl int) (time.Duration, error) Discover(ctx context.Context, ns string, limit int) ([]peer.AddrInfo, error) DiscoverAsync(ctx context.Context, ns string) (<-chan peer.AddrInfo, error) }
func NewRendezvousClient ¶
func NewRendezvousClient(host host.Host) RendezvousClient
func NewRendezvousClientWithPoint ¶
func NewRendezvousClientWithPoint(rp RendezvousPoint) RendezvousClient
type RendezvousError ¶
type RendezvousError struct { Status pb.Message_ResponseStatus Text string }
func (RendezvousError) Error ¶
func (e RendezvousError) Error() string
type RendezvousPoint ¶
type RendezvousPoint interface { Register(ctx context.Context, ns string, ttl int) (time.Duration, error) Discover(ctx context.Context, ns string, limit int) ([]Registration, error) DiscoverAsync(ctx context.Context, ns string) (<-chan Registration, error) }
func NewRendezvousPoint ¶
func NewRendezvousPoint(host host.Host) RendezvousPoint
type RendezvousService ¶
type RendezvousService struct {
// contains filtered or unexported fields
}
func NewRendezvousService ¶
func NewRendezvousService(host host.Host, storage Storage) *RendezvousService
func (*RendezvousService) Start ¶
func (rz *RendezvousService) Start() error
func (*RendezvousService) Stop ¶
func (rz *RendezvousService) Stop()
Stop closes listener and waits till all helper goroutines are stopped.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage manages records.
func (Storage) Add ¶
func (s Storage) Add(ns string, id peer.ID, envelope []byte, ttl int, deadline time.Time) (string, error)
Add stores record using specified topic.
func (*Storage) GetRandom ¶
func (s *Storage) GetRandom(ns string, limit int64) (rst []RegistrationRecord, err error)
GetRandom reads random records for specified topic up to specified limit.
func (*Storage) IterateAllKeys ¶
func (*Storage) RemoveByKey ¶
RemoveBykey removes record from storage.
Click to show internal directories.
Click to hide internal directories.