Documentation ¶
Index ¶
- Constants
- type Client
- func (client *Client) CallCentralRPC(msg message.Message, IP string) message.Message
- func (client *Client) CallRPC(msg message.Message, IP string) message.Message
- func (client *Client) HandleIncomingMessage(msg *message.Message, reply *message.Message) error
- func (client *Client) JoinNetwork(helper string)
- func (client *Client) PrintCentralIP()
- func (client *Client) PrintClientList()
- func (client *Client) PrintPages()
- func (client *Client) ReadRequest()
- func (client *Client) WriteRequest()
- type Page
Constants ¶
View Source
const ( WRITE_MODE = "write" READ_MODE = "read" )
Page access mode types
View Source
const ( INVALIDATE = "invalidate" READ = "read_request" READ_FORWARD = "read_forward" WRITE_FORWARD = "write_forward" WRITE = "write_request" WRITE_CONFIRMATION = "write_confirmation" EMPTY = "empty" JOIN = "join" COPY = "copy" WRITE_COPY = "write_copy" FIRST = "first" // When you're the first node requesting read access to the page, so you can directly set it's ACK = "ack" I_HAVE_COPY = "i_have_copy" NEW_SERVER = "new_server" )
Message types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { IP string Cache map[int]Page // List of pages in its cache. pageId -> Page{Content, Access Mode} ServerIP string Clientlist []string Timestamp int // scalar clock to indicate when the request was made. If there are concurrent requests, then we need to break ties }
func (*Client) CallCentralRPC ¶
func (*Client) HandleIncomingMessage ¶
The default method called by all RPCs. This method receives different types of requests, and calls the appropriate functions.
func (*Client) JoinNetwork ¶
func (*Client) PrintCentralIP ¶
func (client *Client) PrintCentralIP()
func (*Client) PrintClientList ¶
func (client *Client) PrintClientList()
func (*Client) PrintPages ¶ added in v1.0.0
func (client *Client) PrintPages()
func (*Client) WriteRequest ¶
func (client *Client) WriteRequest()
Click to show internal directories.
Click to hide internal directories.