NewSnapshotWrapper creates a wrapper which provides ref-counting around a snapshot. The snapshot (and an optional io.Closer) will be closed when the ref-count reaches zero.
(ss Snapshot, closer io.Closer)
| 25 | // around a snapshot. The snapshot (and an optional io.Closer) will |
| 26 | // be closed when the ref-count reaches zero. |
| 27 | func NewSnapshotWrapper(ss Snapshot, closer io.Closer) *SnapshotWrapper { |
| 28 | if ss == nil { |
| 29 | return nil |
| 30 | } |
| 31 | |
| 32 | return &SnapshotWrapper{refCount: 1, ss: ss, closer: closer} |
| 33 | } |
| 34 | |
| 35 | func (w *SnapshotWrapper) addRef() *SnapshotWrapper { |
| 36 | if w != nil { |
no outgoing calls
no test coverage detected
searching dependent graphs…