(cache dagql.PersistedObjectCache, ref any, label string)
| 45 | } |
| 46 | |
| 47 | func encodePersistedObjectRef(cache dagql.PersistedObjectCache, ref any, label string) (uint64, error) { |
| 48 | if cache == nil { |
| 49 | return 0, fmt.Errorf("encode persisted %s cache: nil cache", label) |
| 50 | } |
| 51 | switch x := ref.(type) { |
| 52 | case nil: |
| 53 | return 0, fmt.Errorf("encode persisted %s ref: nil value", label) |
| 54 | case dagql.AnyResult: |
| 55 | resultID, err := cache.PersistedResultID(x) |
| 56 | if err != nil { |
| 57 | return 0, fmt.Errorf("encode persisted %s ref: %w", label, err) |
| 58 | } |
| 59 | return resultID, nil |
| 60 | default: |
| 61 | return 0, fmt.Errorf("encode persisted %s ref: unsupported value %T", label, ref) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | func decodePersistedCallID(raw string) (*call.ID, error) { |
| 66 | if raw == "" { |
no test coverage detected