Documentation ¶
Overview ¶
Package gossip_model is a generated protocol buffer package.
It is generated from these files:
scuttlebutt_msgtest_export.proto
It has these top-level messages:
Test_Scuttlebutt_Peer Test_Scuttlebutt
Index ¶
- Variables
- func DumpScuttlebutt(m *Model) *scuttlebuttStatus
- func DumpUpdate(u_in Update) (ret map[string]map[string]int)
- func NewScuttlebuttStatus(gs ScuttlebuttStatus) *scuttlebuttStatus
- func NewTestPeer(t *testing.T, id string) *testPeer
- func NewscuttlebuttDigest(gd Digest) *scuttlebuttDigest
- func NewscuttlebuttUpdate(gu Update) *scuttlebuttUpdateIn
- func TestDigestToPb(d_in Digest) *pb.GossipMsg_Digest
- func TestUpdateEncode(u_in Update) *pb.GossipMsg_Update
- type Digest
- type Model
- type Puller
- type PullerHelper
- type PushHelper
- type ScuttlebuttDigest
- type ScuttlebuttPeerStatus
- type ScuttlebuttPeerUpdate
- type ScuttlebuttStatus
- type ScuttlebuttUpdate
- type Status
- type TestPeer
- type Test_Scuttlebutt
- type Test_Scuttlebutt_Peer
- type Update
- type VClock
Constants ¶
This section is empty.
Variables ¶
var BottomClock = limitClock(true) //earlier than anything
any other implement should consider these values before type switch, just like "nil"
var EmptyDigest = errors.New("digest is null")
var EmptyUpdate = errors.New("update is null")
var TopClock = limitClock(false) //later than anything
Functions ¶
func DumpScuttlebutt ¶
func DumpScuttlebutt(m *Model) *scuttlebuttStatus
func NewScuttlebuttStatus ¶
func NewScuttlebuttStatus(gs ScuttlebuttStatus) *scuttlebuttStatus
func NewTestPeer ¶
func NewscuttlebuttDigest ¶
func NewscuttlebuttDigest(gd Digest) *scuttlebuttDigest
func NewscuttlebuttUpdate ¶
func NewscuttlebuttUpdate(gu Update) *scuttlebuttUpdateIn
func TestDigestToPb ¶
func TestDigestToPb(d_in Digest) *pb.GossipMsg_Digest
func TestUpdateEncode ¶
func TestUpdateEncode(u_in Update) *pb.GossipMsg_Update
Types ¶
type Digest ¶
type Digest interface{}
Base concept in gossip protocol
func TestPbToDigest ¶
func TestPbToDigest(dig *pb.GossipMsg_Digest) Digest
type Model ¶
Now we have the model
func NewGossipModel ¶
func (*Model) GenPullDigest ¶
gen the "pull" digest to far-end
func (*Model) RecvPullDigest ¶
recv the digest from a "pulling" far-end
func (*Model) RecvUpdate ¶
recv the reconciliation message and update status
func (*Model) TriggerReadOnlyMode ¶
type Puller ¶
type Puller struct {
// contains filtered or unexported fields
}
func AcceptPulling ¶
func AcceptPulling(p PushHelper, stream *pb.StreamHandler, model *Model, d Digest) (*Puller, error)
d can be set to nil and just return empty update (sometimes this indicate an "invitation" of pulling) Pulling process including two steps: 1. handling incoming digest and response a update 2. optional: start a "responding" pull the message among these two step is fixed: that is, the updating in step 1 must be sent after the digest sent in step 2 (unless step 2 is omitted)
The whole process is considered to be time-consuming: model and helper need to tailor the update to fit it into a suitable message size, and in a pulling process to decide a subset of peers in digest may require many evaluations
func StartPulling ¶
func StartPulling(p PullerHelper, stream *pb.StreamHandler) (*Puller, error)
func (*Puller) NotifyUpdate ¶
func (*Puller) Start ¶
func (p *Puller) Start(ph PullerHelper, stream *pb.StreamHandler) error
type PullerHelper ¶
type PushHelper ¶
type PushHelper interface { PullerHelper //must allow nil input and encode an message include "empty" update EncodeUpdate(Update) proto.Message }
The push-pull model: peer can only trigger a "pushing" by start pulling and wait for another end do a "responding" pulling for it
type ScuttlebuttDigest ¶
type ScuttlebuttPeerStatus ¶
type ScuttlebuttPeerStatus interface { To() VClock PickFrom(VClock, Update) (ScuttlebuttPeerUpdate, Update) Update(string, ScuttlebuttPeerUpdate, ScuttlebuttStatus) error }
type ScuttlebuttPeerUpdate ¶
type ScuttlebuttPeerUpdate interface {
To() VClock
}
scuttlebutt scheme maintain per-peer status work with vclock digest
type ScuttlebuttStatus ¶
type ScuttlebuttStatus interface { Status NewPeer(string) ScuttlebuttPeerStatus RemovePeer(string, ScuttlebuttPeerStatus) MissedUpdate(string, ScuttlebuttPeerUpdate) error }
scuttlebuttStatusHelper provide a per-peer status managing
type ScuttlebuttUpdate ¶
type ScuttlebuttUpdate interface { GlobalUpdate() Update PeerUpdate() []peersUpdate }
type Test_Scuttlebutt ¶
type Test_Scuttlebutt struct {
Peers map[string]*Test_Scuttlebutt_Peer `` /* 130-byte string literal not displayed */
}
func (*Test_Scuttlebutt) Descriptor ¶
func (*Test_Scuttlebutt) Descriptor() ([]byte, []int)
func (*Test_Scuttlebutt) GetPeers ¶
func (m *Test_Scuttlebutt) GetPeers() map[string]*Test_Scuttlebutt_Peer
func (*Test_Scuttlebutt) ProtoMessage ¶
func (*Test_Scuttlebutt) ProtoMessage()
func (*Test_Scuttlebutt) Reset ¶
func (m *Test_Scuttlebutt) Reset()
func (*Test_Scuttlebutt) String ¶
func (m *Test_Scuttlebutt) String() string
type Test_Scuttlebutt_Peer ¶
type Test_Scuttlebutt_Peer struct {
Datas map[string]int32 `` /* 131-byte string literal not displayed */
}
func (*Test_Scuttlebutt_Peer) Descriptor ¶
func (*Test_Scuttlebutt_Peer) Descriptor() ([]byte, []int)
func (*Test_Scuttlebutt_Peer) GetDatas ¶
func (m *Test_Scuttlebutt_Peer) GetDatas() map[string]int32
func (*Test_Scuttlebutt_Peer) ProtoMessage ¶
func (*Test_Scuttlebutt_Peer) ProtoMessage()
func (*Test_Scuttlebutt_Peer) Reset ¶
func (m *Test_Scuttlebutt_Peer) Reset()
func (*Test_Scuttlebutt_Peer) String ¶
func (m *Test_Scuttlebutt_Peer) String() string
type Update ¶
type Update interface {
Gossip_IsUpdateIn() bool
}
Update is the content of a reconciliation
func TestUpdateDecode ¶
func TestUpdateDecode(msg_in *pb.GossipMsg_Update) Update