state

package
v0.0.0-...-bb45038 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArangoSync

type ArangoSync struct {
	State ArangoSyncState `json:"synchronizationState"`
}

func (*ArangoSync) IsSyncInProgress

func (a *ArangoSync) IsSyncInProgress() bool

type ArangoSyncIncomingState

type ArangoSyncIncomingState struct {
	State *string `json:"state,omitempty"`
}

type ArangoSyncLazy

type ArangoSyncLazy struct {
	Error error
	*ArangoSync
}

ArangoSyncLazy allows failure during load of the Sync state

func (*ArangoSyncLazy) UnmarshalJSON

func (a *ArangoSyncLazy) UnmarshalJSON(bytes []byte) error

type ArangoSyncOutgoingState

type ArangoSyncOutgoingState struct {
	Targets Exists `json:"targets,omitempty"`
}

type ArangoSyncState

type ArangoSyncState struct {
	Incoming ArangoSyncIncomingState `json:"incoming"`
	Outgoing ArangoSyncOutgoingState `json:"outgoing"`
}

type CollectionShardDetail

type CollectionShardDetail struct {
	Database   string
	Collection string
	Shard      string
}

type CollectionShardDetails

type CollectionShardDetails []CollectionShardDetail

func GetDBServerBlockingRestartShards

func GetDBServerBlockingRestartShards(s State, serverID Server) CollectionShardDetails

func GetDBServerShardsNotInSync

func GetDBServerShardsNotInSync(s State, serverID Server) CollectionShardDetails

type Current

type Current struct {
	MaintenanceServers CurrentMaintenanceServers `json:"MaintenanceServers,omitempty"`
	Collections        CurrentCollections        `json:"Collections"`

	// ServersKnown stores information about ArangoDB servers.
	ServersKnown map[driver.ServerID]ServerKnown `json:"ServersKnown,omitempty"`
}

type CurrentCollections

type CurrentCollections map[string]CurrentDBCollections

CurrentCollections is a map of database name to collections

func (CurrentCollections) IsDBServerPresent

func (a CurrentCollections) IsDBServerPresent(name Server) bool

type CurrentDBCollection

type CurrentDBCollection map[string]CurrentDBShard

CurrentDBCollection is a map of Shard name to Shard details

func (CurrentDBCollection) IsDBServerPresent

func (a CurrentDBCollection) IsDBServerPresent(name Server) bool

type CurrentDBCollections

type CurrentDBCollections map[string]CurrentDBCollection

CurrentDBCollections is a map of collection name to shards

func (CurrentDBCollections) IsDBServerPresent

func (a CurrentDBCollections) IsDBServerPresent(name Server) bool

type CurrentDBShard

type CurrentDBShard struct {
	Servers Servers `json:"servers,omitempty"`
}

type CurrentMaintenanceServer

type CurrentMaintenanceServer struct {
	Mode  *CurrentMaintenanceServerMode `json:"Mode,omitempty"`
	Until Timestamp                     `json:"Until,omitempty"`
}

func (*CurrentMaintenanceServer) InMaintenance

func (s *CurrentMaintenanceServer) InMaintenance() bool

type CurrentMaintenanceServerMode

type CurrentMaintenanceServerMode string
const (
	CurrentMaintenanceServerModeMaintenance CurrentMaintenanceServerMode = "maintenance"
)

type CurrentMaintenanceServers

type CurrentMaintenanceServers map[Server]CurrentMaintenanceServer

func (CurrentMaintenanceServers) InMaintenance

func (s CurrentMaintenanceServers) InMaintenance(server Server) bool

type DB

type DB struct {
	ArangoSync ArangoSyncLazy `json:"arangosync,omitempty"`
}

type DumpState

type DumpState struct {
	Agency Root `json:"agency"`
}

type Exists

type Exists []byte

func (Exists) Exists

func (d Exists) Exists() bool

func (Exists) Hash

func (d Exists) Hash() string

func (*Exists) UnmarshalJSON

func (d *Exists) UnmarshalJSON(bytes []byte) error

type Job

type Job struct {
	Type   string `json:"type,omitempty"`
	Reason string `json:"reason,omitempty"`
}

