statematrix

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package statematrix stores and provides useful operations on an state matrix for the Epidemic Broadcast Tree protocol.

The state matrix represents multiple _network frontiers_ (or vector clock).

This version uses a SQL because that seems much handier to handle such an irregular sparse matrix.

Q: * do we need a 2nd _told us about_ table?

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HasLongerResult

type HasLongerResult struct {
	Peer refs.FeedRef
	Feed refs.FeedRef
	Len  uint64
}

func (HasLongerResult) String

func (hlr HasLongerResult) String() string

type ObservedFeed

type ObservedFeed struct {
	Feed refs.FeedRef

	ssb.Note
}

type StateMatrix

type StateMatrix struct {
	// contains filtered or unexported fields
}

func New

func New(base string, self refs.FeedRef) (*StateMatrix, error)

func (*StateMatrix) Changed

func (sm *StateMatrix) Changed(self, peer refs.FeedRef) (ssb.NetworkFrontier, error)

Changed returns which feeds have newer messages since last update

func (*StateMatrix) Close

func (sm *StateMatrix) Close() error

func (*StateMatrix) Fill

func (sm *StateMatrix) Fill(who refs.FeedRef, feeds []ObservedFeed) error

Fill might be deprecated. It just updates the current frontier state

func (*StateMatrix) HasLonger

func (sm *StateMatrix) HasLonger() ([]HasLongerResult, error)

HasLonger returns all the feeds which have more messages then we have and who has them.

func (*StateMatrix) Inspect added in v0.2.1

func (sm *StateMatrix) Inspect(peer refs.FeedRef) (ssb.NetworkFrontier, error)

Inspect returns the current frontier for the passed peer

func (*StateMatrix) SaveAndClose

func (sm *StateMatrix) SaveAndClose(peer refs.FeedRef) error

func (*StateMatrix) StateFileName

func (sm *StateMatrix) StateFileName(peer refs.FeedRef) (string, error)

func (*StateMatrix) Update

func (sm *StateMatrix) Update(who refs.FeedRef, update ssb.NetworkFrontier) (ssb.NetworkFrontier, error)

Update gets the current state from who, overwrites the notes in current with the new ones from the passed update and returns the complet updated frontier.

func (*StateMatrix) WantsFeed

func (sm *StateMatrix) WantsFeed(peer, feed refs.FeedRef) (bool, error)

WantsFeed returns true if peer want's to receive feed

func (*StateMatrix) WantsList

func (sm *StateMatrix) WantsList(peer refs.FeedRef) ([]refs.FeedRef, error)

WantsList returns all the feeds a peer wants to recevie messages for

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL