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

Method CreatePool

db/root.go:316–343  ·  view source on GitHub ↗
(ctx context.Context, name string, sortKeys order.SortKeys, seekStride int, thresh int64)

Source from the content-addressed store, hash-verified

314}
315
316func (r *Root) CreatePool(ctx context.Context, name string, sortKeys order.SortKeys, seekStride int, thresh int64) (*Pool, error) {
317 if name == "HEAD" {
318 return nil, fmt.Errorf("pool cannot be named %q", name)
319 }
320 if r.pools.LookupByName(ctx, name) != nil {
321 return nil, fmt.Errorf("%s: %w", name, pools.ErrExists)
322 }
323 if thresh == 0 {
324 thresh = data.DefaultThreshold
325 }
326 if len(sortKeys) > 1 {
327 return nil, errors.New("multiple pool keys not supported")
328 }
329 config := pools.NewConfig(name, sortKeys, thresh, seekStride)
330 if err := CreatePool(ctx, r.engine, r.logger, r.path, config); err != nil {
331 return nil, err
332 }
333 pool, err := r.openPool(ctx, config)
334 if err != nil {
335 RemovePool(ctx, r.engine, r.path, config)
336 return nil, err
337 }
338 if err := r.pools.Add(ctx, config); err != nil {
339 RemovePool(ctx, r.engine, r.path, config)
340 return nil, err
341 }
342 return pool, nil
343}
344
345// RemovePool deletes a pool from the configuration journal and deletes all
346// data associated with the pool.

Callers

nothing calls this directly

Calls 7

openPoolMethod · 0.95
NewConfigFunction · 0.92
CreatePoolFunction · 0.85
RemovePoolFunction · 0.85
NewMethod · 0.80
LookupByNameMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected