helpers

package
v4.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerTypeStandalone = "standalone"
	ServerTypeBuiltin    = "builtin"
)

Variables

This section is empty.

Functions

func ConfigureReplication

func ConfigureReplication(t *testing.T, rx *reindexer.Reindexer, role string, ns []string, nodes []reindexer.DBAsyncReplicationNode)

func CreateCluster

func CreateCluster(t *testing.T, servers []*TestServer, nsName string, nsItem interface{})

func CreateReplication

func CreateReplication(t *testing.T, master *TestServer, slaves []*TestServer, nsName string, nsItem interface{})

func WaitForSyncWithMaster

func WaitForSyncWithMaster(t *testing.T, master *reindexer.Reindexer, slave *reindexer.Reindexer)

func WriteShardingConfig

func WriteShardingConfig(t *testing.T, cfg *TestShardingConfig)

Types

type ClusterConf

type ClusterConf struct {
	AppName               string              `yaml:"app_name"`
	Namespaces            []string            `yaml:"namespaces"`
	UpdatesTimeoutSec     int                 `yaml:"updates_timeout_sec"`
	EnableCompression     bool                `yaml:"enable_compression"`
	SyncThreads           int                 `yaml:"sync_threads"`
	SyncsPerThread        int                 `yaml:"syncs_per_thread"`
	RetrySyncIntervalMsec int                 `yaml:"retry_sync_interval_msec"`
	Nodes                 []ClusterNodeConfig `yaml:"nodes"`
}

func DefaultClusterConf

func DefaultClusterConf() *ClusterConf

func (*ClusterConf) ToFile

func (cc *ClusterConf) ToFile(path, filename string) error

type ClusterNodeConfig

type ClusterNodeConfig struct {
	DSN      string `yaml:"dsn"`
	ServerID int    `yaml:"server_id"`
}

type ReplicationConf

type ReplicationConf struct {
	ClusterID int `yaml:"cluster_id"`
	ServerID  int `yaml:"server_id"`
}

func (*ReplicationConf) ToFile

func (rc *ReplicationConf) ToFile(path, filename string) error

type TestServer

type TestServer struct {
	T        *testing.T
	RpcPort  string
	HttpPort string
	DbName   string

	SrvType       string
	EnableCluster bool
	// contains filtered or unexported fields
}

func (*TestServer) Clean

func (srv *TestServer) Clean() error

func (*TestServer) DB

func (srv *TestServer) DB() *reindexer.Reindexer

func (*TestServer) GetDSN

func (srv *TestServer) GetDSN() string

func (*TestServer) GetDbName

func (srv *TestServer) GetDbName() string

func (*TestServer) GetFullStoragePath

func (srv *TestServer) GetFullStoragePath() string

func (*TestServer) GetHttpAddr

func (srv *TestServer) GetHttpAddr() string

func (*TestServer) GetRpcAddr

func (srv *TestServer) GetRpcAddr() string

func (*TestServer) Run

func (srv *TestServer) Run() error

func (*TestServer) Stop

func (srv *TestServer) Stop() error

type TestShardConfig

type TestShardConfig struct {
	ShardID int         `yaml:"shard_id"`
	DSNS    []yaml.Node `yaml:"dsns"`
}

type TestShardKeyConfig

type TestShardKeyConfig struct {
	ShardID int      `yaml:"shard_id"`
	Values  []string `yaml:"values"`
}

type TestShardedNamespaceConfig

type TestShardedNamespaceConfig struct {
	Name         string               `yaml:"namespace"`
	DefaultShard int                  `yaml:"default_shard"`
	Index        string               `yaml:"index"`
	Keys         []TestShardKeyConfig `yaml:"keys"`
}

type TestShardingConfig

type TestShardingConfig struct {
	Namespaces []TestShardedNamespaceConfig
	Shards     []*TestServer
}

type TestShardingSerializableConfig

type TestShardingSerializableConfig struct {
	Version     int                          `yaml:"version"`
	Namespaces  []TestShardedNamespaceConfig `yaml:"namespaces"`
	Shards      []TestShardConfig            `yaml:"shards"`
	ThisShardID int                          `yaml:"this_shard_id"`
}

Jump to

Keyboard shortcuts

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