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

Method DecodePersistedObject

core/git_remote_mirror.go:135–164  ·  view source on GitHub ↗
(ctx context.Context, dag *dagql.Server, resultID uint64, _ *dagql.ResultCall, payload json.RawMessage)

Source from the content-addressed store, hash-verified

133}
134
135func (*RemoteGitMirror) DecodePersistedObject(ctx context.Context, dag *dagql.Server, resultID uint64, _ *dagql.ResultCall, payload json.RawMessage) (dagql.Typed, error) {
136 var persisted persistedRemoteGitMirrorPayload
137 if err := json.Unmarshal(payload, &persisted); err != nil {
138 return nil, fmt.Errorf("decode persisted remote git mirror payload: %w", err)
139 }
140 mirror := NewRemoteGitMirror(persisted.RemoteURL)
141 if resultID == 0 {
142 return mirror, nil
143 }
144 link, err := loadPersistedSnapshotLinkByResultID(ctx, dag, resultID, "remote git mirror", "bare_repo")
145 if err != nil {
146 return nil, err
147 }
148 query, err := persistedDecodeQuery(dag)
149 if err != nil {
150 return nil, err
151 }
152 ref, err := query.SnapshotManager().GetMutableBySnapshotID(
153 ctx,
154 link.RefKey,
155 bkcache.NoUpdateLastUsed,
156 bkcache.WithRecordType(bkclient.UsageRecordTypeGitCheckout),
157 bkcache.WithDescription(fmt.Sprintf("git bare repo for %s", mirror.RemoteURL)),
158 )
159 if err != nil {
160 return nil, fmt.Errorf("reopen persisted remote git mirror snapshot %q: %w", link.RefKey, err)
161 }
162 mirror.snapshot = ref
163 return mirror, nil
164}
165
166func (mirror *RemoteGitMirror) EnsureCreated(ctx context.Context, query *Query) error {
167 if mirror == nil {

Callers

nothing calls this directly

Calls 7

NewRemoteGitMirrorFunction · 0.85
persistedDecodeQueryFunction · 0.85
UnmarshalMethod · 0.65
SnapshotManagerMethod · 0.65
WithDescriptionMethod · 0.45

Tested by

no test coverage detected