rendezvous

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 19 Imported by: 4

Documentation

Index

Constants

View Source
const (
	RendezvousProto = protocol.ID("/rendezvous/1.0.0")

	DefaultTTL = 2 * 3600 // 2hr
)
View Source
const (
	MaxTTL               = 72 * 3600 // 72hr
	MaxNamespaceLength   = 256
	MaxPeerAddressLength = 2048
	MaxRegistrations     = 1000
	MaxDiscoverLimit     = 1000
)
View Source
const (
	ServiceType  = "inmem"
	ServiceProto = protocol.ID("/rendezvous/sync/inmem/1.0.0")
)

Variables

View Source
var DefaultAddrFactory = func(addrs []ma.Multiaddr) []ma.Multiaddr { return addrs }
View Source
var (
	DiscoverAsyncInterval = 2 * time.Minute
)

Functions

func NewDiscoverMessage

func NewDiscoverMessage(ns string, limit int, cookie []byte) *pb.Message

func NewRegisterMessage

func NewRegisterMessage(ns string, pi peer.AddrInfo, ttl int) *pb.Message

func NewRendezvousDiscovery

func NewRendezvousDiscovery(host host.Host, rendezvousPeer peer.ID) discovery.Discovery

func NewSyncInMemClient

func NewSyncInMemClient(ctx context.Context, h host.Host) *client

Types

type AddrsFactory added in v0.4.1

type AddrsFactory func(addrs []ma.Multiaddr) []ma.Multiaddr

type PubSub

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

func NewSyncInMemProvider

func NewSyncInMemProvider(host host.Host) (*PubSub, error)

func (*PubSub) GetServiceType

func (ps *PubSub) GetServiceType() string

func (*PubSub) Listen

func (ps *PubSub) Listen()

func (*PubSub) Register

func (ps *PubSub) Register(pid peer.ID, ns string, addrs [][]byte, ttlAsSeconds int, counter uint64)

func (*PubSub) Subscribe

func (ps *PubSub) Subscribe(ns string) (syncDetails string, err error)

func (*PubSub) Unregister

func (ps *PubSub) Unregister(p peer.ID, ns string)

type PubSubSubscribers

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

type PubSubSubscriptionDetails

type PubSubSubscriptionDetails struct {
	PeerID      string
	ChannelName string
}

type Registration

type Registration struct {
	Peer peer.AddrInfo
	Ns   string
	Ttl  int
}

type RendezvousClient

type RendezvousClient interface {
	Register(ctx context.Context, ns string, ttl int) (time.Duration, error)
	Unregister(ctx context.Context, ns string) error
	Discover(ctx context.Context, ns string, limit int, cookie []byte) ([]peer.AddrInfo, []byte, error)
	DiscoverAsync(ctx context.Context, ns string) (<-chan peer.AddrInfo, error)
	DiscoverSubscribe(ctx context.Context, ns string) (<-chan peer.AddrInfo, error)
}

func NewRendezvousClient

func NewRendezvousClient(host host.Host, rp peer.ID, sync ...RendezvousSyncClient) RendezvousClient

func NewRendezvousClientWithPoint

func NewRendezvousClientWithPoint(rp RendezvousPoint, syncClientList ...RendezvousSyncClient) 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)
	Unregister(ctx context.Context, ns string) error
	Discover(ctx context.Context, ns string, limit int, cookie []byte) ([]Registration, []byte, error)
	DiscoverAsync(ctx context.Context, ns string) (<-chan Registration, error)
	DiscoverSubscribe(ctx context.Context, ns string, serviceTypes []RendezvousSyncClient) (<-chan peer.AddrInfo, error)
}

func NewRendezvousPoint

func NewRendezvousPoint(host host.Host, p peer.ID, opts ...RendezvousPointOption) RendezvousPoint

type RendezvousPointOption added in v0.4.1

type RendezvousPointOption func(cfg *rendezvousPointConfig)

func ClientWithAddrsFactory added in v0.4.1

func ClientWithAddrsFactory(factory AddrsFactory) RendezvousPointOption

AddrsFactory configures libp2p to use the given address factory.

type RendezvousService

type RendezvousService struct {
	DB db.DB
	// contains filtered or unexported fields
}

func NewRendezvousService

func NewRendezvousService(host host.Host, db db.DB, rzs ...RendezvousSync) *RendezvousService

type RendezvousSync

type RendezvousSync interface {
	Register(p peer.ID, ns string, addrs [][]byte, ttl int, counter uint64)
	Unregister(p peer.ID, ns string)
}

type RendezvousSyncClient

type RendezvousSyncClient interface {
	Subscribe(ctx context.Context, syncDetails string) (<-chan *Registration, error)
	GetServiceType() string
}

type RendezvousSyncSubscribable

type RendezvousSyncSubscribable interface {
	Subscribe(ns string) (syncDetails string, err error)
	GetServiceType() string
}

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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