Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/instances/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
const (
// DefaultStorageFileName is the default filename for storing instances
DefaultStorageFileName = "instances.json"
// RuntimesSubdirectory is the subdirectory for runtime storage
RuntimesSubdirectory = "runtimes"
)

// InstanceFactory is a function that creates an Instance from InstanceData
Expand Down Expand Up @@ -70,7 +72,12 @@ var _ Manager = (*manager)(nil)

// NewManager creates a new instance manager with the given storage directory.
func NewManager(storageDir string) (Manager, error) {
return newManagerWithFactory(storageDir, NewInstanceFromData, generator.New(), runtime.NewRegistry())
runtimesDir := filepath.Join(storageDir, RuntimesSubdirectory)
reg, err := runtime.NewRegistry(runtimesDir)
if err != nil {
return nil, fmt.Errorf("failed to create runtime registry: %w", err)
}
return newManagerWithFactory(storageDir, NewInstanceFromData, generator.New(), reg)
}

// newManagerWithFactory creates a new instance manager with a custom instance factory, generator, and registry.
Expand Down
Loading
Loading