| 76 | } |
| 77 | |
| 78 | func OpenPool(ctx context.Context, engine storage.Engine, logger *zap.Logger, root *storage.URI, config *pools.Config) (*Pool, error) { |
| 79 | path := config.Path(root) |
| 80 | branchesPath := path.JoinPath(BranchesTag) |
| 81 | branches, err := branches.OpenStore(ctx, engine, logger, branchesPath) |
| 82 | if err != nil { |
| 83 | return nil, err |
| 84 | } |
| 85 | commitsPath := path.JoinPath(CommitsTag) |
| 86 | commits, err := commits.OpenStore(engine, logger, commitsPath) |
| 87 | if err != nil { |
| 88 | return nil, err |
| 89 | } |
| 90 | return &Pool{ |
| 91 | Config: *config, |
| 92 | engine: engine, |
| 93 | Path: path, |
| 94 | DataPath: DataPath(path), |
| 95 | branches: branches, |
| 96 | commits: commits, |
| 97 | }, nil |
| 98 | } |
| 99 | |
| 100 | func RemovePool(ctx context.Context, engine storage.Engine, root *storage.URI, config *pools.Config) error { |
| 101 | return engine.DeleteByPrefix(ctx, config.Path(root)) |