Skip to content

Commit 1c9da69

Browse files
committed
WIP: supplyverifier: remove state log; we don't need to save state machine state
1 parent c857617 commit 1c9da69

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

universe/supplyverifier/manager.go

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,6 @@ type DaemonAdapters interface {
3838
Stop() error
3939
}
4040

41-
// StateMachineStore is an interface that allows the state machine to persist
42-
// its state across restarts. This is used to track the state of the state
43-
// machine for supply verification.
44-
type StateMachineStore interface {
45-
// CommitState is used to commit the state of the state machine to disk.
46-
CommitState(context.Context, asset.Specifier, State) error
47-
48-
// FetchState attempts to fetch the state of the state machine for the
49-
// target asset specifier. If the state machine doesn't exist, then a
50-
// default state will be returned.
51-
FetchState(context.Context, asset.Specifier) (State, error)
52-
}
53-
5441
// IssuanceSubscriptions allows verifier state machines to subscribe to
5542
// asset group issuance events.
5643
type IssuanceSubscriptions interface {
@@ -90,11 +77,6 @@ type ManagerCfg struct {
9077
// interact with external daemons whilst processing internal events.
9178
DaemonAdapters DaemonAdapters
9279

93-
// StateLog is the main state log that is used to track the state of the
94-
// state machine. This is used to persist the state of the state machine
95-
// across restarts.
96-
StateLog StateMachineStore
97-
9880
// ErrChan is the channel that is used to send errors to the caller.
9981
ErrChan chan<- error
10082
}
@@ -244,19 +226,12 @@ func (m *Manager) startAssetSM(ctx context.Context,
244226
QuitChan: m.Quit,
245227
}
246228

247-
// Before we start the state machine, we'll need to fetch the current
248-
// state from disk, to see if we need to emit any new events.
249-
initialState, err := m.cfg.StateLog.FetchState(ctx, assetSpec)
250-
if err != nil {
251-
return nil, fmt.Errorf("unable to fetch current state: %w", err)
252-
}
253-
254229
// Create a new error reporter for the state machine.
255230
errorReporter := NewErrorReporter(assetSpec)
256231

257232
fsmCfg := protofsm.StateMachineCfg[Event, *Environment]{
258233
ErrorReporter: &errorReporter,
259-
InitialState: initialState,
234+
InitialState: &InitState{},
260235
Env: env,
261236
Daemon: m.cfg.DaemonAdapters,
262237
}

0 commit comments

Comments
 (0)