Documentation ¶
Index ¶
- Constants
- type Central
- func (central *Central) CallCentralRPC(msg message.Message, IP string) message.Message
- func (central *Central) CallRPC(msg message.Message, IP string) message.Message
- func (central *Central) CreateNetwork(backup string)
- func (central *Central) FlushData()
- func (central *Central) HandleCopyMessages(msg *SelfCopyMessage, reply *message.Message) error
- func (central *Central) HandleIncomingMessage(msg *message.Message, reply *message.Message) error
- func (central *Central) PingMain()
- func (central *Central) PrintClientList()
- func (central *Central) PrintRecords()
- func (central *Central) SelfCopySender(failureMessage SelfCopyMessage, IP string) message.Message
- type Record
- type SelfCopyMessage
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) CreateNetwork ¶
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.