shmongo

package
v0.0.0-rc9 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvMongoShardedClusterHost       = "MONGO_SHARDED_CLUSTER_HOST"
	EnvMongoShardedClusterPort       = "MONGO_SHARDED_CLUSTER_PORT"
	EnvMongoShardedClusterUsername   = "MONGO_SHARDED_CLUSTER_USERNAME"
	EnvMongoShardedClusterPassword   = "MONGO_SHARDED_CLUSTER_PASSWORD"
	EnvMongoShardedClusterAuthSource = "MONGO_SHARDED_CLUSTER_AUTH_SOURCE"
)
View Source
const (
	ConfigDefaultReplicaSetName = "rscfg"
)

Variables

This section is empty.

Functions

func InferReplicaSet

func InferReplicaSet(config mongoshardedconfig.ReplicaSetConfig, defaultValue string) (string, error)

func StopCluster

func StopCluster(logger log.Logger, envInfo EnvironmentInfo) error

Types

type Cluster

type Cluster struct {
	MongoSList []MongoS
	ShardList  []ShardReplicaSet
	ConfigRS   ConfigReplicaSet
}

func (Cluster) GetAllPids

func (c Cluster) GetAllPids() ([]int, error)

type ConfigReplicaSet

type ConfigReplicaSet struct {
	ReplicaSet   string
	MongoDaemons []MongoD
}

func LaunchConfigReplicaSet

func LaunchConfigReplicaSet(
	logger log.Logger,
	binInfo EnvironmentInfo,
	config mongoshardedconfig.ReplicaSetConfig,
) (ConfigReplicaSet, error)

func (*ConfigReplicaSet) Close

func (c *ConfigReplicaSet) Close() error

type EnvironmentInfo

type EnvironmentInfo struct {
	BinaryPath    string   // path to mongo server
	WorkspacePath string   // path with write access where to store cluster info and logs
	LogsPath      string   // separate path for logs
	LdPreload     []string // aux dynamic libraries to preload before launch
}

func (EnvironmentInfo) MongoDPath

func (b EnvironmentInfo) MongoDPath() string

func (EnvironmentInfo) MongoSPath

func (b EnvironmentInfo) MongoSPath() string

func (EnvironmentInfo) PidFilePath

func (b EnvironmentInfo) PidFilePath() string

type MongoD

type MongoD struct {
	Host        string
	Port        int
	PidFilePath string
}

func StartReplicaSet

func StartReplicaSet(
	logger log.Logger,
	binInfo EnvironmentInfo,
	config mongoshardedconfig.ReplicaSetConfig,
	replicaSet string,
	mode MongoDMode,
) ([]MongoD, error)

func (MongoD) Close

func (d MongoD) Close() error

func (MongoD) Fqdn

func (d MongoD) Fqdn() string

func (MongoD) WithRootConnection

func (d MongoD) WithRootConnection(ctxFunc func(client *mongo.Client) error) (errResult error)

type MongoDMode

type MongoDMode string
var (
	MongoDConfigSvr MongoDMode = "configsvr"
	MongoDShardSvr  MongoDMode = "shardsvr"
)

type MongoS

type MongoS struct {
	Host        string
	Port        int
	PidFilePath string
	Config      ConfigReplicaSet
	Shards      []ShardReplicaSet
}

func StartSingleMongos

func StartSingleMongos(
	logger log.Logger,
	binInfo EnvironmentInfo,
	configReplicaSet ConfigReplicaSet,
	shardReplicaSets []ShardReplicaSet,
	config interface{}) (MongoS, error)

func (MongoS) Close

func (s MongoS) Close() error

func (MongoS) Fqdn

func (s MongoS) Fqdn() string

func (MongoS) WithRootConnection

func (s MongoS) WithRootConnection(ctxFunc func(client *mongo.Client) error) (errResult error)

type ShardReplicaSet

type ShardReplicaSet struct {
	ReplicaSet   string
	MongoDaemons []MongoD
}

func LaunchMongoShard

func LaunchMongoShard(
	logger log.Logger,
	binInfo EnvironmentInfo,
	config mongoshardedconfig.ReplicaSetConfig,
	defaultShardName string,
) (ShardReplicaSet, error)

LaunchMongoShardWithParams length of auxiliary `params` array equals mongod instances to be launched.

func (*ShardReplicaSet) Close

func (c *ShardReplicaSet) Close() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