Documentation
¶
Overview ¶
Code generated by github.com/ecordell/optgen. DO NOT EDIT.
Index ¶
- type Cluster
- func (cs Cluster) Init(ctx context.Context, out, errOut io.Writer)
- func (cs Cluster) NetworkDelay(ctx context.Context, out io.Writer, node int, duration time.Duration) error
- func (cs Cluster) SQL(ctx context.Context, out, errOut io.Writer, sql ...string) error
- func (cs Cluster) Started() bool
- func (cs Cluster) Stop(out io.Writer) error
- func (cs Cluster) TimeDelay(ctx context.Context, out io.Writer, node int, duration time.Duration) error
- type CockroachOption
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster []*Node
Cluster represents a set of Node nodes configured to talk to each other.
func NewCluster ¶
NewCluster returns a pre-configured cluster of the given size.
func (Cluster) NetworkDelay ¶
func (cs Cluster) NetworkDelay(ctx context.Context, out io.Writer, node int, duration time.Duration) error
NetworkDelay simulates network delay against the selected node
type CockroachOption ¶
type CockroachOption func(c *Node)
func SetPeers ¶
func SetPeers(peers []string) CockroachOption
SetPeers returns an option that can set Peers on a Node
func WithAddr ¶
func WithAddr(addr string) CockroachOption
WithAddr returns an option that can set Addr on a Node
func WithHttpaddr ¶
func WithHttpaddr(httpaddr string) CockroachOption
WithHttpaddr returns an option that can set Httpaddr on a Node
func WithId ¶
func WithId(id string) CockroachOption
WithId returns an option that can set ID on a Node
func WithPeers ¶
func WithPeers(peers string) CockroachOption
WithPeers returns an option that can append Peerss to Node.Peers
type Node ¶
type Node struct { Peers []string Addr string Httpaddr string ID string MaxOffset time.Duration Cancel context.CancelFunc // contains filtered or unexported fields }
Node represents a single cockroachdb instance
func CockroachWithOptions ¶
func CockroachWithOptions(c *Node, opts ...CockroachOption) *Node
CockroachWithOptions configures an existing Node with the passed in options set
func NewCockroachWithOptions ¶
func NewCockroachWithOptions(opts ...CockroachOption) *Node
NewCockroachWithOptions creates a new Node with the passed in options set
func (*Node) Conn ¶
func (c *Node) Conn() *pgx.Conn
Conn returns the current connection. Must only be called after Connect().
func (*Node) Connect ¶
Connect connects directly to the cockroach instance and caches the connection
func (*Node) ConnectionString ¶
ConnectionString returns the postgres db URI for this cluster
func (*Node) NodeID ¶
NodeID returns the cockroach-internal node id for this connection. This is the value that is referenced by other crdb metadata to identify range leader, follower nodes, etc.