MCPcopy Create free account
hub / github.com/dagger/dagger / Set

Method Set

util/lockfile/lockfile.go:130–156  ·  view source on GitHub ↗

Set records the value and policy for (namespace, operation, inputs).

(namespace, operation string, inputs []any, value any, policy string)

Source from the content-addressed store, hash-verified

128
129// Set records the value and policy for (namespace, operation, inputs).
130func (l *Lockfile) Set(namespace, operation string, inputs []any, value any, policy string) error {
131 if l == nil {
132 return fmt.Errorf("nil lockfile")
133 }
134 if l.entries == nil {
135 l.entries = map[tupleKey]lockEntry{}
136 }
137
138 canonicalInputs, inputsJSON, err := canonicalizeInputs(inputs)
139 if err != nil {
140 return fmt.Errorf("canonicalizing lock inputs: %w", err)
141 }
142 canonicalValue, err := canonicalizeValue(value)
143 if err != nil {
144 return fmt.Errorf("canonicalizing lock value: %w", err)
145 }
146
147 l.entries[entryKey(namespace, operation, inputsJSON)] = lockEntry{
148 namespace: namespace,
149 operation: operation,
150 inputs: canonicalInputs,
151 inputsJSON: inputsJSON,
152 value: canonicalValue,
153 policy: policy,
154 }
155 return nil
156}
157
158// Delete removes the result for (namespace, operation, inputs).
159func (l *Lockfile) Delete(namespace, operation string, inputs []any) bool {

Callers

nothing calls this directly

Calls 3

canonicalizeInputsFunction · 0.85
canonicalizeValueFunction · 0.85
entryKeyFunction · 0.85

Tested by

no test coverage detected