grapevine

package module
v0.0.0-...-d7b0689 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 21 Imported by: 1

README

Gossip Algorithm

A gossiper has an account id that uniquely identifies it.

There are a set of messages that need to be distributed. Messages have an expiry

A node will on a tick do the following: - Pick a random node in it's node list and transfer it's gossip table to that node. - It will receive from that random node it's gossip table.

A node will also listen for gossips: - Listen for gossips: receive a gossip table and merge it with it's current table send it's table (only things not sent to it) back

Whenever a node learns about a new node, it stores it in it's gossipmongers table.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCertificatePaths

func GetCertificatePaths() (string, string)

Types

type Grapevine

type Grapevine interface {
	Start(ip net.IP) (int, error)
	Serve(s shareddata.SharedData) shareddata.SharedData
	JoinShare(s shareddata.SharedData)
	LeaveShare(s shareddata.SharedData)
	Invite(s shareddata.SharedData, recipient common.Contact, as string) bool
	Search(key string) shareddata.SearchId
	GetMe() common.Contact
	GetMongers() []common.Address

	CreateAccount(username string, password string) error
	Login(username string, password string, ip net.IP, port int) (common.AccountId, error)
}

func NewGrapevine

func NewGrapevine(cb shareddata.ClientCallback, ctx common.CallCtx) Grapevine

type GrapevineListener

type GrapevineListener interface {
	Listen(net.IP) (int, error)
	GetMe() common.Contact
	GetIp() net.IP
	GetPort() int
	SetGossip(gossip gossip.Gossip)
	SetClientCache(clientCache client.GrapevineClientCache)
	SetAccountId(accountId common.AccountId)
	SetSharedDataManager(sdm shareddata.SharedDataManager)
}

func NewGrapevineListener

func NewGrapevineListener(ctx common.CallCtx,
	onSearchCb func(searchId shareddata.SearchId, query string) bool,
	onSearchResultCb func(searchId shareddata.SearchId, response string, accountId common.AccountId, ip string, port int),
) GrapevineListener

Jump to

Keyboard shortcuts

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