type JobID

type JobID string

type JobPhase

type JobPhase string
var (
	JobPhaseUnknown  JobPhase = ""
	JobPhaseToDo     JobPhase = "ToDo"
	JobPhasePending  JobPhase = "Pending"
	JobPhaseFailed   JobPhase = "Failed"
	JobPhaseFinished JobPhase = "Finished"
)

type Jobs

type Jobs map[JobID]Job

type Plan

type Plan struct {
	Collections PlanCollections `json:"Collections"`
	Databases   PlanDatabases   `json:"Databases,omitempty"`
}

type PlanCollection

type PlanCollection struct {
	Name   *string `json:"name"`
	Shards Shards  `json:"shards"`
	// deprecated
	// MinReplicationFactor is deprecated, but we have to support it for backward compatibility
	MinReplicationFactor *int               `json:"minReplicationFactor,omitempty"`
	WriteConcern         *int               `json:"writeConcern,omitempty"`
	ReplicationFactor    *ReplicationFactor `json:"replicationFactor,omitempty"`
	DistributeShardsLike *string            `json:"distributeShardsLike,omitempty"`
}

func (PlanCollection) GetName

func (a PlanCollection) GetName(d string) string

func (*PlanCollection) GetReplicationFactor

func (a *PlanCollection) GetReplicationFactor(shard string) ReplicationFactor

func (*PlanCollection) GetWriteConcern

func (a *PlanCollection) GetWriteConcern(def int) int

func (*PlanCollection) GetWriteConcernP

func (a *PlanCollection) GetWriteConcernP() *int

func (*PlanCollection) IsDBServerInShards

func (a *PlanCollection) IsDBServerInShards(name Server) bool

func (*PlanCollection) IsDBServerLeader

func (a *PlanCollection) IsDBServerLeader(name Server) bool

type PlanCollections

type PlanCollections map[string]PlanDBCollections

PlanCollections is a map of database name to collections

func (PlanCollections) IsDBServerLeader

func (a PlanCollections) IsDBServerLeader(name Server) bool

func (PlanCollections) IsDBServerPresent

func (a PlanCollections) IsDBServerPresent(name Server) bool

type PlanDBCollections

type PlanDBCollections map[string]PlanCollection

PlanDBCollections is a map of collection name to collection details

func (PlanDBCollections) CountShards

func (a PlanDBCollections) CountShards() int

func (PlanDBCollections) IsDBServerInCollections

func (a PlanDBCollections) IsDBServerInCollections(name Server) bool

func (PlanDBCollections) IsDBServerLeaderInCollections

func (a PlanDBCollections) IsDBServerLeaderInCollections(name Server) bool

type PlanDatabase

type PlanDatabase struct {
	ID string `json:"id"`
}

type PlanDatabases

type PlanDatabases map[string]PlanDatabase

type ReplicationFactor

type ReplicationFactor int
const (
	UnknownReplicationFactor   ReplicationFactor = -1000
	SatelliteReplicationFactor ReplicationFactor = -100
)

func (*ReplicationFactor) IsNil

func (r *ReplicationFactor) IsNil() bool

func (*ReplicationFactor) IsSatellite

func (r *ReplicationFactor) IsSatellite() bool

func (*ReplicationFactor) IsUnknown

func (r *ReplicationFactor) IsUnknown() bool

func (*ReplicationFactor) UnmarshalJSON

func (r *ReplicationFactor) UnmarshalJSON(bytes []byte) error

type Root

type Root struct {
	Arango   State `json:"arango"`
	ArangoDB DB    `json:"arangodb,omitempty"`
}

type Server

type Server string

type ServerKnown

type ServerKnown struct {
	// RebootID is an incremental value which describes how many times server was restarted.
	RebootID int `json:"rebootId"`
}

ServerKnown stores information about single ArangoDB server.

type Servers

type Servers []Server

func (Servers) Contains

func (s Servers) Contains(id Server) bool

func (Servers) Equals

func (s Servers) Equals(ids Servers) bool

func (Servers) InSync

func (s Servers) InSync(ids Servers) bool

func (Servers) Join

func (s Servers) Join(ids Servers) Servers

