package states
import (
am "github.com/pancsta/asyncmachine-go/pkg/machine"
"github.com/pancsta/asyncmachine-go/pkg/states"
. "github.com/pancsta/asyncmachine-go/pkg/states/global"
)
type ClientStatesDef struct {
*am .StatesBase
RetryingCall string
CallRetryFailed string
RetryingConn string
ConnRetryFailed string
Ready string
WorkerDelivering string
WorkerPayload string
*SharedStatesDef
*states .ConnectedStatesDef
}
type ClientGroupsDef struct {
*SharedGroupsDef
*states .ConnectedGroupsDef
}
var ClientSchema = SchemaMerge (
SharedSchema ,
states .ConnectedSchema ,
am .Schema {
ssC .ErrNetwork : {
Require : S {am .StateException },
Remove : S {ssC .Connecting },
},
ssC .Start : {
Add : S {ssC .Connecting },
Remove : S {ssC .ConnRetryFailed },
},
ssC .Ready : {
Auto : true ,
Require : S {ssC .HandshakeDone },
},
ssC .Connected : StateAdd (
states .ConnectedSchema [states .ConnectedStates .Connected ],
am .State {
Remove : S {ssC .RetryingConn },
Add : S {ssC .Handshaking },
}),
ssC .Handshaking : StateAdd (
SharedSchema [s .Handshaking ],
am .State {
Require : S {ssC .Connected },
}),
ssC .HandshakeDone : am .StateAdd (
SharedSchema [ssC .HandshakeDone ], am .State {
Require : S {ssC .Connected },
}),
ssC .RetryingCall : {Require : S {ssC .Start }},
ssC .CallRetryFailed : {
Remove : S {ssC .RetryingCall },
Add : S {ssC .ErrNetwork , am .StateException },
},
ssC .RetryingConn : {Require : S {ssC .Start }},
ssC .ConnRetryFailed : {Remove : S {ssC .Start }},
ssC .WorkerDelivering : {
Multi : true ,
Require : S {ssC .Connected },
},
ssC .WorkerPayload : {
Multi : true ,
Require : S {ssC .Connected },
},
})
var (
ssC = am .NewStates (ClientStatesDef {})
sgC = am .NewStateGroups (ClientGroupsDef {}, states .ConnectedGroups ,
SharedGroups )
ClientStates = ssC
ClientGroups = sgC
)
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .