agency

package
v0.0.0-...-bc898c7 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArangoKey   = "arango"
	ArangoDBKey = "arangodb"

	PlanKey    = "Plan"
	CurrentKey = "Current"
	TargetKey  = "Target"

	CurrentMaintenanceServers = "MaintenanceServers"
	CurrentServersKnown       = "ServersKnown"

	TargetHotBackupKey = "HotBackup"

	PlanCollectionsKey = "Collections"
	PlanDatabasesKey   = "Databases"

	SupervisionKey            = "Supervision"
	SupervisionMaintenanceKey = "Maintenance"

	TargetJobToDoKey     = "ToDo"
	TargetJobPendingKey  = "Pending"
	TargetJobFailedKey   = "Failed"
	TargetJobFinishedKey = "Finished"

	TargetCleanedServersKey = "CleanedServers"

	ArangoSyncKey                     = "arangosync"
	ArangoSyncStateKey                = "synchronizationState"
	ArangoSyncStateIncomingKey        = "incoming"
	ArangoSyncStateIncomingStateKey   = "state"
	ArangoSyncStateOutgoingKey        = "outgoing"
	ArangoSyncStateOutgoingTargetsKey = "targets"
)

Variables

This section is empty.

Functions

func DelayLoader

func DelayLoader[T interface{}](loader agencyCache.StateLoader[T], delay time.Duration) agencyCache.StateLoader[T]

func GetAgencyKey

func GetAgencyKey(parts ...string) string

func GetAgencyState

func GetAgencyState[T interface{}](ctx context.Context, connection conn.Connection) (T, error)

func InvalidateOnErrorLoader

func InvalidateOnErrorLoader[T interface{}](loader agencyCache.StateLoader[T]) agencyCache.StateLoader[T]

func NewSimpleStateLoader

func NewSimpleStateLoader[T interface{}]() agencyCache.StateLoader[T]

func RefreshLoader

func RefreshLoader[T interface{}](loader agencyCache.StateLoader[T], delay time.Duration) agencyCache.StateLoader[T]

func RetryLoader

func RetryLoader[T interface{}](loader agencyCache.StateLoader[T], retries int) agencyCache.StateLoader[T]

func StaticLeaderDiscovery

func StaticLeaderDiscovery(in conn.Connection) agencyCache.LeaderDiscovery

func TimeoutLoader

func TimeoutLoader[T interface{}](loader agencyCache.StateLoader[T], timeout time.Duration) agencyCache.StateLoader[T]

Types

type Cache

type Cache interface {
	Reload(ctx context.Context, size int, clients Connections) (uint64, error)
	// Deprecated: Use Apply instead.
	// It can cause Read/Write error when state is reloaded.
	Data() (state.State, bool)
	// Apply applies a function to the current state. Returns true if function was applied
	Apply(f func(state.State)) bool
	DataDB() (state.DB, bool)
	CommitIndex() uint64
	// Health returns true when healthy object is available.
	Health() (Health, bool)
	// ShardsInSyncMap returns last in sync state of shards. If no state is available, false is returned.
	ShardsInSyncMap() (state.ShardsSyncStatus, bool)
}

func NewAgencyCache

func NewAgencyCache(namespace, name string) Cache

func NewCache

func NewCache(namespace, name string, mode *api.DeploymentMode) Cache

func NewSingleCache

func NewSingleCache() Cache

type Config

type Config struct {
	LeaderId string `json:"leaderId"`

	CommitIndex uint64 `json:"commitIndex"`

	Configuration struct {
		ID string `json:"id"`
	} `json:"configuration"`
}

func GetAgencyConfig

func GetAgencyConfig(ctx context.Context, connection conn.Connection) (*Config, error)

type Connections

type Connections map[string]conn.Connection

type Health

type Health interface {
	// Healthy return nil when environment is considered as healthy.
	Healthy() error

	// Serving return nil when environment is considered as responsive, but not fully healthy.
	Serving() error

	// LeaderID returns a leader ID or empty string if a leader is not known.
	LeaderID() string

	CollectMetrics(m metrics.PushMetric)
}

Health describes interface to check healthy of the environment.

type ReadRequest

type ReadRequest [][]string

func GetAgencyReadRequest

func GetAgencyReadRequest(elements ...[]string) ReadRequest

func GetAgencyReadRequestFields

func GetAgencyReadRequestFields() ReadRequest

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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