Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultTransport() *http.Transport
- func Interactive(ctx context.Context) context.Context
- func StatusCodeOf(err error) int
- type BackoffConfig
- type Client
- func (c *Client) CheckHostsConnectivity(ctx context.Context, hosts []string) []error
- func (c *Client) ClosestDC(ctx context.Context, dcs map[string][]string) ([]string, error)
- func (c *Client) Decommission(ctx context.Context, host string) error
- func (c *Client) DeleteSnapshot(ctx context.Context, host, tag string) error
- func (c *Client) Drain(ctx context.Context, host string) error
- func (c *Client) HasSchemaAgreement(ctx context.Context) (bool, error)
- func (c *Client) HostDatacenter(ctx context.Context, host string) (dc string, err error)
- func (c *Client) IsNativeTransportEnabled(ctx context.Context, host string) (bool, error)
- func (c *Client) Keyspaces(ctx context.Context) ([]string, error)
- func (c *Client) OperationMode(ctx context.Context, host string) (OperationalMode, error)
- func (c *Client) Ping(ctx context.Context, host string) (time.Duration, error)
- func (c *Client) PingN(ctx context.Context, host string, n int, timeout time.Duration) (time.Duration, error)
- func (c *Client) ScyllaVersion(ctx context.Context) (string, error)
- func (c *Client) Snapshots(ctx context.Context, host string) ([]string, error)
- func (c *Client) Status(ctx context.Context, host string) (NodeStatusInfoSlice, error)
- func (c *Client) TakeSnapshot(ctx context.Context, host, tag, keyspace string, tables ...string) error
- type CommandStatus
- type Config
- type NodeState
- type NodeStatus
- type NodeStatusInfo
- type NodeStatusInfoSlice
- type OperationalMode
- func (o OperationalMode) IsDecommissioned() bool
- func (o OperationalMode) IsDecommissioning() bool
- func (o OperationalMode) IsDrained() bool
- func (o OperationalMode) IsDraining() bool
- func (o OperationalMode) IsJoining() bool
- func (o OperationalMode) IsLeaving() bool
- func (o OperationalMode) IsNormal() bool
- func (o OperationalMode) String() string
- type ReplicationStrategy
- type Ring
- type ScyllaFeatures
- type TokenRange
- type Unit
Constants ¶
const ( LocalStrategy = "org.apache.cassandra.locator.LocalStrategy" SimpleStrategy = "org.apache.cassandra.locator.SimpleStrategy" NetworkTopologyStrategy = "org.apache.cassandra.locator.NetworkTopologyStrategy" )
Replication strategies
const (
Murmur3Partitioner = "org.apache.cassandra.dht.Murmur3Partitioner"
)
Partitioners
Variables ¶
var ( // ErrTimeout is returned when request times out. ErrTimeout = errors.New("timeout") )
Functions ¶
func DefaultTransport ¶ added in v0.1.6
func Interactive ¶ added in v0.1.6
Interactive context means that it should be processed fast without too much useless waiting.
func StatusCodeOf ¶ added in v0.1.6
StatusCodeOf returns HTTP status code carried by the error or it's cause. If not status can be found it returns 0.
Types ¶
type BackoffConfig ¶ added in v0.1.6
type BackoffConfig struct { WaitMin time.Duration WaitMax time.Duration MaxRetries uint64 Multiplier float64 Jitter float64 }
BackoffConfig specifies request exponential backoff parameters.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CheckHostsConnectivity ¶ added in v0.2.4
CheckHostsConnectivity returns a slice of errors, error at position i corresponds to host at position i.
func (*Client) ClosestDC ¶ added in v0.2.4
ClosestDC takes output of Datacenters, a map from DC to it's hosts and returns DCs sorted by speed the hosts respond. It's determined by the lowest latency over 3 Ping() invocations across random selection of hosts for each DC.
func (*Client) Decommission ¶ added in v0.1.6
func (*Client) DeleteSnapshot ¶ added in v1.0.0
DeleteSnapshot removes a snapshot with a given tag.
func (*Client) Drain ¶ added in v1.0.0
Drain makes node unavailable for writes, flushes memtables and replays commitlog
func (*Client) HasSchemaAgreement ¶ added in v1.3.0
func (*Client) HostDatacenter ¶
HostDatacenter looks up the datacenter that the given host belongs to.
func (*Client) IsNativeTransportEnabled ¶ added in v1.0.0
func (*Client) OperationMode ¶ added in v0.1.6
func (*Client) Ping ¶ added in v0.2.4
Ping checks if host is available using HTTP ping and returns RTT. Ping requests are not retried, use this function with caution.
func (*Client) PingN ¶ added in v0.2.4
func (c *Client) PingN(ctx context.Context, host string, n int, timeout time.Duration) (time.Duration, error)
PingN does "n" amount of pings towards the host and returns average RTT across all results. Pings are tried sequentially and if any of the pings fail function will return an error.
func (*Client) ScyllaVersion ¶ added in v1.0.0
type CommandStatus ¶
type CommandStatus string
CommandStatus specifies a result of a command
const ( CommandRunning CommandStatus = "RUNNING" CommandSuccessful CommandStatus = "SUCCESSFUL" CommandFailed CommandStatus = "FAILED" )
Command statuses
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. Backoff BackoffConfig // InteractiveBackoff specifies backoff for interactive requests i.e. // originating from API / sctool. InteractiveBackoff BackoffConfig // How many seconds to wait for the job to finish before returning // the info response. LongPollingSeconds int64 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
DefaultConfig returns a Config initialized with default values.
type NodeState ¶
type NodeState string
NodeState represents nodetool State=Normal/Leaving/Joining/Moving
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 { Datacenter string 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) Datacenter ¶
func (s NodeStatusInfoSlice) Datacenter(dcs []string) NodeStatusInfoSlice
Datacenter resturns sub slice containing only nodes from given datacenters.
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
type ReplicationStrategy ¶
type ReplicationStrategy string
ReplicationStrategy specifies type of a keyspace replication strategy.
type Ring ¶
type Ring struct { Tokens []TokenRange HostDC map[string]string Replication ReplicationStrategy }
Ring describes token ring of a keyspace.
func (Ring) Datacenters ¶
Datacenters returs a list of datacenters the keyspace is replicated in.
type ScyllaFeatures ¶
type ScyllaFeatures struct {
RowLevelRepair bool
}
ScyllaFeatures specifies features supported by the Scylla version.
type TokenRange ¶
TokenRange describes replicas of a token (range).