github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/core/node.go (about)

     1  // Package core provides core metadata and in-cluster API
     2  /*
     3   * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
     4   */
     5  package core
     6  
     7  import (
     8  	"github.com/NVIDIA/aistore/cmn"
     9  	"github.com/NVIDIA/aistore/core/meta"
    10  )
    11  
    12  const (
    13  	Targets = iota // 0 (core.Targets) used as default value for NewStreamBundle
    14  	Proxies
    15  	AllNodes
    16  	SelectedNodes
    17  )
    18  
    19  type (
    20  	// cluster node
    21  	Node interface {
    22  		SID() string
    23  		String() string
    24  		Snode() *meta.Snode
    25  
    26  		Bowner() meta.Bowner
    27  		Sowner() meta.Sowner
    28  
    29  		ClusterStarted() bool
    30  		NodeStarted() bool
    31  	}
    32  )
    33  
    34  func InMaintOrDecomm(smap *meta.Smap, tsi *meta.Snode, xact Xact) (err error) {
    35  	if smap.InMaintOrDecomm(tsi) {
    36  		err = cmn.NewErrXactTgtInMaint(xact.String(), tsi.StringEx())
    37  	}
    38  	return err
    39  }