arangod

package
v0.0.0-...-540bb61 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyNotFoundError = errors.New("Key not found")
)

Functions

func CleanNumberOfServers

func CleanNumberOfServers(ctx context.Context, conn driver.Connection) error

CleanNumberOfServers removes the server count

func CreateArangodClient

func CreateArangodClient(ctx context.Context, cli typedCore.CoreV1Interface, apiObject *api.ArangoDeployment, group api.ServerGroup, id string) (driver.Client, error)

CreateArangodClient creates a go-driver client for a specific member in the given group.

func CreateArangodDatabaseClient

func CreateArangodDatabaseClient(ctx context.Context, cli typedCore.CoreV1Interface, apiObject *api.ArangoDeployment, shortTimeout bool) (driver.Client, error)

CreateArangodDatabaseClient creates a go-driver client for accessing the entire cluster (or single server).

func CreateArangodImageIDClient

func CreateArangodImageIDClient(ctx context.Context, deployment k8sutil.APIObject, ip string) (driver.Client, error)

CreateArangodImageIDClient creates a go-driver client for an ArangoDB instance running in an Image-ID pod.

func GroupsWithLicenseV2

func GroupsWithLicenseV2() api.ServerGroups

func IsDBServerEmpty

func IsDBServerEmpty(ctx context.Context, id string, client driver.Client) error

IsDBServerEmpty checks if the dbserver identified by the given ID no longer has any data on it. The given driver must have all coordinators as endpoints. The functions returns an error when the check could not be completed or the dbserver is not empty, or nil when the dbserver is found to be empty.

func IsKeyNotFound

func IsKeyNotFound(err error) bool

IsKeyNotFound returns true if the given error is (or is caused by) a KeyNotFoundError.

func IsNotLeader

func IsNotLeader(err error) (string, bool)

IsNotLeader returns true if the given error is (or is caused by) a NotLeaderError.

func IsSameEndpoint_

func IsSameEndpoint_(a, b string) bool

IsSameEndpoint returns true when the 2 given endpoints refer to the same server.

func IsServerAvailable

func IsServerAvailable(ctx context.Context, c driver.Client) (bool, error)

IsServerAvailable returns true when server is available. In active fail-over mode one of the server should be available.

func RemoveServerFromCluster

func RemoveServerFromCluster(ctx context.Context, conn driver.Connection, id driver.ServerID) error

RemoveServerFromCluster tries to remove a coordinator or DBServer from the cluster.

func SetNumberOfServers

func SetNumberOfServers(ctx context.Context, conn driver.Connection, noCoordinators, noDBServers *int) error

SetNumberOfServers updates the number of servers the cluster has.

func WithRequireAuthentication

func WithRequireAuthentication(ctx context.Context) context.Context

WithRequireAuthentication prepares a context that when given to functions in this file will fail when authentication is not available.

func WithSkipAuthentication

func WithSkipAuthentication(ctx context.Context) context.Context

WithSkipAuthentication prepares a context that when given to functions in this file will avoid creating any authentication for arango clients.

Types

type NotLeaderError

type NotLeaderError struct {
	Leader string // Endpoint of the current leader
}

NotLeaderError indicates the response of an agent when it is not the leader of the agency.

func (NotLeaderError) Error

func (e NotLeaderError) Error() string

Error implements error.

type NumberOfServers

type NumberOfServers struct {
	Coordinators *int `json:"numberOfCoordinators,omitempty"`
	DBServers    *int `json:"numberOfDBServers,omitempty"`
}

NumberOfServers is the JSON structure return for the numberOfServers API call.

func GetNumberOfServers

func GetNumberOfServers(ctx context.Context, conn driver.Connection) (NumberOfServers, error)

GetNumberOfServers fetches the number of servers the cluster wants to have.

func (NumberOfServers) GetCoordinators

func (n NumberOfServers) GetCoordinators() int

GetCoordinators returns Coordinators if not nil, otherwise 0.

func (NumberOfServers) GetDBServers

func (n NumberOfServers) GetDBServers() int

GetDBServers returns DBServers if not nil, otherwise 0.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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