MCPcopy Create free account
hub / github.com/datastax/cql-proxy / Add

Method Add

proxycore/mockcluster.go:507–523  ·  view source on GitHub ↗
(ctx context.Context, n int)

Source from the content-addressed store, hash-verified

505}
506
507func (c *MockCluster) Add(ctx context.Context, n int) error {
508 host := c.generate(n)
509 for _, h := range c.hosts {
510 if host.equal(h) {
511 return errors.New("host already added")
512 }
513 }
514 c.hosts = append(c.hosts, host)
515 err := c.maybeStart(ctx, host)
516 if err != nil {
517 return err
518 }
519 for _, s := range c.servers {
520 s.Add(host)
521 }
522 return nil
523}
524
525func (c *MockCluster) maybeStart(ctx context.Context, host MockHost) error {
526 key := host.String()

Calls 3

generateMethod · 0.95
maybeStartMethod · 0.95
equalMethod · 0.45