helpers

package
v4.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 18 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 WaitForSyncV4V3 added in v4.13.0

func WaitForSyncV4V3(t *testing.T, rxV4 *reindexer.Reindexer, rxV3 *reindexer.Reindexer)

func WaitForSyncWithMaster

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

func WaitForSyncWithMasterV3V3 added in v4.13.0

func WaitForSyncWithMasterV3V3(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"`
	LogLevel              string              `yaml:"log_level"`
	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 LegacyDBConfigItem added in v4.13.0

type LegacyDBConfigItem struct {
	Type        string                          `json:"type"`
	Profiling   *reindexer.DBProfilingConfig    `json:"profiling,omitempty"`
	Namespaces  *[]reindexer.DBNamespacesConfig `json:"namespaces,omitempty"`
	Replication *LegacyDBReplicationConfig      `json:"replication,omitempty"`
}

type LegacyDBReplicationConfig added in v4.13.0

type LegacyDBReplicationConfig struct {
	// ID of the current server
	ServerID int `yaml:"server_id"`
	// Replication role. One of  none, slave, master
	Role string `yaml:"role"`
	// DSN to master. Only cproto schema is supported
	MasterDSN string `yaml:"master_dsn",omitempty`
	// Cluster ID - must be same for client and for master
	ClusterID int `json:"cluster_id"`
	// force resync on logic error conditions
	ForceSyncOnLogicError bool `json:"force_sync_on_logic_error"`
	// force resync on wrong data hash conditions
	ForceSyncOnWrongDataHash bool `json:"force_sync_on_wrong_data_hash"`
	// List of namespaces for replication. If emply, all namespaces. All replicated namespaces will become read only for slave
	Namespaces []string `json:"namespaces"`
}

type LegacyNamespaceMemStat added in v4.13.0

type LegacyNamespaceMemStat struct {
	// Name of namespace
	Name string `json:"name"`
	// Replication status of namespace
	Replication struct {
		// Last Log Sequence Number (LSN) of applied namespace modification
		LastLSN reindexer.LsnT `json:"last_lsn_v2"`
		// If true, then namespace is in slave mode
		SlaveMode bool `json:"slave_mode"`
		// True enable replication
		ReplicatorEnabled bool `json:"replicator_enabled"`
		// Temporary namespace flag
		Temporary bool `json:"temporary"`
		// Number of storage's master <-> slave switches
		IncarnationCounter int64 `json:"incarnation_counter"`
		// Hashsum of all records in namespace
		DataHash uint64 `json:"data_hash"`
		// Data count
		DataCount int `json:"data_count"`
		// Write Ahead Log (WAL) records count
		WalCount int64 `json:"wal_count"`
		// Total memory consumption of Write Ahead Log (WAL)
		WalSize int64 `json:"wal_size"`
		// Data updated timestamp
		UpdatedUnixNano int64 `json:"updated_unix_nano"`
		// Current replication status
		Status string `json:"status"`
		// Origin LSN of last replication operation
		OriginLSN reindexer.LsnT `json:"origin_lsn"`
		// Last LSN of api operation (not from replication)
		LastSelfLSN reindexer.LsnT `json:"last_self_lsn"`
		// Last Log Sequence Number (LSN) of applied namespace modification
		LastUpstreamLSN reindexer.LsnT `json:"last_upstream_lsn"`
		// Last replication error code
		ErrorCode int64 `json:"error_code"`
		// Last replication error message
		ErrorMessage string `json:"error_message"`
	} `json:"replication"`
}

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
	// 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