Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add String() func for NodeEventType and NodeStateType #231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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