Documentation ¶
Index ¶
- Constants
- type Error
- type Method
- type Service
- func (service Service) LogDebug(args ...interface{})
- func (service Service) LogError(args ...interface{})
- func (service Service) LogInfo(args ...interface{})
- func (service Service) Match(err *Error) *Error
- func (service Service) Register(method Method)
- func (service Service) RegisterError(e Error)
- func (service Service) Run()
- func (service Service) SThrow(id string, text string) *Error
- func (service Service) Send(name string, request interface{}) (interface{}, *Error)
- func (service Service) Throw(id string, err error) *Error
Constants ¶
View Source
const ( // ErrGeneric is a generic, internal error. ErrGeneric = "hive.internal.generic" // ErrNetwork is a internal network error. ErrNetwork = "hive.internal.network" // ErrRequest is a internal request error. ErrRequest = "hive.internal.request" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
Error stores service error IDs, texts and status codes.
type Method ¶
type Method interface { GetRequestType() reflect.Type GetResponseType() reflect.Type GetName() string HandleRequest(*Service, interface{}) (interface{}, *Error) }
Method is a abstract interface representing a service method.
type Service ¶
type Service struct { Name string `json:"name"` DNSName string `json:"dnsname"` Version string `json:"version"` Methods map[string]Method `json:"methods"` Protocol string `json:"protocol"` Socket string `json:"socket"` Timeout time.Duration `json:"timeout"` Context map[string]interface{} `json:"context"` ForwardLocal bool `json:"forwardLocal"` KnownErrors map[string]Error `json:"errors"` }
Service is a microservice infrastructure abstraction.
func (Service) LogDebug ¶
func (service Service) LogDebug(args ...interface{})
LogDebug logs an message of log level Debug.
func (Service) LogError ¶
func (service Service) LogError(args ...interface{})
LogError logs an message of log level Error.
func (Service) LogInfo ¶
func (service Service) LogInfo(args ...interface{})
LogInfo logs an message of log level Info.
func (Service) RegisterError ¶
RegisterError registers a new error code.
Click to show internal directories.
Click to hide internal directories.