summaryrefslogtreecommitdiff
path: root/client/fsm.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-02-12 19:18:05 +0100
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-02-19 14:15:07 +0100
commit74e36f0ead717105f26087c2cab08b41ba5a7ce8 (patch)
tree1eb2b7516bea705c9b5a50ce0965e170414ed880 /client/fsm.go
parent682d70091af2044ff6d8b350da9dff13163232e2 (diff)
All: Document everything to pass revive lint
Diffstat (limited to 'client/fsm.go')
-rw-r--r--client/fsm.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/client/fsm.go b/client/fsm.go
index 42c0029..175b832 100644
--- a/client/fsm.go
+++ b/client/fsm.go
@@ -9,9 +9,13 @@ import (
)
type (
- FSMStateID = fsm.StateID
- FSMStates = fsm.States
- FSMState = fsm.State
+ // FSMStateID is an alias to the fsm state ID type
+ FSMStateID = fsm.StateID
+ // FSMStates is an alias to the fsm states type
+ FSMStates = fsm.States
+ // FSMState is an alias to the fsm state type
+ FSMState = fsm.State
+ // FSMTransition is an alias to the fsm transition type
FSMTransition = fsm.Transition
)
@@ -53,6 +57,7 @@ const (
StateDisconnected
)
+// GetStateName gets the State name for state `s`
func GetStateName(s FSMStateID) string {
switch s {
case StateDeregistered:
@@ -166,6 +171,7 @@ func newFSM(
return returnedFSM
}
+// SetState sets the state for the client FSM to `state`
func (c *Client) SetState(state FSMStateID) error {
c.mu.Lock()
defer c.mu.Unlock()
@@ -182,6 +188,7 @@ func (c *Client) SetState(state FSMStateID) error {
return nil
}
+// InState returns whether or not the client is in state `state`
func (c *Client) InState(state FSMStateID) bool {
c.mu.Lock()
defer c.mu.Unlock()