keeper

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeForFileName added in v2.8.1

func EscapeForFileName(s string) string

EscapeForFileName - Go port of ClickHouse src/Common/escapeForFileName.cpp, used to build the `<zookeeper_path>/<type char>/<name>` znode name for RBAC objects stored in a `replicated` user directory

func WalkDumpFile added in v2.8.1

func WalkDumpFile(dumpFile string, fn func(node DumpNode) error) error

WalkDumpFile - read jsonl dump file line by line and call fn for each node, node.Path is relative to the dumped prefix, supports both the current binary and the legacy string value format

Types

type DumpNode added in v2.5.0

type DumpNode struct {
	Path  string `json:"path"`
	Value []byte `json:"value"` // json encodes/decodes as base64 automatically
}

type DumpNodeString added in v2.6.35

type DumpNodeString struct {
	Path  string `json:"path"`
	Value string `json:"value"`
}

old format used during restore

type Keeper

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

func (*Keeper) ChildCount added in v2.5.0

func (k *Keeper) ChildCount(prefix, nodePath string) (int, error)

func (*Keeper) Close

func (k *Keeper) Close()

func (*Keeper) Connect

func (k *Keeper) Connect(ctx context.Context, ch *clickhouse.ClickHouse) error

Connect - connect to any zookeeper server from /var/lib/clickhouse/preprocessed_configs/config.xml

func (*Keeper) Delete added in v2.5.0

func (k *Keeper) Delete(nodePath string) error

Delete - remove znode, already removed znode is not an error, look https://github.com/Altinity/clickhouse-backup/issues/1048

func (*Keeper) Dump

func (k *Keeper) Dump(prefix, dumpFile string) (int, error)

func (*Keeper) EnsureNode added in v2.8.1

func (k *Keeper) EnsureNode(nodePath string) error

EnsureNode - create znode with empty value when it doesn't exist yet, nodePath shall be already resolved via ResolvePath

func (*Keeper) GetReplicatedAccessPath

func (k *Keeper) GetReplicatedAccessPath(userDirectory string) (string, error)

func (*Keeper) ResolvePath added in v2.8.1

func (k *Keeper) ResolvePath(nodePath string) string

ResolvePath - apply <zookeeper><root> chroot to the passed znode path

func (*Keeper) Restore

func (k *Keeper) Restore(dumpFile, prefix string, skipNode func(node DumpNode) bool) error

Restore - restore keeper nodes from dumpFile under prefix, skipNode allow skip node restore, receives node with relative path from the dump, could be nil

func (*Keeper) Upsert added in v2.8.1

func (k *Keeper) Upsert(nodePath string, value []byte) error

Upsert - create znode with value or overwrite value when znode already exists, several concurrent writers of the same znode are allowed, parent znodes are not created, use EnsureNode for that, nodePath shall be already resolved via ResolvePath, look https://github.com/Altinity/clickhouse-backup/issues/1048

func (*Keeper) Walk added in v2.5.0

func (k *Keeper) Walk(prefix, relativePath string, recursive bool, callback WalkCallBack) error

type LogKeeperToApexLogAdapter

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

func (LogKeeperToApexLogAdapter) Printf

func (KeeperLogToApexLogAdapter LogKeeperToApexLogAdapter) Printf(msg string, args ...interface{})

type WalkCallBack added in v2.5.0

type WalkCallBack = func(node DumpNode) (bool, error)

Jump to

Keyboard shortcuts

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