node

package
v0.0.0-...-7e26b3d Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConnection

func GetConnection(addr string) *grpc.ClientConn

Types

type Node

type Node struct {
	protos.UnimplementedMutualExclusionServer

	Id         int
	Addr       string
	PeerAddr   string
	Peer       *Peer
	GrpcServer *grpc.Server

	IsTokenHolder bool
	// contains filtered or unexported fields
}

func NewNode

func NewNode(id int, addr string) *Node

func (*Node) CritcalZoneTimer

func (node *Node) CritcalZoneTimer()

func (*Node) EnterCriticalZone

func (node *Node) EnterCriticalZone()

CRITICAL ZONE (CZ)

func (*Node) Listen

func (node *Node) Listen()

SERVER Methods

func (*Node) Running

func (node *Node) Running(peer *Peer)

func (*Node) TokenRing

func (node *Node) TokenRing(msg *protos.Message, stream protos.MutualExclusion_TokenRingServer) error

type Peer

type Peer struct {
	Addr string // network address
	// contains filtered or unexported fields
}

peer is the the remote node that a local node can connect to.

func CreatePeer

func CreatePeer(port string) *Peer

func NewPeer

func NewPeer(addr string) *Peer

func (*Peer) Recieve

func (peer *Peer) Recieve(client protos.MutualExclusionClient)

func (*Peer) Running

func (peer *Peer) Running(node_ *Node)

Jump to

Keyboard shortcuts

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