| 1 | package pin |
| 2 | |
| 3 | import "io" |
| 4 | |
| 5 | // Pin represents an object and its pinned path. |
| 6 | type Pin struct { |
| 7 | Path string |
| 8 | Object io.Closer |
| 9 | } |
| 10 | |
| 11 | func (p *Pin) close() { |
| 12 | if p.Object != nil { |
| 13 | p.Object.Close() |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | // Take ownership of Pin.Object. |
| 18 | // |
| 19 | // The caller is responsible for calling close on [Pin.Object]. |
| 20 | func (p *Pin) Take() { |
| 21 | p.Object = nil |
| 22 | } |