Documentation ¶
Index ¶
- Constants
- Variables
- func IsErrAlreadyExists(err error) bool
- func WithAdvertiseAddr(advertiseAddr string) func(*memberlist.Config, *peerExchangeConfig)
- func WithAdvertisePort(advertisePort int) func(*memberlist.Config, *peerExchangeConfig)
- func WithBindAddr(bindAddr string) func(*memberlist.Config, *peerExchangeConfig)
- func WithBindPort(bindPort int) func(*memberlist.Config, *peerExchangeConfig)
- func WithInitialRetryInterval(interval time.Duration) func(*memberlist.Config, *peerExchangeConfig)
- func WithName(name string) func(*memberlist.Config, *peerExchangeConfig)
- func WithReSyncInterval(interval time.Duration) func(*memberlist.Config, *peerExchangeConfig)
- func WithReplicaThreshold(threshold int) func(*memberlist.Config, *peerExchangeConfig)
- type DestPeer
- type InitialMember
- type InitialMemberLister
- type MemberMeta
- type PeerExchangeMember
- type PeerExchangeRPC
- type PeerExchangeServer
- type PeerExchangeSynchronizer
- type PeerMetadataSendReceiveCloser
- type PeerMetadataSendReceiver
- type PeerSearchBroadcaster
- type ReclaimFunc
- type SearchPeerResult
- type SearchPeerResultType
Constants ¶
View Source
const ( SearchPeerResultTypeLocal = iota SearchPeerResultTypeReplica SearchPeerResultTypeRemote SearchPeerResultTypeNotFound )
View Source
const (
GRPCMetadataHostID = "HostID"
)
Variables ¶
View Source
var ( ErrAlreadyExists = errors.New("member is already exist") ErrNotFound = errors.New("member not found") )
Functions ¶
func IsErrAlreadyExists ¶
func WithAdvertiseAddr ¶
func WithAdvertiseAddr(advertiseAddr string) func(*memberlist.Config, *peerExchangeConfig)
func WithAdvertisePort ¶
func WithAdvertisePort(advertisePort int) func(*memberlist.Config, *peerExchangeConfig)
func WithBindAddr ¶
func WithBindAddr(bindAddr string) func(*memberlist.Config, *peerExchangeConfig)
func WithBindPort ¶
func WithBindPort(bindPort int) func(*memberlist.Config, *peerExchangeConfig)
func WithInitialRetryInterval ¶
func WithInitialRetryInterval(interval time.Duration) func(*memberlist.Config, *peerExchangeConfig)
func WithName ¶
func WithName(name string) func(*memberlist.Config, *peerExchangeConfig)
func WithReSyncInterval ¶
func WithReSyncInterval(interval time.Duration) func(*memberlist.Config, *peerExchangeConfig)
func WithReplicaThreshold ¶
func WithReplicaThreshold(threshold int) func(*memberlist.Config, *peerExchangeConfig)
Types ¶
type DestPeer ¶
type DestPeer struct { *MemberMeta PeerID string }
type InitialMember ¶
type InitialMember = memberlist.Node
type InitialMemberLister ¶
type InitialMemberLister interface {
List() ([]*InitialMember, error)
}
func NewSeedPeerMemberLister ¶
func NewSeedPeerMemberLister(getSeedPeers func() ([]*managerv1.SeedPeer, error)) InitialMemberLister
func NewStaticPeerMemberLister ¶
func NewStaticPeerMemberLister(members []*InitialMember) InitialMemberLister
type MemberMeta ¶
type MemberMeta struct { HostID string IP string RPCPort int32 ProxyPort int32 // contains filtered or unexported fields }
func ExtractNodeMeta ¶
func ExtractNodeMeta(node *memberlist.Node) (*MemberMeta, error)
type PeerExchangeMember ¶
type PeerExchangeMember interface { FindMember(hostID string) (*MemberMeta, error) Register(member *MemberMeta, sr PeerMetadataSendReceiveCloser) error UnRegister(member *MemberMeta) UnRegisterByHostID(hostID string) }
type PeerExchangeRPC ¶
type PeerExchangeRPC interface {
PeerExchange(exchangeServer dfdaemonv1.Daemon_PeerExchangeServer) error
}
type PeerExchangeServer ¶
type PeerExchangeServer interface { Serve(localMember *MemberMeta) error Stop() error PeerSearchBroadcaster() PeerSearchBroadcaster PeerExchangeRPC() PeerExchangeRPC }
func NewPeerExchange ¶
func NewPeerExchange( reclaim ReclaimFunc, lister InitialMemberLister, grpcDialTimeout time.Duration, grpcDialOptions []grpc.DialOption, opts ...func(*memberlist.Config, *peerExchangeConfig)) (PeerExchangeServer, error)
type PeerExchangeSynchronizer ¶
type PeerExchangeSynchronizer interface {
Sync(nodeMeta *MemberMeta, peer *dfdaemonv1.PeerExchangeData)
}
type PeerMetadataSendReceiveCloser ¶
type PeerMetadataSendReceiveCloser interface { PeerMetadataSendReceiver Close() error }
func NewPeerMetadataSendReceiveCloser ¶
func NewPeerMetadataSendReceiveCloser(p PeerMetadataSendReceiver, close func() error) PeerMetadataSendReceiveCloser
type PeerMetadataSendReceiver ¶
type PeerMetadataSendReceiver interface { Send(*dfdaemonv1.PeerExchangeData) error Recv() (*dfdaemonv1.PeerExchangeData, error) }
type PeerSearchBroadcaster ¶
type PeerSearchBroadcaster interface { SearchPeer(task string) SearchPeerResult BroadcastPeer(data *dfdaemonv1.PeerMetadata) BroadcastPeers(data *dfdaemonv1.PeerExchangeData) }
type ReclaimFunc ¶
type SearchPeerResult ¶
type SearchPeerResult struct { Type SearchPeerResultType Peers []*DestPeer }
type SearchPeerResultType ¶
type SearchPeerResultType int
Click to show internal directories.
Click to hide internal directories.