Documentation
¶
Index ¶
- Variables
- func NewCatalogHandlerImpl(stub *pb.StreamStub, ctx context.Context, helper CatalogHelper, m *model.Model) (ret *catalogHandler)
- func NewCatalogPolicyDefault() (ret *catalogPolicyImpl)
- func NewTokenBucket(inv int) *tokenBucket
- type CatalogHandler
- type CatalogHelper
- type CatalogPeerPolicies
- type CatalogPolicies
- type GossipHandler
- type GossipStub
- func (g *GossipStub) AddCatalogHandler(h CatalogHandler)
- func (g *GossipStub) CreateGossipHandler(id *pb.PeerID) GossipHandler
- func (g *GossipStub) GetCatalogHandler(cat string) CatalogHandler
- func (g *GossipStub) GetSStub() *pb.StreamStub
- func (g *GossipStub) GetSelf() *pb.PeerID
- func (g *GossipStub) GetStubContext() context.Context
- func (g *GossipStub) NotifyNewPeer(peerid *pb.PeerID, _ *pb.StreamStub)
- func (g *GossipStub) SubScribeNewPeerNotify(h CatalogHandler)
- type PeerPolicies
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultErrorLimit = 3 //peer is allowed to violate policy 3 times/min
View Source
var DefaultInterval = int64(60)
View Source
var DefaultMsgSize = 1024 * 1024 * 16 //msg limit is 16kB/s
View Source
var ObtainHandler func(*pb.StreamHandler) GossipHandler
Functions ¶
func NewCatalogHandlerImpl ¶
func NewCatalogHandlerImpl(stub *pb.StreamStub, ctx context.Context, helper CatalogHelper, m *model.Model) (ret *catalogHandler)
func NewCatalogPolicyDefault ¶
func NewCatalogPolicyDefault() (ret *catalogPolicyImpl)
func NewTokenBucket ¶
func NewTokenBucket(inv int) *tokenBucket
Types ¶
type CatalogHandler ¶
type CatalogHandler interface { Name() string Model() *model.Model //just notify the model is updated SelfUpdate(...*pb.PeerID) HandleUpdate(*pb.GossipMsg_Update, CatalogPeerPolicies) HandleDigest(*pb.StreamHandler, *pb.GossipMsg_Digest, CatalogPeerPolicies) }
type CatalogHelper ¶
type CatalogHelper interface { Name() string GetPolicies() CatalogPolicies //caller do not need to check the interface TransDigestToPb(model.Digest) *pb.GossipMsg_Digest TransPbToDigest(*pb.GossipMsg_Digest) model.Digest TransUpdateToPb(CatalogPeerPolicies, model.Update) *pb.GossipMsg_Update TransPbToUpdate(CatalogPeerPolicies, *pb.GossipMsg_Update) (model.Update, error) }
type CatalogPeerPolicies ¶
type CatalogPolicies ¶
type GossipHandler ¶
type GossipHandler interface { HandleMessage(*pb.StreamHandler, *pb.GossipMsg) error Stop() }
the simplified stream handler
type GossipStub ¶
type GossipStub struct { *pb.StreamStub peerACL.AccessControl // contains filtered or unexported fields }
GossipStub struct
func NewGossipWithPeer ¶
func NewGossipWithPeer(p peer.Peer) *GossipStub
func (*GossipStub) AddCatalogHandler ¶
func (g *GossipStub) AddCatalogHandler(h CatalogHandler)
func (*GossipStub) CreateGossipHandler ¶
func (g *GossipStub) CreateGossipHandler(id *pb.PeerID) GossipHandler
func (*GossipStub) GetCatalogHandler ¶
func (g *GossipStub) GetCatalogHandler(cat string) CatalogHandler
func (*GossipStub) GetSStub ¶
func (g *GossipStub) GetSStub() *pb.StreamStub
func (*GossipStub) GetSelf ¶
func (g *GossipStub) GetSelf() *pb.PeerID
func (*GossipStub) GetStubContext ¶
func (g *GossipStub) GetStubContext() context.Context
func (*GossipStub) NotifyNewPeer ¶
func (g *GossipStub) NotifyNewPeer(peerid *pb.PeerID, _ *pb.StreamStub)
func (*GossipStub) SubScribeNewPeerNotify ¶
func (g *GossipStub) SubScribeNewPeerNotify(h CatalogHandler)
type PeerPolicies ¶
type PeerPolicies interface { GetId() string IsPolicyViolated() error RecvUpdate(int) RecordViolation(e error) AllowRecvUpdate() bool PushUpdateQuota() int PushUpdate(int) ScoringPeer(int, uint) ResetIntervals(int) }
func NewPeerPolicy ¶
func NewPeerPolicy(id string) PeerPolicies
Source Files
¶
Click to show internal directories.
Click to hide internal directories.