Skip to content

Commit

Permalink
Add String() func for NodeEventType and NodeStateType
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne Champetier <[email protected]>
  • Loading branch information
champtar committed Mar 15, 2021
1 parent 822dee6 commit 51df881
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions event_delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ const (
NodeUpdate
)

func (net NodeEventType) String() string {
return []string{"NodeJoin", "NodeLeave", "NodeUpdate"}[net]
}

// NodeEvent is a single event related to node activity in the memberlist.
// The Node member of this struct must not be directly modified. It is passed
// as a pointer to avoid unnecessary copies. If you wish to modify the node,
Expand Down
4 changes: 4 additions & 0 deletions state.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const (
StateLeft
)

func (nst NodeStateType) String() string {
return []string{"StateAlive", "StateSuspect", "StateDead", "StateLeft"}[nst]
}

// Node represents a node in the cluster.
type Node struct {
Name string
Expand Down

0 comments on commit 51df881

Please sign in to comment.