booga

package module
v0.0.0-...-7911a63 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2021 License: MIT Imports: 26 Imported by: 0

README

booga

Tool for running development mongodb clusters.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	// contains filtered or unexported fields
}

func New

func New(opt Config) *Cluster

func (*Cluster) Kill

func (c *Cluster) Kill(name string) error

func (*Cluster) MonitorTopology

func (c *Cluster) MonitorTopology(ctx context.Context)

func (*Cluster) Run

func (c *Cluster) Run(ctx context.Context) error

func (*Cluster) Services

func (c *Cluster) Services() []string

func (*Cluster) Topology

func (c *Cluster) Topology() Topology

type Config

type Config struct {
	Log *zap.Logger

	Mongod string // mongod binary path
	Mongos string // mongos binary path

	Dir string // base directory
	DB  string // database name

	Replicas int
	Shards   int

	MaxCacheGB float64

	Opentelemetry bool

	OnSetup      func(ctx context.Context, client *mongo.Client) error
	SetupTimeout time.Duration
}

type ReplicaSetStatus

type ReplicaSetStatus struct {
	Members []ReplicaStatus `bson:"members"`
}

type ReplicaStatus

type ReplicaStatus struct {
	Addr   string `bson:"name"`
	Health uint64 `bson:"health"`
	State  string `bson:"stateStr"`
}

type Service

type Service struct {
	Type   serverType
	Addr   string
	Conn   *mongo.Client
	Cancel func()
}

type Shard

type Shard struct {
	ID               string                   `bson:"_id"`
	Host             string                   `bson:"host"`
	State            uint64                   `bson:"state"`
	ReplicaSetStatus map[string]ReplicaStatus `bson:"-"`
	// contains filtered or unexported fields
}

type Topology

type Topology struct {
	Shards []Shard
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL