MCPcopy Index your code
hub / github.com/docker/docker-agent / snapshotRuntimeOpts

Method snapshotRuntimeOpts

cmd/root/run.go:777–790  ·  view source on GitHub ↗

snapshotRuntimeOpts wires the snapshot builtin into a runtime. Returns the [runtime.Opt]s that hand the registry and the [builtins.SnapshotController] auto-injector to the runtime, plus the controller itself for the embedder to pass to the App via [app.WithSnapshotController]. When snapshots aren't

()

Source from the content-addressed store, hash-verified

775// so the spawner-created sub-runtimes get their own snapshot state
776// (each spawned session has independent /undo history).
777func (f *runExecFlags) snapshotRuntimeOpts() ([]runtime.Opt, builtins.SnapshotController, error) {
778 if !f.snapshotsEnabled {
779 return nil, nil, nil
780 }
781 reg := hooks.NewRegistry()
782 ctrl, err := builtins.RegisterSnapshot(reg, true)
783 if err != nil {
784 return nil, nil, fmt.Errorf("register snapshot builtin: %w", err)
785 }
786 return []runtime.Opt{
787 runtime.WithHooksRegistry(reg),
788 runtime.WithAutoInjector(ctrl),
789 }, ctrl, nil
790}
791
792func (f *runExecFlags) createLocalRuntimeAndSession(ctx context.Context, loadResult *teamloader.LoadResult, req runtime.CreateSessionRequest, sessStore session.Store) (runtime.Runtime, *session.Session, error) {
793 t := loadResult.Team

Callers 2

createSessionSpawnerMethod · 0.95

Calls 4

NewRegistryFunction · 0.92
RegisterSnapshotFunction · 0.92
WithHooksRegistryFunction · 0.92
WithAutoInjectorFunction · 0.92

Tested by

no test coverage detected