central

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WRITE_FORWARD      = "write_forward"
	READ_FORWARD       = "read_forward"
	READ               = "read_request"
	WRITE              = "write_request"
	WRITE_CONFIRMATION = "write_confirmation"
	JOIN               = "join"
	EMPTY              = "empty"
	ACK                = "ack"
	FIRST              = "first" // first person to request for that page.
	I_HAVE_COPY        = "i_have_copy"
	INVALIDATE         = "invalidate"
	SERVER_JOIN        = "server_join"
	FAILURE            = "failure"
	NEW_SERVER         = "new_server"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Central

type Central struct {
	IP         string
	Records    []*Record
	Clientlist []string // List of clients.

	DoIPing          bool
	DoesTheOtherPing bool
	// contains filtered or unexported fields
}

func (*Central) CallCentralRPC added in v1.0.0

func (central *Central) CallCentralRPC(msg message.Message, IP string) message.Message

func (*Central) CallRPC

func (central *Central) CallRPC(msg message.Message, IP string) message.Message

func (*Central) CreateNetwork

func (central *Central) CreateNetwork(backup string)

func (*Central) FlushData added in v1.0.0

func (central *Central) FlushData()

Intended to send message of type: FAILURE to central.otherServer

func (*Central) HandleCopyMessages added in v1.0.0

func (central *Central) HandleCopyMessages(msg *SelfCopyMessage, reply *message.Message) error

func (*Central) HandleIncomingMessage

func (central *Central) HandleIncomingMessage(msg *message.Message, reply *message.Message) error

The default method called by all RPCs. This method receives different types of requests, and calls the appropriate functions.

func (*Central) PingMain added in v1.0.0

func (central *Central) PingMain()

Once ping receives an ACK, we know the main server is back up again. Meaning, we can just send a copy to it, and it will take care of the rest.

func (*Central) PrintClientList

func (central *Central) PrintClientList()

func (*Central) PrintRecords

func (central *Central) PrintRecords()

func (*Central) SelfCopySender added in v1.0.0

func (central *Central) SelfCopySender(failureMessage SelfCopyMessage, IP string) message.Message

type Record

type Record struct {
	PageId  int      // id of the page being stored
	Copies  []string // id of the nodes that have the copy
	OwnerIP string   // id of the nodes that owns the copy
}

To maintain a list of pages, and the corresponding Copies that the clients own.

type SelfCopyMessage added in v1.0.0

type SelfCopyMessage struct {
	Central Central
}

In the event of a failure, this message is sent as a last resort to the backup manager.

Jump to

Keyboard shortcuts

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