github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/state/protocol/protocol_state/kvstore/factory.go (about) 1 package kvstore 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 "github.com/onflow/flow-go/state/protocol" 6 "github.com/onflow/flow-go/state/protocol/protocol_state" 7 ) 8 9 // PSVersionUpgradeStateMachineFactory is a factory for creating PSVersionUpgradeStateMachine instances. 10 type PSVersionUpgradeStateMachineFactory struct { 11 params protocol.GlobalParams 12 } 13 14 var _ protocol_state.KeyValueStoreStateMachineFactory = (*PSVersionUpgradeStateMachineFactory)(nil) 15 16 func NewPSVersionUpgradeStateMachineFactory(params protocol.GlobalParams) *PSVersionUpgradeStateMachineFactory { 17 return &PSVersionUpgradeStateMachineFactory{ 18 params: params, 19 } 20 } 21 22 // Create instantiates a new PSVersionUpgradeStateMachine, which processes ProtocolStateVersionUpgrade ServiceEvent 23 // that are sealed by the candidate block (possibly still under construction) with the given view. 24 // No errors are expected during normal operations. 25 func (f *PSVersionUpgradeStateMachineFactory) Create(candidateView uint64, parentBlockID flow.Identifier, parentState protocol.KVStoreReader, mutator protocol_state.KVStoreMutator) (protocol_state.KeyValueStoreStateMachine, error) { 26 return NewPSVersionUpgradeStateMachine(candidateView, f.params, parentState, mutator), nil 27 }