util

package
v0.0.0-...-f79c7ce Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EtcdKey

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

EtcdKey represents a complete key in Etcd.

func NewEtcdKey

func NewEtcdKey(key string) EtcdKey

NewEtcdKey creates an EtcdKey for the given string.

func NewEtcdKeyFromBytes

func NewEtcdKeyFromBytes(key []byte) EtcdKey

NewEtcdKeyFromBytes creates an EtcdKey for the given bytes.

func (EtcdKey) AsRelKey

func (key EtcdKey) AsRelKey() EtcdRelKey

AsRelKey casts the EtcdKey to an EtcdRelKey.

func (EtcdKey) Bytes

func (key EtcdKey) Bytes() []byte

Bytes returns the bytes representation of the key.

func (EtcdKey) Head

func (key EtcdKey) Head() EtcdPrefix

Head returns a EtcdRelPrefix that is the first segment of the key. For example, if key.String() == "/a/b/c", then key.Head() == "/a".

func (EtcdKey) RemovePrefix

func (key EtcdKey) RemovePrefix(prefix *EtcdPrefix) EtcdRelKey

RemovePrefix removes a prefix from the key. It is a wrapper for strings.TrimPrefix.

func (EtcdKey) String

func (key EtcdKey) String() string

String returns the string representation of the key.

func (EtcdKey) Tail

func (key EtcdKey) Tail() EtcdRelKey

Tail returns an EtcdRelKey that is the key without the first segment. For example, if key.String() == "/a/b/c", then key.Tail() == "/b/c".

type EtcdPrefix

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

EtcdPrefix represents a string that might be the prefix of a valid key in Etcd.

func NewEtcdPrefix

func NewEtcdPrefix(prefix string) EtcdPrefix

NewEtcdPrefix creates an EtcdPrefix from the given string. For a safer version, use NormalizePrefix.

func NewEtcdPrefixFromBytes

func NewEtcdPrefixFromBytes(prefix []byte) EtcdPrefix

NewEtcdPrefixFromBytes creates an EtcdPrefix from the given bytes. For a safer version, use NormalizePrefix.

func NormalizePrefix

func NormalizePrefix(prefix string) EtcdPrefix

NormalizePrefix adds a slash to the beginning of `prefix` if none is present, and removes a trailing slash, if one is present.

func (EtcdPrefix) Bytes

func (prefix EtcdPrefix) Bytes() []byte

Bytes returns the bytes representation of the EtcdPrefix.

func (EtcdPrefix) FullKey

func (prefix EtcdPrefix) FullKey(key EtcdRelKey) EtcdKey

FullKey transforms an EtcdRelKey to an EtcdKey by adding the prefix to it.

func (EtcdPrefix) Head

func (prefix EtcdPrefix) Head() EtcdPrefix

Head returns a EtcdPrefix that is the first segment of the given prefix.

func (EtcdPrefix) String

func (prefix EtcdPrefix) String() string

String returns the string representation of the EtcdPrefix.

func (EtcdPrefix) Tail

func (prefix EtcdPrefix) Tail() EtcdRelPrefix

Tail returns a EtcdRelPrefix that is the given prefix with its first segment removed.

type EtcdRelKey

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

EtcdRelKey represents a string that might be used as a suffix of a valid Etcd key.

func NewEtcdRelKey

func NewEtcdRelKey(key string) EtcdRelKey

NewEtcdRelKey creates an EtcdRelKey for the given string.

func NewEtcdRelKeyFromBytes

func NewEtcdRelKeyFromBytes(key []byte) EtcdRelKey

NewEtcdRelKeyFromBytes creates an EtcdRelKey for the given bytes.

func (*EtcdRelKey) AsPrefix

func (rkey *EtcdRelKey) AsPrefix() EtcdRelPrefix

AsPrefix casts EtcdRelKey into EtcdRelPrefix.

func (EtcdRelKey) Bytes

func (rkey EtcdRelKey) Bytes() []byte

Bytes returns the bytes representation of the key.

func (EtcdRelKey) Head

func (rkey EtcdRelKey) Head() EtcdRelPrefix

Head returns an EtcdRelPrefix that is the first segment of the key. For example, if key.String() == "/a/b/c", then key.Head() == "/a".

func (EtcdRelKey) RemovePrefix

func (rkey EtcdRelKey) RemovePrefix(prefix *EtcdRelPrefix) EtcdRelKey

RemovePrefix removes a prefix from the key. It is a wrapper for strings.TrimPrefix.

func (EtcdRelKey) String

func (rkey EtcdRelKey) String() string

String returns the string representation of the key.

func (EtcdRelKey) Tail

func (rkey EtcdRelKey) Tail() EtcdRelKey

Tail returns an EtcdRelKey that is the key without the first segment. For example, if key.String() == "/a/b/c", then key.Tail() == "/b/c".

type EtcdRelPrefix

type EtcdRelPrefix struct {
	EtcdPrefix
}

EtcdRelPrefix represents a prefix to a meaningful suffix of a valid EtcdKey.

func NewEtcdRelPrefix

func NewEtcdRelPrefix(prefix string) EtcdRelPrefix

NewEtcdRelPrefix creates an EtcdRelPrefix from the given string.

func NewEtcdRelPrefixFromBytes

func NewEtcdRelPrefixFromBytes(prefix []byte) EtcdRelPrefix

NewEtcdRelPrefixFromBytes creates an EtcdRelPrefix from the given bytes.

Jump to

Keyboard shortcuts

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