MCPcopy Create free account
hub / github.com/brimdata/super / CreateBranch

Function CreateBranch

db/pool.go:61–76  ·  view source on GitHub ↗
(ctx context.Context, engine storage.Engine, logger *zap.Logger, root *storage.URI, poolConfig *pools.Config, name string, parent ksuid.KSUID)

Source from the content-addressed store, hash-verified

59}
60
61func CreateBranch(ctx context.Context, engine storage.Engine, logger *zap.Logger, root *storage.URI, poolConfig *pools.Config, name string, parent ksuid.KSUID) (*branches.Config, error) {
62 poolPath := poolConfig.Path(root)
63 branchesPath := poolPath.JoinPath(BranchesTag)
64 store, err := branches.OpenStore(ctx, engine, logger, branchesPath)
65 if err != nil {
66 return nil, err
67 }
68 if _, err := store.LookupByName(ctx, name); err == nil {
69 return nil, fmt.Errorf("%s/%s: %w", poolConfig.Name, name, branches.ErrExists)
70 }
71 branchConfig := branches.NewConfig(name, parent)
72 if err := store.Add(ctx, branchConfig); err != nil {
73 return nil, err
74 }
75 return branchConfig, err
76}
77
78func OpenPool(ctx context.Context, engine storage.Engine, logger *zap.Logger, root *storage.URI, config *pools.Config) (*Pool, error) {
79 path := config.Path(root)

Callers 2

CreatePoolFunction · 0.85
CreateBranchMethod · 0.85

Calls 6

OpenStoreFunction · 0.92
NewConfigFunction · 0.92
JoinPathMethod · 0.80
PathMethod · 0.45
LookupByNameMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected