github.com/MetalBlockchain/metalgo@v1.11.9/snow/engine/snowman/block/state_sync_mode.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package block
     5  
     6  // StateSyncMode is returned by the StateSyncableVM when a state summary is
     7  // passed to it. It indicates which type of state sync the VM is performing.
     8  type StateSyncMode uint8
     9  
    10  const (
    11  	// StateSyncSkipped indicates that state sync won't be run by the VM. This
    12  	// may happen if the VM decides that the state sync is too recent and it
    13  	// would be faster to bootstrap the missing blocks.
    14  	StateSyncSkipped StateSyncMode = iota + 1
    15  
    16  	// StateSyncStatic indicates that engine should stop and wait for the VM to
    17  	// complete state syncing before moving ahead with bootstrapping.
    18  	StateSyncStatic
    19  
    20  	// StateSyncDynamic indicates that engine should immediately transition
    21  	// into bootstrapping and then normal consensus. State sync will proceed
    22  	// asynchronously in the VM.
    23  	//
    24  	// Invariant: If this is returned it is assumed that the VM should be able
    25  	// to handle requests from the engine as if the VM is fully synced.
    26  	// Specifically, it is required that the invariants specified by
    27  	// LastAccepted, GetBlock, ParseBlock, and Block.Verify are maintained. This
    28  	// means that when StateSummary.Accept returns, the block that would become
    29  	// the last accepted block must be immediately fetchable by the engine.
    30  	StateSyncDynamic
    31  )
    32  
    33  func (s StateSyncMode) String() string {
    34  	switch s {
    35  	case StateSyncSkipped:
    36  		return "Skipped"
    37  	case StateSyncStatic:
    38  		return "Static"
    39  	case StateSyncDynamic:
    40  		return "Dynamic"
    41  	default:
    42  		return "Unknown"
    43  	}
    44  }