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

Function encodePersistedFileLazy

core/file.go:371–394  ·  view source on GitHub ↗
(ctx context.Context, cache dagql.PersistedObjectCache, lazy Lazy[*File])

Source from the content-addressed store, hash-verified

369}
370
371func encodePersistedFileLazy(ctx context.Context, cache dagql.PersistedObjectCache, lazy Lazy[*File]) (string, json.RawMessage, error) {
372 switch lazy := lazy.(type) {
373 case *FileSubfileLazy:
374 payload, err := lazy.EncodePersisted(ctx, cache)
375 return persistedFileLazyKindDirectoryFile, payload, err
376 case *ContainerFileLazy:
377 payload, err := lazy.EncodePersisted(ctx, cache)
378 return persistedFileLazyKindContainerFile, payload, err
379 case *FileWithNameLazy:
380 payload, err := lazy.EncodePersisted(ctx, cache)
381 return persistedFileLazyKindWithName, payload, err
382 case *FileWithReplacedLazy:
383 payload, err := lazy.EncodePersisted(ctx, cache)
384 return persistedFileLazyKindWithReplaced, payload, err
385 case *FileWithTimestampsLazy:
386 payload, err := lazy.EncodePersisted(ctx, cache)
387 return persistedFileLazyKindWithTimestamps, payload, err
388 case *FileChownLazy:
389 payload, err := lazy.EncodePersisted(ctx, cache)
390 return persistedFileLazyKindChown, payload, err
391 default:
392 return "", nil, fmt.Errorf("encode persisted file lazy: unsupported lazy type %T", lazy)
393 }
394}
395
396func decodePersistedFileLazy(ctx context.Context, dag *dagql.Server, lazyKind string, payload json.RawMessage) (Lazy[*File], error) {
397 switch lazyKind {

Callers 1

EncodePersistedObjectMethod · 0.85

Calls 1

EncodePersistedMethod · 0.65

Tested by

no test coverage detected