instance

package
v0.0.0-...-6b32d26 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 17 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BulkReadInstance

func BulkReadInstance(dbt string) (instKeyList []*dtstruct.InstanceKey, err error)

BulkReadInstance returns a list of all instances from the database - I only need the Hostname and Port fields. - I must use ReadInstanceByCondition to ensure all column settings are correct.

func CheckInstance

func CheckInstance(ctx context.Context, instanceKey *dtstruct.InstanceKey, agent string, latency *stopwatch.NamedStopwatch) (dtstruct.InstanceAdaptor, error)

GetInfoFromInstance collect information from the instance and write the result synchronously to the backend.

func FindInstance

func FindInstance(dbt string, regexpPattern string) (result []dtstruct.InstanceAdaptor, err error)

FindInstance reads all instances whose name matches given pattern

func ForgetClusterInstance

func ForgetClusterInstance(dbt string, clusterName string) (err error)

ForgetClusterInstance removes an instance entry from the backed database. It may be auto-rediscovered through topology or requested for discovery by multiple means.

func ForgetInstance

func ForgetInstance(instanceKey *dtstruct.InstanceKey) error

ForgetInstance delete instance by forget according to instance type

func GetHeuristicClusterPoolInstance

func GetHeuristicClusterPoolInstance(dbt string, clusterName string, pool string) (result []dtstruct.InstanceAdaptor, err error)

GetHeuristicClusterPoolInstance returns instances of a cluster which are also pooled. If `pool` argument is empty, all pools are considered, otherwise, only instances of given pool are considered.

func GetHeuristicClusterPoolInstanceLag

func GetHeuristicClusterPoolInstanceLag(dbt string, clusterName string, pool string) (int64, error)

