Documentation
¶
Index ¶
- func JoinMessages(messages []string) string
- func MultiPart(messages []string) bool
- func RawTraceIndex(messages []string) int
- func SyncReplierEnvelope(messages []string) bool
- func ValidCommand(cmd string) error
- func ValidFail(status ReplyStatus, msg string) error
- func ValidStatus(status ReplyStatus) error
- type NewGenericReply
- type NewGenericReq
- type Operations
- type RawReply
- func (reply *RawReply) Bytes() ([]byte, error)
- func (reply *RawReply) ConId() string
- func (reply *RawReply) ErrorMessage() string
- func (reply *RawReply) IsOK() bool
- func (reply *RawReply) ReplyParameters() key_value.KeyValue
- func (reply *RawReply) SetConId(conId string)
- func (reply *RawReply) SetStack(serviceUrl string, serverName string, serverInstance string) error
- func (reply *RawReply) String() string
- func (reply *RawReply) Traces() []*Stack
- func (reply *RawReply) ZmqEnvelope() ([]string, error)
- type RawRequest
- func (request *RawRequest) AddRequestStack(serviceUrl string, serverName string, serverInstance string)
- func (request *RawRequest) Bytes() ([]byte, error)
- func (request *RawRequest) CommandName() string
- func (request *RawRequest) ConId() string
- func (request *RawRequest) Fail(message string) ReplyInterface
- func (request *RawRequest) IsFirst() bool
- func (request *RawRequest) Next(command string, parameters key_value.KeyValue)
- func (request *RawRequest) Ok(parameters key_value.KeyValue) ReplyInterface
- func (request *RawRequest) PublicKey() string
- func (request *RawRequest) RouteParameters() key_value.KeyValue
- func (request *RawRequest) SetConId(conId string)
- func (request *RawRequest) SetMeta(meta map[string]string)
- func (request *RawRequest) SetPublicKey(publicKey string)
- func (request *RawRequest) SetUuid()
- func (request *RawRequest) String() string
- func (request *RawRequest) SyncTrace(reply ReplyInterface)
- func (request *RawRequest) Traces() []*Stack
- func (request *RawRequest) ZmqEnvelope() ([]string, error)
- type Reply
- func (reply *Reply) Bytes() ([]byte, error)
- func (reply *Reply) ConId() string
- func (reply *Reply) ErrorMessage() string
- func (reply *Reply) IsOK() bool
- func (reply *Reply) ReplyParameters() key_value.KeyValue
- func (reply *Reply) SetConId(conId string)
- func (reply *Reply) SetStack(serviceUrl string, serverName string, serverInstance string) error
- func (reply *Reply) String() string
- func (reply *Reply) Traces() []*Stack
- func (reply *Reply) ZmqEnvelope() ([]string, error)
- type ReplyFunc
- type ReplyInterface
- type ReplyStatus
- type ReqFunc
- type Request
- func (request *Request) AddRequestStack(serviceUrl string, serverName string, serverInstance string)
- func (request *Request) Bytes() ([]byte, error)
- func (request *Request) CommandName() string
- func (request *Request) ConId() string
- func (request *Request) Fail(message string) ReplyInterface
- func (request *Request) IsFirst() bool
- func (request *Request) Next(command string, parameters key_value.KeyValue)
- func (request *Request) Ok(parameters key_value.KeyValue) ReplyInterface
- func (request *Request) PublicKey() string
- func (request *Request) RouteParameters() key_value.KeyValue
- func (request *Request) SetConId(conId string)
- func (request *Request) SetMeta(meta map[string]string)
- func (request *Request) SetPublicKey(publicKey string)
- func (request *Request) SetUuid()
- func (request *Request) String() string
- func (request *Request) SyncTrace(reply ReplyInterface)
- func (request *Request) Traces() []*Stack
- func (request *Request) ZmqEnvelope() ([]string, error)
- type RequestInterface
- type Stack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JoinMessages ¶
JoinMessages into the single string the array of zeromq rawReq
func RawTraceIndex ¶
func SyncReplierEnvelope ¶
func ValidCommand ¶
ValidCommand checks if the reply type is failure, then THe message should be given too
func ValidFail ¶
func ValidFail(status ReplyStatus, msg string) error
ValidFail checks if the reply type is failure, then THe message should be given too
func ValidStatus ¶
func ValidStatus(status ReplyStatus) error
ValidStatus validates the status of the reply. It should be either OK or fail.
Types ¶
type NewGenericReply ¶
type NewGenericReply = func() ReplyInterface
type NewGenericReq ¶
type NewGenericReq = func() RequestInterface
type Operations ¶
type Operations struct { Name string NewReq ReqFunc NewReply ReplyFunc EmptyReq NewGenericReq EmptyReply NewGenericReply }
func DefaultMessage ¶
func DefaultMessage() *Operations
DefaultMessage returns a message for parsing request and parsing reply.
func RawMessage ¶
func RawMessage() *Operations
RawMessage returns a message for parsing request and parsing reply.
type RawReply ¶
type RawReply struct { Uuid string // contains filtered or unexported fields }
func (*RawReply) ErrorMessage ¶
ErrorMessage if it was a Reply
func (*RawReply) ReplyParameters ¶
ReplyParameters returns the parameters if it was a Reply
func (*RawReply) ZmqEnvelope ¶
ZmqEnvelope the message
type RawRequest ¶
type RawRequest struct { Uuid string // contains filtered or unexported fields }
RawRequest is the wrapper around zeromq message envelope.
func (*RawRequest) AddRequestStack ¶
func (request *RawRequest) AddRequestStack(serviceUrl string, serverName string, serverInstance string)
AddRequestStack adds the new trace into the request. This method shall be called by the handlers. Users should not work with this.
func (*RawRequest) Bytes ¶
func (request *RawRequest) Bytes() ([]byte, error)
Bytes convert the message to the sequence of bytes
func (*RawRequest) CommandName ¶
func (request *RawRequest) CommandName() string
CommandName returns the command name if it was a Request
func (*RawRequest) ConId ¶
func (request *RawRequest) ConId() string
ConId returns a connection id for each sending session.
func (*RawRequest) Fail ¶
func (request *RawRequest) Fail(message string) ReplyInterface
Fail creates a new Reply as a failure It accepts the error message that explains the reason of the failure.
func (*RawRequest) IsFirst ¶
func (request *RawRequest) IsFirst() bool
IsFirst returns true if the request has no trace,
For example, if the proxy inserts it.
func (*RawRequest) Next ¶
func (request *RawRequest) Next(command string, parameters key_value.KeyValue)
Next creates a new request based on the previous one. It uses the Request.
func (*RawRequest) Ok ¶
func (request *RawRequest) Ok(parameters key_value.KeyValue) ReplyInterface
func (*RawRequest) PublicKey ¶
func (request *RawRequest) PublicKey() string
PublicKey For security; Work in Progress.
func (*RawRequest) RouteParameters ¶
func (request *RawRequest) RouteParameters() key_value.KeyValue
RouteParameters returns the parameters if it was a Request
func (*RawRequest) SetConId ¶
func (request *RawRequest) SetConId(conId string)
func (*RawRequest) SetMeta ¶
func (request *RawRequest) SetMeta(meta map[string]string)
func (*RawRequest) SetPublicKey ¶
func (request *RawRequest) SetPublicKey(publicKey string)
SetPublicKey For security; Work in Progress.
func (*RawRequest) SetUuid ¶
func (request *RawRequest) SetUuid()
func (*RawRequest) SyncTrace ¶
func (request *RawRequest) SyncTrace(reply ReplyInterface)
SyncTrace is if the reply has more stacks, the request is updated with it. The reply is generated by request.Next(). Once the request.Next() was used, the reply is returned. Update the request with the reply parameters
func (*RawRequest) Traces ¶
func (request *RawRequest) Traces() []*Stack
func (*RawRequest) ZmqEnvelope ¶
func (request *RawRequest) ZmqEnvelope() ([]string, error)
ZmqEnvelope the message
type Reply ¶
type Reply struct { Uuid string `json:"uuid,omitempty"` Trace []*Stack `json:"traces,omitempty"` Status ReplyStatus `json:"status"` // message.OK or message.FAIL Message string `json:"message"` // If Status is fail, then the field will contain an error message. Parameters key_value.KeyValue `json:"parameters"` // If the Status is OK, then the field will contain the parameters. // contains filtered or unexported fields }
Reply SDS Service returns the reply. Anyone who sends a request to the SDS Service gets this message.
func (*Reply) ErrorMessage ¶
func (*Reply) ReplyParameters ¶
func (*Reply) ZmqEnvelope ¶
type ReplyFunc ¶
type ReplyFunc = func(zmqEnvelope []string) (ReplyInterface, error)
type ReplyInterface ¶
type ReplyInterface interface { ConId() string SetConId(string) // SetStack adds the current service's server into the reply SetStack(serviceUrl string, serverName string, serverInstance string) error // IsOK returns the Status of the message. IsOK() bool // String converts the Reply to the string format. Empty if occurred an error. // It implements Stringer interface from a standard library String() string // ZmqEnvelope converts the message to the zeromq envelope ZmqEnvelope() ([]string, error) // Bytes converts Reply to the sequence of bytes Bytes() ([]byte, error) Traces() []*Stack ErrorMessage() string ReplyParameters() key_value.KeyValue }
func NewEmptyRawReply ¶
func NewEmptyRawReply() ReplyInterface
func NewEmptyReply ¶
func NewEmptyReply() ReplyInterface
func NewRawRep ¶
func NewRawRep(messages []string) (ReplyInterface, error)
func NewRep ¶
func NewRep(messages []string) (ReplyInterface, error)
NewRep decodes Zeromq messages into Reply.
type ReplyStatus ¶
type ReplyStatus string
ReplyStatus can be only as "OK" or "fail" It indicates whether the reply message is correct or not.
const ( OK ReplyStatus = "OK" FAIL ReplyStatus = "fail" )
type ReqFunc ¶
type ReqFunc = func(zmqEnvelope []string) (RequestInterface, error)
type Request ¶
type Request struct { Uuid string `json:"uuid,omitempty"` Trace []*Stack `json:"traces,omitempty"` Command string `json:"command"` Parameters key_value.KeyValue `json:"parameters"` // contains filtered or unexported fields }
Request message sent by Client socket and accepted by ControllerCategory socket.
func (*Request) AddRequestStack ¶
func (*Request) CommandName ¶
CommandName returns a command name
func (*Request) Fail ¶
func (request *Request) Fail(message string) ReplyInterface
Fail creates a new Reply as a failure It accepts the error message that explains the reason of the failure.
func (*Request) IsFirst ¶
IsFirst returns true if the request has no trace,
For example, if the proxy inserts it.
func (*Request) RouteParameters ¶
RouteParameters returns a command name
func (*Request) SetPublicKey ¶
SetPublicKey For security; Work in Progress.
func (*Request) SyncTrace ¶
func (request *Request) SyncTrace(reply ReplyInterface)
SyncTrace is if the reply has more stacks, the request is updated with it.
func (*Request) ZmqEnvelope ¶
type RequestInterface ¶
type RequestInterface interface { // ConId returns a connection id for each sending session. ConId() string SetConId(string) // IsFirst returns true if the request has no trace request or id, IsFirst() bool SyncTrace(ReplyInterface) AddRequestStack(serviceUrl string, serverName string, serverInstance string) // Bytes convert the message to the sequence of bytes Bytes() ([]byte, error) // PublicKey For security; Work in Progress. PublicKey() string // SetPublicKey For security; Work in Progress. SetPublicKey(publicKey string) // String implements the Stringer interface from a standard library String() string // ZmqEnvelope converts the message to the zeromq envelope ZmqEnvelope() ([]string, error) SetUuid() // Next creates a new request based on the previous one. Next(command string, parameters key_value.KeyValue) // Fail creates a new Reply as a failure // It accepts the error message that explains the reason of the failure. Fail(message string) ReplyInterface Ok(parameters key_value.KeyValue) ReplyInterface Traces() []*Stack SetMeta(map[string]string) CommandName() string RouteParameters() key_value.KeyValue }
RequestInterface generic requests
func NewEmptyRawReq ¶
func NewEmptyRawReq() RequestInterface
func NewEmptyReq ¶
func NewEmptyReq() RequestInterface
func NewRawReq ¶
func NewRawReq(messages []string) (RequestInterface, error)
NewRawReq from the zeromq rawReq.
func NewReq ¶
func NewReq(messages []string) (RequestInterface, error)
NewReq from the zeromq messages
type Stack ¶
type Stack struct { RequestTime uint64 `json:"request_time"` ReplyTime uint64 `json:"reply_time,omitempty"` Command string `json:"command"` ServiceUrl string `json:"service_url"` ServerName string `json:"server_name"` ServerInstance string `json:"server_instance"` }
Stack keeps the parameters of the message in the service.