Documentation ¶
Index ¶
- Constants
- func ConnectToInstance(instanceName string, ctx *context.Ctx) (*connector.Conn, error)
- func ConnectToMembership(conn *connector.Conn, runningInstancesNames map[string]string, ...) error
- func ConnectToSomeJoinedInstance(ctx *context.Ctx) (*connector.Conn, error)
- func ConnectToSomeRunningInstance(ctx *context.Ctx) (*connector.Conn, error)
- func GetJoinedInstanceName(instancesConf *InstancesConf, ctx *context.Ctx) (string, error)
- func GetRandomInstanceName(instances map[string]string) string
- func HealthCheckIsNeeded(conn *connector.Conn) (bool, error)
- type InstanceConf
- type InstancesConf
- type InstancesFilter
- type MembershipInstance
- type MembershipInstances
Constants ¶
const (
SimpleOperationTimeout = 10 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func ConnectToInstance ¶
func ConnectToMembership ¶
func ConnectToSomeJoinedInstance ¶
ConnectToSomeJoinedInstance connects to some instance joined to cluster. It's used for actions with joined cluster, e.g. setting replicaset parameters.
func ConnectToSomeRunningInstance ¶
ConnectToSomeRunningInstance connects to some running instance. It's used for some actions that can be performed via any instance socket, no matter if this instance is joined to cluster or not. For example, to get known roles or vhsard groups list.
func GetJoinedInstanceName ¶
func GetJoinedInstanceName(instancesConf *InstancesConf, ctx *context.Ctx) (string, error)
GetJoinedInstanceName returns a name of local instance that is already joined to cluster. It gets all local membership instances and checks if there is some instance that has UUID (it means that this instance is joined to cluster). The main reason of using membership here is that instances that aren't joined can see joined instances only if they are connected to the one membership.
func GetRandomInstanceName ¶
GetRandomInstanceName returns random instance name from the map. Empty string is returned if the map is empty.
Types ¶
type InstanceConf ¶
type InstanceConf struct {
URI string `yaml:"advertise_uri"`
}
type InstancesConf ¶
type InstancesConf map[string]*InstanceConf
func GetInstancesConf ¶
func GetInstancesConf(ctx *context.Ctx) (*InstancesConf, error)
type InstancesFilter ¶
type InstancesFilter func(*MembershipInstances, map[string]string)
type MembershipInstance ¶
func (*MembershipInstance) DecodeMsgpack ¶
func (membershipInstance *MembershipInstance) DecodeMsgpack(d *msgpack.Decoder) error
type MembershipInstances ¶
type MembershipInstances map[string]*MembershipInstance
func GetMembershipInstances ¶
func GetMembershipInstances(instancesConf *InstancesConf, ctx *context.Ctx, filters ...InstancesFilter) (*MembershipInstances, error)
GetMembershipInstances returns MembershipInstances for currently configured instances First, it connects all instances to membership (probes all running instances by one of them). Then, it gets all membership instances members. filters are an Options pattern to perform modifications of the instances container.
func GetMembershipInstancesFromConn ¶
func GetMembershipInstancesFromConn(conn *connector.Conn) (*MembershipInstances, error)