github.com/MetalBlockchain/metalgo@v1.11.9/snow/state.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package snow
     5  
     6  import (
     7  	"errors"
     8  
     9  	"github.com/MetalBlockchain/metalgo/proto/pb/p2p"
    10  )
    11  
    12  const (
    13  	Initializing State = iota
    14  	StateSyncing
    15  	Bootstrapping
    16  	NormalOp
    17  )
    18  
    19  var ErrUnknownState = errors.New("unknown state")
    20  
    21  type State uint8
    22  
    23  func (st State) String() string {
    24  	switch st {
    25  	case Initializing:
    26  		return "Initializing state"
    27  	case StateSyncing:
    28  		return "State syncing state"
    29  	case Bootstrapping:
    30  		return "Bootstrapping state"
    31  	case NormalOp:
    32  		return "Normal operations state"
    33  	default:
    34  		return "Unknown state"
    35  	}
    36  }
    37  
    38  type EngineState struct {
    39  	Type  p2p.EngineType
    40  	State State
    41  }