(ctx context.Context, cache dagql.PersistedObjectCache, lazy Lazy[*File])
| 369 | } |
| 370 | |
| 371 | func 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 | |
| 396 | func decodePersistedFileLazy(ctx context.Context, dag *dagql.Server, lazyKind string, payload json.RawMessage) (Lazy[*File], error) { |
| 397 | switch lazyKind { |
no test coverage detected