protocol

package
v0.0.0-...-d2861cf Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2018 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PutRequest       = "PUT_REQUEST"
	PutResponse      = "PUT_RESPONSE"
	PutPRequest      = "PUTP_REQUEST"
	PutPResponse     = "PUTP_RESPONSE"
	GetRequest       = "GET_REQUEST"
	GetResponse      = "GET_RESPONSE"
	GetPRequest      = "GETP_REQUEST"
	GetPResponse     = "GETP_RESPONSE"
	GetAllRequest    = "GETALL_REQUEST"
	GetAllResponse   = "GETALL_RESPONSE"
	QueryRequest     = "QUERY_REQUEST"
	QueryResponse    = "QUERY_RESPONSE"
	QueryPRequest    = "QUERYP_REQUEST"
	QueryPResponse   = "QUERYP_RESPONSE"
	QueryAllRequest  = "QUERYALL_REQUEST"
	QueryAllResponse = "QUERYALL_RESPONSE"
	QueryAggRequest  = "QUERYAGG_REQUEST"
	QueryAggResponse = "QUERYAGG_RESPONSE"
	GetAggRequest    = "GETAGG_REQUEST"
	GetAggResponse   = "GETAGG_RESPONSE"
	PutAggRequest    = "PUTAGG_REQUEST"
	PutAggResponse   = "PUTAGG_RESPONSE"
	SizeRequest      = "SIZE_REQUEST"
	SizeResponse     = "SIZE_RESPONSE"
)

Constants used for the messages.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Operation string
	T         interface{}
}

Message is the package that is send across a connection. It contains the type of message, denoted by operation and either a tuple or template, depending on the type of operation.

func CreateMessage

func CreateMessage(operation string, t interface{}) Message

CreateMessage will create the message and return it with the opertaion type and tuple or template specified by the user.

func (*Message) GetBody

func (message *Message) GetBody() interface{}

GetBody will return the body of the message, which can be a template or a tuple.

func (*Message) GetOperation

func (message *Message) GetOperation() string

GetOperation will return the operation of the message.

type PointToPoint

type PointToPoint struct {
	// contains filtered or unexported fields
}

PointToPoint contains information about the receiver, being a user specified name, the IP address and the port number.

func CreatePointToPoint

func CreatePointToPoint(name string, ip string, port string, connc chan *net.Conn, fr *function.Registry) (ptp *PointToPoint)

CreatePointToPoint will concatenate the ip and the port to a string to create an address of the receiver. The created PointToPoint is then returned. One can optionally pass an active connection channel and a function registry.

func (*PointToPoint) GetAddress

func (ptp *PointToPoint) GetAddress() string

GetAddress will return the address of the PointToPoint.

func (*PointToPoint) GetConnectionChannel

func (ptp *PointToPoint) GetConnectionChannel() (connc *chan *net.Conn)

GetConnectionChannel gets the connection of the PointToPoint structure.

func (*PointToPoint) GetName

func (ptp *PointToPoint) GetName() string

GetName will return the name of the PointToPoint.

func (*PointToPoint) GetRegistry

func (ptp *PointToPoint) GetRegistry() (fr *function.Registry)

GetRegistry will return the function registry associated to ptp.

func (*PointToPoint) SetConnectionChannel

func (ptp *PointToPoint) SetConnectionChannel(connc *chan *net.Conn) (b bool)

SetConnectionChannel sets the connection of the PointToPoint structure.

func (*PointToPoint) ToString

func (ptp *PointToPoint) ToString() string

ToString will combine the name and address of the PointToPoint in a readable string and return it.

type WaitingClient

type WaitingClient struct {
	// contains filtered or unexported fields
}

WaitingClient is used as a structure for clients who performed an unsuccessful Get or Query operation, in the sense that it didn't initially found a tuple in the tuple space. This structure stores the necessary information about the client, so that a tuple can be send to it once a matching tuple arrives.

func CreateWaitingClient

func CreateWaitingClient(temp container.Template, tupleChan chan<- *container.Tuple, remove bool) WaitingClient

CreateWaitingClient will create the waiting client with the template that should be used for tuple matching, response channel for the matched tuple to be send to. The remove value will be used to determine if the client performed a Get or Query operation.

func (*WaitingClient) GetOperation

func (waitingClient *WaitingClient) GetOperation() string

GetOperation will return the operation of the waiting client.

func (*WaitingClient) GetResponseChan

func (waitingClient *WaitingClient) GetResponseChan() chan<- *container.Tuple

GetResponseChan will return the response channel of the waiting client.

func (*WaitingClient) GetTemplate

func (waitingClient *WaitingClient) GetTemplate() container.Template

GetTemplate will return the template of the waiting client.

Jump to

Keyboard shortcuts

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