scyllaclient

package
v1.15.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTimeout is returned when request times out.
	ErrTimeout = errors.New("timeout")
)

Functions

func DefaultTransport added in v0.1.6

func DefaultTransport() *http.Transport

func StatusCodeOf added in v0.1.6

func StatusCodeOf(err error) int

StatusCodeOf returns HTTP status code carried by the error or it's cause. If not status can be found it returns 0.

Types

type Client

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

func NewClient added in v0.1.6

func NewClient(config *Config) (*Client, error)

func (*Client) Cleanup added in v1.10.0

func (c *Client) Cleanup(ctx context.Context, host string, keyspace string) error

func (*Client) Close added in v1.8.0

func (c *Client) Close()

func (*Client) Decommission added in v0.1.6

func (c *Client) Decommission(ctx context.Context, host string) error

func (*Client) DeleteSnapshot added in v1.0.0

func (c *Client) DeleteSnapshot(ctx context.Context, host, tag string) error

DeleteSnapshot removes a snapshot with a given tag.

func (*Client) Drain added in v1.0.0

func (c *Client) Drain(ctx context.Context, host string) error

Drain makes node unavailable for writes, flushes memtables and replays commitlog

func (*Client) GetIPToHostIDMap added in v1.10.0

func (c *Client) GetIPToHostIDMap(ctx context.Context, host string) (map[string]string, error)

func (*Client) GetLocalHostId added in v1.8.0

func (c *Client) GetLocalHostId(ctx context.Context, host string, retry bool) (string, error)

func (*Client) GetNodeTokens added in v1.10.0

func (c *Client) GetNodeTokens(ctx context.Context, host, endpoint string) ([]string, error)

func (*Client) GetSnitchDatacenter added in v1.11.0

func (c *Client) GetSnitchDatacenter(ctx context.Context, host string) (string, error)

func (*Client) GetTokenRing added in v1.10.0

func (c *Client) GetTokenRing(ctx context.Context, host string) ([]string, error)

func (*Client) HasSchemaAgreement added in v1.3.0

func (c *Client) HasSchemaAgreement(ctx context.Context) (bool, error)

func (*Client) IsNativeTransportEnabled added in v1.0.0

func (c *Client) IsNativeTransportEnabled(ctx context.Context, host string) (bool, error)

func (*Client) Keyspaces added in v1.0.0

func (c *Client) Keyspaces(ctx context.Context) ([]string, error)

Keyspaces return a list of all the keyspaces.

func (*Client) OperationMode added in v0.1.6

func (c *Client) OperationMode(ctx context.Context, host string) (OperationalMode, error)

func (*Client) Ping added in v0.2.4

func (c *Client) Ping(ctx context.Context, host string) (time.Duration, error)

Ping checks if host is available using HTTP ping and returns RTT. Ping requests are not retried, use this function with caution.

func (*Client) ScyllaVersion added in v1.0.0

func (c *Client) ScyllaVersion(ctx context.Context) (string, error)

func (*Client) Snapshots added in v1.0.0

func (c *Client) Snapshots(ctx context.Context, host string) ([]string, error)

Snapshots lists available snapshots.

func (*Client) Status

func (c *Client) Status(ctx context.Context, host string) (NodeStatusInfoSlice, error)

func (*Client) StopCleanup added in v1.11.0

func (c *Client) StopCleanup(ctx context.Context, host string) error

func (*Client) TakeSnapshot added in v1.0.0

func (c *Client) TakeSnapshot(ctx context.Context, host, tag, keyspace string, tables ...string) error

TakeSnapshot flushes and takes a snapshot of a keyspace. Multiple keyspaces may have the same tag.

type CompactionType added in v1.11.0

type CompactionType string
const (
	CompactionCompactionType CompactionType = "COMPACTION"
	CleanupCompactionType    CompactionType = "CLEANUP"
	ScrubCompactionType      CompactionType = "SCRUB"
	UpgradeCompactionType    CompactionType = "UPGRADE"
	ReshapeCompactionType    CompactionType = "RESHAPE"
)

type Config added in v0.1.6

type Config struct {
	// Hosts specifies all the cluster hosts that for a pool of hosts for the
	// client.
	Hosts []string
	// Port specifies the default Scylla Manager agent port.
	Port string
	// Transport scheme HTTP or HTTPS.
	Scheme string
	// AuthToken specifies the authentication token.
	AuthToken string `yaml:"auth_token"`
	// Timeout specifies time to complete a single request to Scylla REST API
	// possibly including opening a TCP connection.
	Timeout time.Duration `yaml:"timeout"`
	// PoolDecayDuration specifies size of time window to measure average
	// request time in Epsilon-Greedy host pool.
	PoolDecayDuration time.Duration
	// Transport allows for setting a custom round tripper to send HTTP
	// requests over not standard connections i.e. over SSH tunnel.
	Transport http.RoundTripper
}

