keeper

package
v2.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 22 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) Children added in v2.8.2

func (k *Keeper) Children(nodePath string) ([]string, error)

Children - list znode children, empty list when znode doesn't exist, nodePath shall be already resolved via ResolvePath

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) Create added in v2.8.2

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

Create - create persistent znode with value, return false when znode already exists, parent shall exist, nodePath shall be already resolved via ResolvePath

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) DumpTree added in v2.8.2

func (k *Keeper) DumpTree(prefix string) ([]DumpNode, error)

DumpTree - return persistent znodes under prefix in pre-order with paths relative to prefix, prefix itself has empty path, ephemeral znodes are skipped together with their subtrees, znodes removed by a concurrent writer during the walk are skipped, returns zk.ErrNoNode when prefix doesn't exist, look https://github.com/Altinity/clickhouse-backup/issues/1120

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) Exists added in v2.8.2

func (k *Keeper) Exists(nodePath string) (bool, error)

Exists - check znode existence, nodePath shall be already resolved via ResolvePath

func (*Keeper) Get added in v2.8.2

func (k *Keeper) Get(nodePath string) ([]byte, bool, error)

Get - return znode value and existence flag, 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