MCPcopy Create free account
hub / github.com/microsoft/typescript-go / updateSnapshotRef

Method updateSnapshotRef

internal/project/session.go:1198–1200  ·  view source on GitHub ↗

updateSnapshotRef is like UpdateSnapshot but returns the created snapshot with an extra reference for the caller. The ref is taken atomically with the snapshot assignment under snapshotMu, so the snapshot is guaranteed to be alive when returned. The caller must call snapshot.Deref(s) when done.

(ctx context.Context, overlays map[tspath.Path]*Overlay, change SnapshotChange)

Source from the content-addressed store, hash-verified

1196// the snapshot assignment under snapshotMu, so the snapshot is guaranteed
1197// to be alive when returned. The caller must call snapshot.Deref(s) when done.
1198func (s *Session) updateSnapshotRef(ctx context.Context, overlays map[tspath.Path]*Overlay, change SnapshotChange) *Snapshot {
1199 return s.updateSnapshot(ctx, overlays, change, true)
1200}
1201
1202func (s *Session) updateSnapshot(ctx context.Context, overlays map[tspath.Path]*Overlay, change SnapshotChange, callerRef bool) *Snapshot {
1203 s.snapshotMu.Lock()

Callers 1

APIUpdateMethod · 0.95

Calls 1

updateSnapshotMethod · 0.95

Tested by

no test coverage detected