(ctx context.Context, db database.Store, fileID uuid.UUID)
| 41 | } |
| 42 | |
| 43 | func (c *CacheCloser) Acquire(ctx context.Context, db database.Store, fileID uuid.UUID) (*CloseFS, error) { |
| 44 | c.mu.Lock() |
| 45 | defer c.mu.Unlock() |
| 46 | |
| 47 | if c.cache == nil { |
| 48 | return nil, xerrors.New("cache is closed, and cannot acquire new files") |
| 49 | } |
| 50 | |
| 51 | f, err := c.cache.Acquire(ctx, db, fileID) |
| 52 | if err != nil { |
| 53 | return nil, err |
| 54 | } |
| 55 | |
| 56 | c.closers = append(c.closers, f.close) |
| 57 | |
| 58 | return f, nil |
| 59 | } |