Documentation
¶
Index ¶
- Variables
- type Dispatcher
- func (d *Dispatcher) DispatchMessage(msg *types.Message) error
- func (d *Dispatcher) DispatchTimeout(t *types.ReplicaTimeout) error
- func (d *Dispatcher) RestartAll() error
- func (d *Dispatcher) RestartReplica(replica types.ReplicaID) error
- func (d *Dispatcher) StartReplica(replica types.ReplicaID) error
- func (d *Dispatcher) StopReplica(replica types.ReplicaID) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDestUnknown is returned when a message is asked to be dispatched to an unknown replicas ErrDestUnknown = errors.New("destination unknown") // ErrFailedMarshal is returned when the message could not be marshalled ErrFailedMarshal = errors.New("failed to marshal data") // ErrDuplicateDispatch is returned when a message already sent is being dispatched again ErrDuplicateDispatch = errors.New("message already dispatched") // ErrSendFaied is returned when the request could not be created ErrSendFailed = errors.New("sending failed") // ErrResponseReadFail is returned when the response to the request could not be read ErrResponseReadFail = errors.New("failed to read response") // ErrBadResponse is returned when the request did not receive a 2** response ErrBadResponse = errors.New("bad response") )
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct { // Replicas an instance of the replica store Replicas *types.ReplicaStore // contains filtered or unexported fields }
Dispatcher should be used to send messages to the replicas and handles the marshalling of messages
func NewDispatcher ¶
func NewDispatcher(ctx *context.RootContext) *Dispatcher
NewDispatcher instantiates a new instance of Dispatcher
func (*Dispatcher) DispatchMessage ¶
func (d *Dispatcher) DispatchMessage(msg *types.Message) error
DispatchMessage should be called to send an _intercepted_ message to a replica DispatchMessage sends a message with a particular ID only once, will return ErrDuplicateDispatch on successive calls
func (*Dispatcher) DispatchTimeout ¶
func (d *Dispatcher) DispatchTimeout(t *types.ReplicaTimeout) error
Send a timeout message to the replica This is the equivalent of ending a timeout at the replica
func (*Dispatcher) RestartAll ¶
func (d *Dispatcher) RestartAll() error
RestartAll restarts all the replicas
func (*Dispatcher) RestartReplica ¶
func (d *Dispatcher) RestartReplica(replica types.ReplicaID) error
RestartReplica should be called to direct the replica to restart
func (*Dispatcher) StartReplica ¶
func (d *Dispatcher) StartReplica(replica types.ReplicaID) error
StartReplica should be called to direct the replica to start running
func (*Dispatcher) StopReplica ¶
func (d *Dispatcher) StopReplica(replica types.ReplicaID) error
StopReplica should be called to direct the replica to stop running