(ctx context.Context, config *pools.Config)
| 293 | } |
| 294 | |
| 295 | func (r *Root) openPool(ctx context.Context, config *pools.Config) (*Pool, error) { |
| 296 | if p, ok := r.poolCache.Get(config.ID); ok { |
| 297 | // The cached pool's config may be outdated, so rather than |
| 298 | // return the pool directly, we return a copy whose config we |
| 299 | // can safely update without locking. |
| 300 | p := *p |
| 301 | p.Config = *config |
| 302 | return &p, nil |
| 303 | } |
| 304 | p, err := OpenPool(ctx, r.engine, r.logger, r.path, config) |
| 305 | if err != nil { |
| 306 | return nil, err |
| 307 | } |
| 308 | r.poolCache.Add(config.ID, p) |
| 309 | return p, nil |
| 310 | } |
| 311 | |
| 312 | func (r *Root) RenamePool(ctx context.Context, id ksuid.KSUID, newName string) error { |
| 313 | return r.pools.Rename(ctx, id, newName) |
no test coverage detected