gossiper

package
v0.0.0-...-2b12960 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PUT    = "PUT"
	DELETE = "DELETE"
)
View Source
const FIXED_DIFF = 400
View Source
const HEARTBEAT_PATH = "heartbeat"
View Source
const HEARTBEAT_PORT = ":8002"
View Source
const HEARTBEAT_TIMEOUT = 1000
View Source
const SYNC_PORT = 8001

Variables

This section is empty.

Functions

func NewPair

func NewPair(key, val string) pair

func NewPeer

func NewPeer(name, ip string) *peer

func NewPeerFromGossiper

func NewPeerFromGossiper(g *Gossiper) *peer

func Newdb

func Newdb(path string) (int, *mydb, error)

func Newlogger

func Newlogger() *logger

func TearDown

func TearDown(name string)

TearDown Delete the trace of testcase

Types

type Gossiper

type Gossiper struct {
	SyncServer genSync.GenSync
	// contains filtered or unexported fields
}

func NewGossiper

func NewGossiper(name, ip string) *Gossiper

func (*Gossiper) AddPeer

func (g *Gossiper) AddPeer(p *peer) int

func (*Gossiper) CheckSyncClient

func (g *Gossiper) CheckSyncClient()

func (*Gossiper) Delete

func (g *Gossiper) Delete(key string)

func (*Gossiper) Get

func (g *Gossiper) Get(key string) string

func (*Gossiper) GetDB

func (g *Gossiper) GetDB() *mydb

func (*Gossiper) GetHeartBeatTimer

func (g *Gossiper) GetHeartBeatTimer() *time.Timer

func (*Gossiper) GetIP

func (g *Gossiper) GetIP() string

func (*Gossiper) GetLogger

func (g *Gossiper) GetLogger() *logger

func (*Gossiper) GetName

func (g *Gossiper) GetName() string

func (*Gossiper) GetPeers

func (g *Gossiper) GetPeers() map[string]*peer

func (*Gossiper) GetTerminateChan

func (g *Gossiper) GetTerminateChan() chan int

func (*Gossiper) HeartBeatHandler

func (g *Gossiper) HeartBeatHandler(w http.ResponseWriter, r *http.Request)

func (*Gossiper) HeartBeatReceiver

func (g *Gossiper) HeartBeatReceiver()

func (*Gossiper) PopLeft

func (g *Gossiper) PopLeft() logEntry

func (*Gossiper) PrintPeerNames

func (g *Gossiper) PrintPeerNames()

func (*Gossiper) Push

func (g *Gossiper) Push(l logEntry)

func (*Gossiper) Put

func (g *Gossiper) Put(key, value string)

func (*Gossiper) ReadLogsFromFile

func (g *Gossiper) ReadLogsFromFile()

func (*Gossiper) RemovePeer

func (g *Gossiper) RemovePeer(name string) int

func (*Gossiper) SendHeartBeat

func (g *Gossiper) SendHeartBeat(p *peer) (int, error)

func (*Gossiper) SendHeartBeats

func (g *Gossiper) SendHeartBeats() (int, error)

func (*Gossiper) Start

func (g *Gossiper) Start()

func (*Gossiper) Stop

func (g *Gossiper) Stop()

func (*Gossiper) SyncClientStart

func (g *Gossiper) SyncClientStart(logEntryNum int)

func (*Gossiper) SyncServerStart

func (g *Gossiper) SyncServerStart()

func (*Gossiper) WriteLogToFile

func (g *Gossiper) WriteLogToFile()

func (*Gossiper) WritePeersToFile

func (g *Gossiper) WritePeersToFile()

type PeerPair

type PeerPair struct {
	Name string
	IP   string
}

func ReadPeersFromFile

func ReadPeersFromFile(name string) []PeerPair

Jump to

Keyboard shortcuts

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