(ctx context.Context, dag *dagql.Server, resultID uint64, _ *dagql.ResultCall, payload json.RawMessage)
| 133 | } |
| 134 | |
| 135 | func (*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 | |
| 166 | func (mirror *RemoteGitMirror) EnsureCreated(ctx context.Context, query *Query) error { |
| 167 | if mirror == nil { |
nothing calls this directly
no test coverage detected