Documentation ¶
Index ¶
- Constants
- Variables
- func AllAddrsFactory(ms []ma.Multiaddr) []ma.Multiaddr
- func MockBufferSize(size int) discovery.Option
- func PrivateAddrsOnlyFactory(ms []ma.Multiaddr) []ma.Multiaddr
- func PublicAddrsOnlyFactory(ms []ma.Multiaddr) []ma.Multiaddr
- type AddrsFilter
- type DiscoveryAdaptater
- type DiscoveryDriver
- func (d *DiscoveryDriver) Advertise(ctx context.Context, topic string, opts ...discovery.Option) (time.Duration, error)
- func (d *DiscoveryDriver) FindPeers(ctx context.Context, topic string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)
- func (d *DiscoveryDriver) Name() string
- func (d *DiscoveryDriver) Subscribe(_ context.Context, _ string, _ ...discovery.Option) (<-chan peer.AddrInfo, error)
- func (d *DiscoveryDriver) Unregister(_ context.Context, _ string, _ ...discovery.Option) error
- type Filter
- type IDriver
- type LocalDiscovery
- func (ld *LocalDiscovery) Advertise(ctx context.Context, cid string, opts ...discovery.Option) (time.Duration, error)
- func (ld *LocalDiscovery) Close() error
- func (ld *LocalDiscovery) FindPeers(ctx context.Context, cid string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)
- func (ld *LocalDiscovery) Name() string
- func (ld *LocalDiscovery) Subscribe(ctx context.Context, cid string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)
- func (ld *LocalDiscovery) Unregister(ctx context.Context, cid string, _ ...discovery.Option) error
- type MockDriverServer
- func (s *MockDriverServer) Advertise(topic string, info peer.AddrInfo, ttl time.Duration)
- func (s *MockDriverServer) Client(h host.Host) IDriver
- func (s *MockDriverServer) Exist(topic string, p peer.ID) (ok bool)
- func (s *MockDriverServer) FindPeers(topic string, limit int) <-chan peer.AddrInfo
- func (s *MockDriverServer) Subscribe(ctx context.Context, topic string, buffsize int) <-chan peer.AddrInfo
- func (s *MockDriverServer) Unregister(ctx context.Context, topic string, p peer.ID)
- func (s *MockDriverServer) WaitForPeer(topic string, p peer.ID, timeout time.Duration) (err error)
- type MockIDriverClient
- func (s *MockIDriverClient) Advertise(ctx context.Context, topic string, opts ...discovery.Option) (time.Duration, error)
- func (s *MockIDriverClient) FindPeers(ctx context.Context, topic string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)
- func (s *MockIDriverClient) Name() string
- func (s *MockIDriverClient) Subscribe(ctx context.Context, topic string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)
- func (s *MockIDriverClient) Unregister(ctx context.Context, topic string, opts ...discovery.Option) error
- type NetworkUpdate
- type Option
- type Options
- type PeersUpdate
- type Record
- func (*Record) Descriptor() ([]byte, []int)
- func (m *Record) GetCid() string
- func (m *Record) GetExpire() int64
- func (m *Record) Marshal() (dAtA []byte, err error)
- func (m *Record) MarshalTo(dAtA []byte) (int, error)
- func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Record) ProtoMessage()
- func (m *Record) Reset()
- func (m *Record) Size() (n int)
- func (m *Record) String() string
- func (m *Record) Unmarshal(dAtA []byte) error
- func (m *Record) XXX_DiscardUnknown()
- func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Record) XXX_Merge(src proto.Message)
- func (m *Record) XXX_Size() int
- func (m *Record) XXX_Unmarshal(b []byte) error
- type Records
- func (*Records) Descriptor() ([]byte, []int)
- func (m *Records) GetRecords() []*Record
- func (m *Records) Marshal() (dAtA []byte, err error)
- func (m *Records) MarshalTo(dAtA []byte) (int, error)
- func (m *Records) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Records) ProtoMessage()
- func (m *Records) Reset()
- func (m *Records) Size() (n int)
- func (m *Records) String() string
- func (m *Records) Unmarshal(dAtA []byte) error
- func (m *Records) XXX_DiscardUnknown()
- func (m *Records) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Records) XXX_Merge(src proto.Message)
- func (m *Records) XXX_Size() int
- func (m *Records) XXX_Unmarshal(b []byte) error
- type Service
- func (s *Service) Close() error
- func (s *Service) FindPeers(ctx context.Context, topic string) <-chan peer.AddrInfo
- func (s *Service) GetProcess() uint32
- func (s *Service) LookupPeers(ctx context.Context, topic string, opts ...Option) error
- func (s *Service) StartAdvertises(ctx context.Context, topic string, opts ...Option) error
- func (s *Service) Subscribe(topic string, opts ...Option) *Subscription
- func (s *Service) Unregister(ctx context.Context, topic string) error
- func (s *Service) WatchPeers(ctx context.Context, topic string) <-chan peer.AddrInfo
- func (s *Service) WatchTopic(ctx context.Context, topic string, opts ...Option) (err error)
- type Subscription
Constants ¶
View Source
const (
// LocalDiscoveryName is the name of the localdiscovery driver
LocalDiscoveryName = "localdisc"
)
Variables ¶
View Source
var ( ErrInvalidLengthRecords = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowRecords = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupRecords = fmt.Errorf("proto: unexpected end of group") )
View Source
var ErrNotSupported = fmt.Errorf("not supported")
Functions ¶
func MockBufferSize ¶
func PrivateAddrsOnlyFactory ¶
keep private addr only
Types ¶
type AddrsFilter ¶
type AddrsFilter = bhost.AddrsFactory
type DiscoveryAdaptater ¶
type DiscoveryAdaptater struct {
// contains filtered or unexported fields
}
func NewDiscoveryAdaptater ¶
func NewDiscoveryAdaptater(logger *zap.Logger, service *Service, defaultOpts ...Option) *DiscoveryAdaptater
func (*DiscoveryAdaptater) Close ¶
func (a *DiscoveryAdaptater) Close() error
type DiscoveryDriver ¶
func (*DiscoveryDriver) Advertise ¶
func (d *DiscoveryDriver) Advertise(ctx context.Context, topic string, opts ...discovery.Option) (time.Duration, error)
discovery advertise
func (*DiscoveryDriver) FindPeers ¶
func (d *DiscoveryDriver) FindPeers(ctx context.Context, topic string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)
discovery find peers
func (*DiscoveryDriver) Name ¶
func (d *DiscoveryDriver) Name() string
func (*DiscoveryDriver) Unregister ¶
type IDriver ¶
type IDriver interface { Name() string Subscribe(ctx context.Context, topic string, opts ...discovery.Option) (<-chan peer.AddrInfo, error) Unregister(ctx context.Context, topic string, opts ...discovery.Option) error // discovery Advertise(ctx context.Context, ns string, opts ...discovery.Option) (time.Duration, error) FindPeers(ctx context.Context, ns string, opts ...discovery.Option) (<-chan peer.AddrInfo, error) }
func NewRendezvousDiscovery ¶
type LocalDiscovery ¶
type LocalDiscovery struct {
// contains filtered or unexported fields
}
func NewLocalDiscovery ¶
func (*LocalDiscovery) Close ¶
func (ld *LocalDiscovery) Close() error
func (*LocalDiscovery) Name ¶
func (ld *LocalDiscovery) Name() string
func (*LocalDiscovery) Unregister ¶
type MockDriverServer ¶
type MockDriverServer struct {
// contains filtered or unexported fields
}
func NewMockDriverServer ¶
func NewMockDriverServer() *MockDriverServer
func (*MockDriverServer) Exist ¶
func (s *MockDriverServer) Exist(topic string, p peer.ID) (ok bool)
func (*MockDriverServer) FindPeers ¶
func (s *MockDriverServer) FindPeers(topic string, limit int) <-chan peer.AddrInfo
func (*MockDriverServer) Unregister ¶
func (*MockDriverServer) WaitForPeer ¶
type MockIDriverClient ¶
type MockIDriverClient struct {
// contains filtered or unexported fields
}
func (*MockIDriverClient) Name ¶
func (s *MockIDriverClient) Name() string
func (*MockIDriverClient) Unregister ¶
type NetworkUpdate ¶
type NetworkUpdate struct {
// contains filtered or unexported fields
}
func NewNetworkUpdate ¶
func (*NetworkUpdate) Close ¶
func (n *NetworkUpdate) Close() (err error)
func (*NetworkUpdate) GetLastUpdatedAddrs ¶
func (n *NetworkUpdate) GetLastUpdatedAddrs(ctx context.Context) (addrs []ma.Multiaddr)
func (*NetworkUpdate) WaitForUpdate ¶
type Option ¶
func FilterOutDrivers ¶
type PeersUpdate ¶
func (PeersUpdate) HasUpdate ¶
func (current PeersUpdate) HasUpdate(tu *topicUpdate) []peer.ID
type Record ¶
type Record struct { Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` Expire int64 `protobuf:"varint,2,opt,name=expire,proto3" json:"expire,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Record) Descriptor ¶
func (*Record) MarshalToSizedBuffer ¶
func (*Record) ProtoMessage ¶
func (*Record) ProtoMessage()
func (*Record) XXX_DiscardUnknown ¶
func (m *Record) XXX_DiscardUnknown()
func (*Record) XXX_Marshal ¶
func (*Record) XXX_Unmarshal ¶
type Records ¶
type Records struct { Records []*Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Records) Descriptor ¶
func (*Records) GetRecords ¶
func (*Records) MarshalToSizedBuffer ¶
func (*Records) ProtoMessage ¶
func (*Records) ProtoMessage()
func (*Records) XXX_DiscardUnknown ¶
func (m *Records) XXX_DiscardUnknown()
func (*Records) XXX_Marshal ¶
func (*Records) XXX_Unmarshal ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) GetProcess ¶
func (*Service) LookupPeers ¶
func (*Service) StartAdvertises ¶
StartAdvertises topic on each of service drivers
func (*Service) Unregister ¶
Unregister try to unregister topic on each of his driver
func (*Service) WatchPeers ¶
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
func (*Subscription) Close ¶
func (s *Subscription) Close() error
func (*Subscription) Out ¶
func (s *Subscription) Out() <-chan peer.AddrInfo
func (*Subscription) Pull ¶
func (s *Subscription) Pull() error
Click to show internal directories.
Click to hide internal directories.