MCPcopy
hub / github.com/dagger/container-use / LoadInfo

Function LoadInfo

environment/environment.go:90–110  ·  view source on GitHub ↗

LoadInfo loads basic environment metadata without requiring dagger operations. This is useful for operations that only need access to configuration and state information without the overhead of initializing container operations.

(ctx context.Context, id string, state []byte, worktree string)

Source from the content-addressed store, hash-verified

88// This is useful for operations that only need access to configuration and state
89// information without the overhead of initializing container operations.
90func LoadInfo(ctx context.Context, id string, state []byte, worktree string) (*EnvironmentInfo, error) {
91 envInfo := &EnvironmentInfo{
92 ID: id,
93 State: &State{},
94 }
95
96 if err := envInfo.State.Unmarshal(state); err != nil {
97 return nil, err
98 }
99
100 // Backward compatibility: if there's no config in the state, load it from the worktree
101 if envInfo.State.Config == nil {
102 config := DefaultConfig()
103 if err := config.Load(worktree); err != nil {
104 return nil, err
105 }
106 envInfo.State.Config = config
107 }
108
109 return envInfo, nil
110}
111
112func (env *Environment) apply(ctx context.Context, newState *dagger.Container) error {
113 // TODO(braa): is this sync redundant with newState.ID?

Callers 2

InfoMethod · 0.92
LoadFunction · 0.85

Calls 3

DefaultConfigFunction · 0.85
UnmarshalMethod · 0.80
LoadMethod · 0.80

Tested by

no test coverage detected