(ctx context.Context, cache dagql.PersistedObjectCache)
| 83 | } |
| 84 | |
| 85 | func (ws *Workspace) EncodePersistedObject(ctx context.Context, cache dagql.PersistedObjectCache) (dagql.PersistedObjectEncoding, error) { |
| 86 | _ = ctx |
| 87 | if ws == nil { |
| 88 | return dagql.PersistedObjectEncoding{}, fmt.Errorf("encode persisted workspace: nil workspace") |
| 89 | } |
| 90 | |
| 91 | payload := persistedWorkspacePayload{ |
| 92 | Path: ws.Path, |
| 93 | Address: ws.Address, |
| 94 | Initialized: ws.Initialized, |
| 95 | ConfigPath: ws.ConfigPath, |
| 96 | HasConfig: ws.HasConfig, |
| 97 | ClientID: ws.ClientID, |
| 98 | HostPath: ws.hostPath, |
| 99 | } |
| 100 | if ws.rootfs.Self() != nil { |
| 101 | rootfsID, err := encodePersistedObjectRef(cache, ws.rootfs, "workspace rootfs") |
| 102 | if err != nil { |
| 103 | return dagql.PersistedObjectEncoding{}, err |
| 104 | } |
| 105 | payload.RootfsResultID = rootfsID |
| 106 | } |
| 107 | |
| 108 | payloadBytes, err := json.Marshal(payload) |
| 109 | if err != nil { |
| 110 | return dagql.PersistedObjectEncoding{}, fmt.Errorf("marshal persisted workspace payload: %w", err) |
| 111 | } |
| 112 | return encodePersistedObjectRawJSON(payloadBytes), nil |
| 113 | } |
| 114 | |
| 115 | func (*Workspace) DecodePersistedObject( |
| 116 | ctx context.Context, |
nothing calls this directly
no test coverage detected