func (Servers) Sort

func (s Servers) Sort()

type ShardDetails

type ShardDetails struct {
	ShardID    string
	Database   string
	Collection string
	Servers    Servers
}

type ShardFilter

type ShardFilter func(s State, db, col, shard string) bool

func FilterDBServerShardRestart

func FilterDBServerShardRestart(serverID Server) ShardFilter

func FilterDBServerShardsNotInSync

func FilterDBServerShardsNotInSync(serverID Server) ShardFilter

func NegateFilter

func NegateFilter(in ShardFilter) ShardFilter

type ShardStatus

type ShardStatus struct {
	IsSynced bool
}

type Shards

type Shards map[string]Servers

type ShardsSyncStatus

type ShardsSyncStatus map[string]time.Time

func (ShardsSyncStatus) NotInSyncSince

func (s ShardsSyncStatus) NotInSyncSince(t time.Duration) []string

NotInSyncSince returns a list of shards that have not been in sync for at least t.

type State

type State struct {
	Supervision Supervision `json:"Supervision"`
	Plan        Plan        `json:"Plan"`
	Current     Current     `json:"Current"`
	Target      Target      `json:"Target"`
}

func (State) CountShards

func (s State) CountShards() int

func (State) Filter

func (State) GetCollectionDatabaseByID

func (s State) GetCollectionDatabaseByID(id string) (string, bool)

GetCollectionDatabaseByID find Database name by Collection ID

func (State) GetDBServerWithLowestShards

func (s State) GetDBServerWithLowestShards() Server

GetDBServerWithLowestShards returns the DBServer with the lowest amount of shards

func (State) GetRebootID

func (s State) GetRebootID(id driver.ServerID) (int, bool)

GetRebootID returns reboot ID for a given server ID. returns false when a server ID does not exist in cache.

func (State) GetShardDetailsByID

func (s State) GetShardDetailsByID(id string) (ShardDetails, bool)

GetShardDetailsByID returns the ShardDetails for a given ShardID. If the ShardID is not found, the second return value is false

func (State) GetShardsStatus

func (s State) GetShardsStatus() map[string]bool

func (State) IsShardInSync

func (s State) IsShardInSync(db, col, shard string, servers Servers) bool

func (State) PlanLeaderServers

func (s State) PlanLeaderServers() Servers

PlanLeaderServers returns all servers which are part of the plan as a leader

func (State) PlanLeaderServersWithFailOver

func (s State) PlanLeaderServersWithFailOver() Servers

PlanLeaderServersWithFailOver returns all servers which are part of the plan as a leader and can fail over

func (State) PlanServers

func (s State) PlanServers() Servers

PlanServers returns all servers which are part of the plan

func (State) ShardsByDBServers

func (s State) ShardsByDBServers() map[Server]int

ShardsByDBServers returns a map of DBServers and the amount of shards they have

type Supervision

type Supervision struct {
	Maintenance Timestamp `json:"Maintenance,omitempty"`
}

type Target

type Target struct {
	JobToDo     Jobs `json:"ToDo,omitempty"`
	JobPending  Jobs `json:"Pending,omitempty"`
	JobFailed   Jobs `json:"Failed,omitempty"`
	JobFinished Jobs `json:"Finished,omitempty"`

	CleanedServers     Servers `json:"CleanedServers,omitempty"`
	ToBeCleanedServers Servers `json:"ToBeCleanedServers,omitempty"`

	HotBackup TargetHotBackup `json:"HotBackup,omitempty"`
}

func (Target) GetJob

func (s Target) GetJob(id JobID) (Job, JobPhase)

func (Target) GetJobIDs

func (s Target) GetJobIDs() []JobID

type TargetHotBackup

type TargetHotBackup struct {
	Create Timestamp `json:"Create,omitempty"`
}

type Timestamp

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

func (*Timestamp) Exists

func (s *Timestamp) Exists() bool

func (*Timestamp) Hash

func (s *Timestamp) Hash() string

func (*Timestamp) Time

func (s *Timestamp) Time() (time.Time, bool)

func (*Timestamp) UnmarshalJSON

func (s *Timestamp) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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