Skip to content

Commit d9015db

Browse files
authored
use triOpt in node set (#230)
1 parent 4af90c7 commit d9015db

File tree

6 files changed

+284
-291
lines changed

6 files changed

+284
-291
lines changed

cluster/calcium/node.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package calcium
33
import (
44
"context"
55

6-
"github.com/projecteru2/core/cluster"
76
"github.com/projecteru2/core/types"
87
"github.com/sanity-io/litter"
98
log "github.com/sirupsen/logrus"
@@ -39,7 +38,7 @@ func (c *Calcium) SetNode(ctx context.Context, opts *types.SetNodeOptions) (*typ
3938
opts.Normalize(node)
4039
n = node
4140
litter.Dump(opts)
42-
n.Available = (opts.Status == cluster.NodeUp) || (opts.Status == cluster.KeepNodeStatus && n.Available)
41+
n.Available = (opts.Status == types.TriTrue) || (opts.Status == types.TriKeep && n.Available)
4342
if opts.ContainersDown {
4443
containers, err := c.store.ListNodeContainers(ctx, opts.Nodename, nil)
4544
if err != nil {

cluster/cluster.go

-6
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ const (
4040
ContainerLock = "clock_%s"
4141
// NodeLock for lock node
4242
NodeLock = "cnode_%s_%s"
43-
// NodeUp for node up
44-
NodeUp = 1
45-
// NodeDown for node down
46-
NodeDown = 0
47-
// KeepNodeStatus for no change node status
48-
KeepNodeStatus = 2
4943
)
5044

5145
// Cluster define all interface

0 commit comments

Comments
 (0)