Documentation ¶
Index ¶
- func Btoi64(val []byte) int64
- func CopyFile(src, dst string) error
- func I64tob(val int64) []byte
- type Int32IdGen
- type NokResponse
- type OkResponse
- type PauseReq
- type Request
- type RequestBase
- type Responder
- type ResponderBase
- type Response
- type ResponseBase
- type ResumeReq
- type StartReq
- type StopReq
- type U16IDGen
- type U32IDGen
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Int32IdGen ¶
type Int32IdGen struct {
// contains filtered or unexported fields
}
Int32IdGen is a generator of int32 ids
func NewInt32IdGen ¶
func NewInt32IdGen(name string) *Int32IdGen
NewInt32IdGen creates a new U16IDGen
type NokResponse ¶
type NokResponse struct {
ResponseBase
}
NokResponse is a default Not OK response with an optional error string.
type OkResponse ¶
type OkResponse struct {
ResponseBase
}
OkResponse is a default response that says 'the operation went well', or maybe something specified in the message?
type Request ¶
type Request interface { ResponseChannel() chan Response // Some responses are more common than others, provide these in // the interface Ok(...string) Nok(...string) }
A Request is done to a thread that we expect a synchrounous response to from a Responder.
type RequestBase ¶
type RequestBase struct {
// contains filtered or unexported fields
}
RequestBase is a base implementation of a Request
func (RequestBase) Nok ¶
func (r RequestBase) Nok(msg ...string)
Nok sends an Nok back as the response
func (RequestBase) ResponseChannel ¶
func (r RequestBase) ResponseChannel() chan Response
ResponseChannel returns the channel on which the response should be sent
type Responder ¶
type Responder interface {
RequestChannel() chan Request
}
A Responder respondes to requests. The reqChannel is the channel the requests enters on.
type ResponderBase ¶
type ResponderBase struct {
// contains filtered or unexported fields
}
ResponderBase implements a basic Responder
func NewResponderBase ¶
func NewResponderBase() ResponderBase
NewResponderBase creates a new Responder
func (ResponderBase) Request ¶
func (r ResponderBase) Request(req Request, timeout float32) Response
Request is a client routing trying to send a request to the ResponderBase. If there is no response within timeout, then the request is cancelled.
func (ResponderBase) RequestChannel ¶
func (r ResponderBase) RequestChannel() chan Request
RequestChannel returns the channel to send requests on
type ResponseBase ¶
type ResponseBase struct {
Message []string
}
ResponseBase can be used as a base response that differs responses between Ok/Nok and that carries a message
type U16IDGen ¶
type U16IDGen struct {
// contains filtered or unexported fields
}
U16IDGen is a generator of uint16 ids