MCPcopy Index your code
hub / github.com/dagger/dagger / EncodePersistedObject

Method EncodePersistedObject

core/workspace.go:85–113  ·  view source on GitHub ↗
(ctx context.Context, cache dagql.PersistedObjectCache)

Source from the content-addressed store, hash-verified

83}
84
85func (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
115func (*Workspace) DecodePersistedObject(
116 ctx context.Context,

Callers

nothing calls this directly

Calls 4

encodePersistedObjectRefFunction · 0.85
SelfMethod · 0.80
MarshalMethod · 0.65

Tested by

no test coverage detected