Documentation ¶
Overview ¶
Package adminport provides admin-port client/server library that can be used by system components to talk with each other. It is based on request/response protocol, by default used http for transport and protobuf, JSON for payload. Admin port can typically be used for collecting statistics, administering and managing cluster.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrorDecodeRequest = errors.New("adminport.decodeRequest")
ErrorDecodeRequest
var ErrorDecodeResponse = errors.New("adminport.decodeResponse")
ErrorDecodeResponse
var ErrorEncodeResponse = errors.New("adminport.encodeResponse")
ErrorEncodeResponse
var ErrorInternal = errors.New("adminport.internal")
ErrorInternal
var ErrorMessageUnknown = errors.New("adminport.unknownMessage")
ErrorMessageUnknown
var ErrorPathNotFound = errors.New("adminport.pathNotFound")
ErrorPathNotFound
var ErrorRegisteringRequest = errors.New("adminport.registeringRequest")
ErrorRegisteringRequest
var ErrorRequest = errors.New("adminport.request")
ErrorRequest
var ErrorServerStarted = errors.New("adminport.serverStarted")
ErrorServerStarted
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Request shall post a `request` message to server, wait for response and // decode response into `response` argument. `response` argument must be a // pointer to an object implementing `MessageMarshaller` interface. Request(request, response MessageMarshaller) (err error) }
Client API for a remote adminport
func NewHTTPClient ¶
NewHTTPClient returns a new instance of Client over HTTP.
type MessageMarshaller ¶
type MessageMarshaller interface { // Name of the message Name() string // Content type to be used by the transport layer. ContentType() string // Encode function shall marshal message to byte array. Encode() (data []byte, err error) // Decode function shall unmarshal byte array back to message. Decode(data []byte) (err error) }
MessageMarshaller APIs message format.
type Request ¶
type Request interface { // Get message from request packet. GetMessage() MessageMarshaller // Send a response message back to the client. Send(MessageMarshaller) error // Send error back to the client. SendError(error) error }
Request API for server application to handle incoming request.
type Server ¶
type Server interface { // Register a request message that shall be supported by adminport-server Register(msg MessageMarshaller) error // RegisterHandler a request message that shall be supported by // adminport-server RegisterHTTPHandler(pattern string, handler interface{}) error // Unregister a previously registered request message Unregister(msg MessageMarshaller) error // Start server routine and wait for incoming request, Register() and // Unregister() APIs cannot be called after starting the server. Start() error // GetStatistics returns server statistics. GetStatistics() c.Statistics // Stop server routine. Stop() }
Server API for adminport