Skip to content

Commit

Permalink
feat: move snapshot to the tooling folder and ad db package
Browse files Browse the repository at this point in the history
  • Loading branch information
renan061 committed Aug 30, 2024
1 parent 84d466d commit 3cd09a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions internal/node/advancer/machines/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ func Load(ctx context.Context, config config.NodeConfig, repo Repository) (*Mach

address, err := cartesimachine.StartServer(serverVerbosity, 0, os.Stdout, os.Stderr)
if err != nil {
return nil, close(machines)
return nil, closeMachines(machines)
}

config := &emulator.MachineRuntimeConfig{}
cartesiMachine, err := cartesimachine.Load(ctx, snapshotPath, address, config)
if err != nil {
err = errors.Join(err, cartesimachine.StopServer(address), close(machines))
err = errors.Join(err, cartesimachine.StopServer(address), closeMachines(machines))
return nil, err
}

rollupsMachine, err := rollupsmachine.New(ctx, cartesiMachine, machineInc, machineMax)
if err != nil {
err = errors.Join(err, cartesiMachine.Close(ctx), close(machines))
err = errors.Join(err, cartesiMachine.Close(ctx), closeMachines(machines))
return nil, err
}

Expand All @@ -82,7 +82,7 @@ func Load(ctx context.Context, config config.NodeConfig, repo Repository) (*Mach
machineInspectTimeout,
maxConcurrentInspects)
if err != nil {
err = errors.Join(err, rollupsMachine.Close(ctx), close(machines))
err = errors.Join(err, rollupsMachine.Close(ctx), closeMachines(machines))
return nil, err
}

Expand Down Expand Up @@ -141,7 +141,7 @@ func (m *Machines) Close() error {
m.mutex.Lock()
defer m.mutex.Unlock()

err := close(m.machines)
err := closeMachines(m.machines)
if err != nil {
slog.Error(fmt.Sprintf("failed to close some machines: %v", err))
}
Expand All @@ -156,7 +156,7 @@ func (m *Machines) get(app model.Address) *nodemachine.NodeMachine {
return m.machines[app]
}

func close(machines map[model.Address]*nodemachine.NodeMachine) (err error) {
func closeMachines(machines map[model.Address]*nodemachine.NodeMachine) (err error) {
for _, machine := range machines {
err = errors.Join(err, machine.Close())
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rollupsmachine/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

"github.com/cartesi/rollups-node/pkg/emulator"
"github.com/cartesi/rollups-node/pkg/rollupsmachine/cartesimachine"
"github.com/cartesi/rollups-node/test/snapshot"
"github.com/cartesi/rollups-node/test/tooling/snapshot"

"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
Expand Down
File renamed without changes.

0 comments on commit 3cd09a0

Please sign in to comment.