Documentation
¶
Index ¶
- func Filter(update *Update, sources Sources) bool
- func Sort(history []*Update)
- type CreateIdFn
- type IsAccepted
- type Model
- type ModelAccept
- type ModelValueItems
- type Option
- type Scuttlebutt
- func (sb *Scuttlebutt) ApplyUpdates(update *Update) bool
- func (sb *Scuttlebutt) Dispose()
- func (sb *Scuttlebutt) History(peerSources Sources, accept *ModelAccept) []*Update
- func (sb *Scuttlebutt) Id() SourceId
- func (sb *Scuttlebutt) IsAccepted(peerAccept *ModelAccept, update *Update) bool
- func (sb *Scuttlebutt) LocalUpdate(any [2]interface{})
- func (sb *Scuttlebutt) Update(update *Update) bool
- type Sign
- type SourceId
- type Sources
- type Timestamp
- type Update
- type Verify
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateIdFn ¶
type CreateIdFn func() SourceId
type IsAccepted ¶
type Model ¶ added in v1.1.1
type Model interface { IsAccepted(peerAccept *ModelAccept, update *Update) bool // 更新己方消息 ApplyUpdates(update *Update) bool // 根据对端传来的 clock,计算出来的 delta。而 delta 是 Update 集合 // 每个 stream 上记录对端传来的 clock,并且会随着后续从 stream 收到的 Update 不断更新 History(peerSources Sources, accept *ModelAccept) []*Update }
type ModelAccept ¶
type ModelValueItems ¶ added in v1.1.1
type ModelValueItems int
const ( ModelValueItemsKey ModelValueItems = iota ModelValueItemsValue )
type Option ¶
type Option func(*Scuttlebutt)
func WithAccept ¶ added in v1.0.1
func WithAccept(accept *ModelAccept) Option
type Scuttlebutt ¶
type Scuttlebutt struct { Model *event.Emitter Accept *ModelAccept Sources Sources Streams int // contains filtered or unexported fields }
func NewScuttlebutt ¶
func NewScuttlebutt(model Model, opts ...Option) *Scuttlebutt
func (*Scuttlebutt) ApplyUpdates ¶
func (sb *Scuttlebutt) ApplyUpdates(update *Update) bool
func (*Scuttlebutt) Dispose ¶ added in v1.0.1
func (sb *Scuttlebutt) Dispose()
each stream will be ended due to this event
func (*Scuttlebutt) History ¶
func (sb *Scuttlebutt) History(peerSources Sources, accept *ModelAccept) []*Update
func (*Scuttlebutt) Id ¶
func (sb *Scuttlebutt) Id() SourceId
func (*Scuttlebutt) IsAccepted ¶
func (sb *Scuttlebutt) IsAccepted(peerAccept *ModelAccept, update *Update) bool
func (*Scuttlebutt) LocalUpdate ¶
func (sb *Scuttlebutt) LocalUpdate(any [2]interface{})
func (*Scuttlebutt) Update ¶
func (sb *Scuttlebutt) Update(update *Update) bool
Click to show internal directories.
Click to hide internal directories.