GetHeuristicClusterPoolInstanceLag returns a heuristic lag for the instances participating in a cluster pool (or all the cluster's pools)

func GetInfoFromInstance

func GetInfoFromInstance(ctx context.Context, instanceKey *dtstruct.InstanceKey, agent string, latency *stopwatch.NamedStopwatch) (dtstruct.InstanceAdaptor, error)

GetInfoFromInstance collect information from the instance and write the result synchronously to the backend.

func GetInfoSync

func GetInfoSync(instanceKey *dtstruct.InstanceKey, agent string) (interface{}, error)

GetInfoSync get node sync info.

func GetInstanceMaxLag

func GetInstanceMaxLag(instanceList []dtstruct.InstanceAdaptor) (maxLag int64, err error)

GetInstanceMaxLag return the maximum lag in a set of instances

func GetMastersKVPair

func GetMastersKVPair(dbt string, clusterName string) (kvPairs []*dtstruct.KVPair, err error)

GetMastersKVPair get a listing of KVPair for clusters master, for all clusters or for a specific cluster.

func HeuristicallyApplyClusterDomainInstanceAttribute

func HeuristicallyApplyClusterDomainInstanceAttribute(dbt string, clusterName string) (instanceKey *dtstruct.InstanceKey, err error)

HeuristicallyApplyClusterDomainInstanceAttribute writes down the cluster-domain to master-hostname as a general attribute, by reading current topology and **trusting** it to be correct

func InjectSeed

func InjectSeed(instanceKey *dtstruct.InstanceKey) error

InjectSeed intent to be used to inject an instance upon startup, assuming it's not already known.

func InjectUnseenMaster

func InjectUnseenMaster() error

InjectUnseenMaster will review masters of instances that are known to be replicating, yet which are not listed in ham_database_instance. Since their replicas are listed as replicating, we can assume that such masters actually do exist: we shall therefore inject them with minimal details into the ham_database_instance table.

func IsInstanceExistInBackendDB

func IsInstanceExistInBackendDB(instanceKey *dtstruct.InstanceKey) dtstruct.InstanceAdaptor

IsInstanceExistInBackendDB check if instance exist in backend database

func ReadClusterInstance

func ReadClusterInstance(dbt string, clusterName string) ([]dtstruct.InstanceAdaptor, error)

ReadClusterInstance is a generic function to read instances for cluster

func ReadClusterMaster

func ReadClusterMaster(dbt string, clusterName string) ([]dtstruct.InstanceAdaptor, error)

ReadClusterMaster returns the master of this cluster. - if the cluster has co-masters, the/a writable one is returned - if the cluster has a single master, that master is returned whether it is read-only or writable.

func ReadClusterMasterWriteable

func ReadClusterMasterWriteable(dbt string, clusterName string) ([]dtstruct.InstanceAdaptor, error)

ReadClusterMasterWriteable returns the/a writeable master of this cluster Typically, the cluster name indicates the master of the cluster. However, in circular master-master replication one master can assume the name of the cluster, and it is not guaranteed that it is the writeable one.

func ReadInstance

func ReadInstance(instanceKey *dtstruct.InstanceKey) (dtstruct.InstanceAdaptor, bool, error)

ReadInstance reads an instance from the backend database

func ReadInstanceByCondition

func ReadInstanceByCondition(dbt string, query string, condition string, args []interface{}, sort string) ([]dtstruct.InstanceAdaptor, error)

ReadInstanceByCondition is a generic function to read instance from the backend database

func ReadInstanceDownStream

func ReadInstanceDownStream(dbt string, masterKey *dtstruct.InstanceKey) ([]dtstruct.InstanceAdaptor, error)

ReadInstanceDownStream read all downstream instance of a given master.

func ReadInstanceDowntime

func ReadInstanceDowntime(dbt string, clusterName string) ([]dtstruct.InstanceAdaptor, error)

ReadInstanceDowntime returns all instances currently marked as downtime, potentially filtered by cluster

func ReadInstanceKeyOutDate

func ReadInstanceKeyOutDate() (res []dtstruct.InstanceKey, err error)

ReadInstanceKeyOutDate reads and returns keys for all instances that are not up to date (i.e. pre-configured time has passed since they were last checked) But we also check for the case where an attempt at instance checking has been made, that hasn't resulted in an actual check! This can happen when TCP/IP connections are hung, in which case the "check" never returns. In such case we multiply interval by a factor, so as not to open too many connections on the instance.

func ReadInstanceLostInRecovery

func ReadInstanceLostInRecovery(dbt string, clusterName string) ([]dtstruct.InstanceAdaptor, error)

ReadInstanceLostInRecovery returns all instances (potentially filtered by cluster) which are currently indicated as downtime due to being lost during a topology recovery.

func ReadInstanceMinimal

func ReadInstanceMinimal() (res []dtstruct.MinimalInstance, err error)

ReadInstanceMinimal get minimal instance with minimal base info

func ReadInstanceProblem

func ReadInstanceProblem(dbt string, clusterName string) ([]dtstruct.InstanceAdaptor, error)

ReadInstanceProblem reads all instances with problems

func ReadInstanceUnSeen

func ReadInstanceUnSeen(dbt string) ([]dtstruct.InstanceAdaptor, error)

ReadInstanceUnSeen reads all instances which were not recently seen.

func ReadMasterWriteable

func ReadMasterWriteable() (instanceList []*dtstruct.Instance, err error)

ReadMasterWriteable returns writeable masters of all clusters, but only one per cluster, in similar logic to ReadClusterMasterWriteable

func ReviewInstanceUnSeen

func ReviewInstanceUnSeen(dbt string) error

ReviewInstanceUnSeen reviews instance that have not been seen (supposedly dead) and updates some of their data

func SearchInstance

func SearchInstance(dbt string, searchString string) ([]dtstruct.InstanceAdaptor, error)

SearchInstance reads all instances qualifying for some search string

func WriteInstance

func WriteInstance(instanceList []dtstruct.InstanceAdaptor, instanceWasActuallyFound bool, updateLastSeen bool, lastError error) error

WriteInstance write all instances to backend db

Types

This section is empty.

Jump to

Keyboard shortcuts

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