-
Notifications
You must be signed in to change notification settings - Fork 0
/
ss_rpc_worker.go
53 lines (38 loc) · 1.2 KB
/
ss_rpc_worker.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package states
import (
am "github.com/pancsta/asyncmachine-go/pkg/machine"
"github.com/pancsta/asyncmachine-go/pkg/states"
)
// WorkerStatesDef contains all the states of the Worker state machine.
type WorkerStatesDef struct {
// errors
// ErrProviding - Worker had issues providing the requested payload.
ErrProviding string
// ErrSendPayload - RPC server had issues sending the requested payload to
// the RPC client.
ErrSendPayload string
// rpc getter
// SendPayload - Worker delivered requested payload to the RPC server as
// A{"payload": ArgsPayload, "name": "name"}. TODO use rpc.Pass
SendPayload string
// inherit from BasicStatesDef
*states.BasicStatesDef
}
// WorkerStruct represents all relations and properties of WorkerStates.
var WorkerStruct = StructMerge(
// inherit from BasicStruct
states.BasicStruct,
am.Struct{
// errors
ssW.ErrProviding: {Require: S{am.Exception}},
ssW.ErrSendPayload: {Require: S{am.Exception}},
// rcp getter
ssW.SendPayload: {Multi: true},
})
// EXPORTS AND GROUPS
var (
// ssW is worker states from WorkerStatesDef.
ssW = am.NewStates(WorkerStatesDef{})
// WorkerStates contains all the states for the Worker machine.
WorkerStates = ssW
)