Config specifies the Client configuration.

func DefaultConfig added in v0.1.6

func DefaultConfig(authToken string, hosts ...string) *Config

DefaultConfig returns a Config initialized with default values.

func (*Config) Validate added in v0.1.6

func (c *Config) Validate() error

Validate checks if all the fields are properly set.

type ConfigClient added in v1.10.0

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

func NewConfigClient added in v1.10.0

func NewConfigClient(host, authToken string) *ConfigClient

func (*ConfigClient) BroadcastAddress added in v1.10.0

func (c *ConfigClient) BroadcastAddress(ctx context.Context) (string, error)

func (*ConfigClient) BroadcastRPCAddress added in v1.11.0

func (c *ConfigClient) BroadcastRPCAddress(ctx context.Context) (string, error)

func (*ConfigClient) ReplaceAddressFirstBoot added in v1.10.0

func (c *ConfigClient) ReplaceAddressFirstBoot(ctx context.Context) (string, error)

ReplaceAddressFirstBoot returns value of "replace_address_first_boot" config parameter.

func (*ConfigClient) ReplaceNodeFirstBoot added in v1.10.0

func (c *ConfigClient) ReplaceNodeFirstBoot(ctx context.Context) (string, error)

ReplaceNodeFirstBoot returns value of "replace_node_first_boot" config parameter.

type NodeState

type NodeState string

NodeState represents nodetool State=Normal/Leaving/Joining/Moving

const (
	NodeStateNormal  NodeState = ""
	NodeStateLeaving NodeState = "LEAVING"
	NodeStateJoining NodeState = "JOINING"
	NodeStateMoving  NodeState = "MOVING"
)

NodeState enumeration

func (NodeState) String

func (s NodeState) String() string

type NodeStatus

type NodeStatus bool

NodeStatus represents nodetool Status=Up/Down.

const (
	NodeStatusUp   NodeStatus = true
	NodeStatusDown NodeStatus = false
)

NodeStatus enumeration

func (NodeStatus) String

func (s NodeStatus) String() string

type NodeStatusInfo

type NodeStatusInfo struct {
	HostID string
	Addr   string
	Status NodeStatus
	State  NodeState
}

NodeStatusInfo represents a nodetool status line.

func (NodeStatusInfo) IsUN

func (s NodeStatusInfo) IsUN() bool

IsUN returns true if host is Up and NORMAL meaning it's a fully functional live node.

func (NodeStatusInfo) String added in v0.1.6

func (s NodeStatusInfo) String() string

type NodeStatusInfoSlice

type NodeStatusInfoSlice []NodeStatusInfo

NodeStatusInfoSlice adds functionality to Status response.

func (NodeStatusInfoSlice) DownHosts

func (s NodeStatusInfoSlice) DownHosts() []string

DownHosts returns slice of address of nodes that are down.

func (NodeStatusInfoSlice) Hosts

func (s NodeStatusInfoSlice) Hosts() []string

Hosts returns slice of address of all nodes.

func (NodeStatusInfoSlice) LiveHosts

func (s NodeStatusInfoSlice) LiveHosts() []string

LiveHosts returns slice of address of nodes in UN state.

type OperationalMode added in v0.1.6

type OperationalMode string
const (
	OperationalModeClient          OperationalMode = "CLIENT"
	OperationalModeDecommissioned  OperationalMode = "DECOMMISSIONED"
	OperationalModeDecommissioning OperationalMode = "DECOMMISSIONING"
	OperationalModeJoining         OperationalMode = "JOINING"
	OperationalModeLeaving         OperationalMode = "LEAVING"
	OperationalModeNormal          OperationalMode = "NORMAL"
	OperationalModeDrained         OperationalMode = "DRAINED"
	OperationalModeDraining        OperationalMode = "DRAINING"
	OperationalModeUnknown         OperationalMode = "UNKNOWN"
)

func (OperationalMode) IsDecommissioned added in v1.0.0

func (o OperationalMode) IsDecommissioned() bool

func (OperationalMode) IsDecommissioning added in v1.0.0

func (o OperationalMode) IsDecommissioning() bool

func (OperationalMode) IsDrained added in v1.0.0

func (o OperationalMode) IsDrained() bool

func (OperationalMode) IsDraining added in v1.0.0

func (o OperationalMode) IsDraining() bool

func (OperationalMode) IsJoining added in v1.0.0

func (o OperationalMode) IsJoining() bool

func (OperationalMode) IsLeaving added in v1.0.0

func (o OperationalMode) IsLeaving() bool

func (OperationalMode) IsNormal added in v1.0.0

func (o OperationalMode) IsNormal() bool

func (OperationalMode) String added in v0.1.6

func (o OperationalMode) String() string

Jump to

Keyboard shortcuts

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