Documentation
¶
Overview ¶
Package cluster connects the data transfer commands to a cluster through its liaisons: the connection preflight, the group listing and the dry-run Plan call of an export.
Index ¶
- func FetchGroups(ctx context.Context, conn *grpc.ClientConn) ([]*commonv1.Group, error)
- func Preflight(ctx context.Context, candidates []string, opts ConnectOptions) (*Liaisons, *Info, error)
- func UnitCatalog(u *transferv1.UnitInventory) commonv1.Catalog
- func UnitGroup(u *transferv1.UnitInventory) string
- func Unsupported(err error) error
- type ConnectOptions
- type Info
- type Liaison
- type Liaisons
- type PlanResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchGroups ¶
FetchGroups lists every group through the liaison's registry service but the groups the server creates for its own bookkeeping, which are no data to transfer.
func Preflight ¶
func Preflight(ctx context.Context, candidates []string, opts ConnectOptions) (*Liaisons, *Info, error)
Preflight probes every liaison candidate concurrently and keeps each one that answers, in the given order, after checking it is a liaison with a non-empty data-node table. A candidate that cannot be reached, whose answer is lost in transport, or whose registry is still empty is skipped with a WARN line; a reachable endpoint that refuses the credentials or is not a liaison is a configuration error that stops the preflight, the first such candidate in order winning. At least one candidate must be usable; the cluster information comes from the first, the primary.
func UnitCatalog ¶
func UnitCatalog(u *transferv1.UnitInventory) commonv1.Catalog
UnitCatalog is the catalog of a unit: PROPERTY for a property inventory, the segment unit's catalog otherwise.
func UnitGroup ¶
func UnitGroup(u *transferv1.UnitInventory) string
UnitGroup is the group a unit belongs to, whichever kind it is.
func Unsupported ¶
Unsupported adds an upgrade hint to the UNIMPLEMENTED answer of a server without ExportService; the gRPC status stays reachable for exitcode.For.
Types ¶
type ConnectOptions ¶
type ConnectOptions struct {
// Log receives a WARN line for every candidate that is skipped; nil discards them.
Log io.Writer
Cert string
Username string
Password string
Timeout time.Duration
// DescribeTimeout bounds one candidate's describe RPCs; 0 is 10s.
DescribeTimeout time.Duration
EnableTLS bool
Insecure bool
}
ConnectOptions are the dial parameters shared by every liaison candidate.
type Info ¶
type Info struct {
Liaison string
DataNodes []*databasev1.Node
// Liaisons are the names of the liaisons the cluster has registered (route table tire1) and
// the primary liaison's own name, sorted; a standalone server's own name.
Liaisons []string
Standalone bool
}
Info is what the connection preflight learned about the source cluster from the primary liaison.
func (*Info) DataNodeNames ¶
DataNodeNames names the data nodes of the cluster, sorted and without duplicates; nil for a nil Info.
type Liaison ¶
type Liaison struct {
Conn *grpc.ClientConn
Addr string
}
Liaison is one usable liaison: its address and its connection.
type Liaisons ¶
type Liaisons struct {
All []*Liaison
}
Liaisons are the usable liaisons in the order they were given. The first is the primary: the schema, Plan and Sessions calls go through it, while export streams are spread over all of them.
func (*Liaisons) Primary ¶
func (l *Liaisons) Primary() *grpc.ClientConn
Primary is the connection of the first usable liaison.
type PlanResult ¶
type PlanResult struct {
Frames []*transferv1.UnitFrame
UnreachableNodes []string
AnsweredNodes []string
PreemptedSessionIDs []string
}
PlanResult is everything one Plan call returned. Frames holds the `units` frames with node_id stamped and the stage normalized; the node lists come from the `summary` frame.
func CollectPlanFrames ¶
func CollectPlanFrames(stream transferv1.ExportService_PlanClient) (*PlanResult, error)
CollectPlanFrames drains a Plan stream: a dry run, or a create after its `created` frame was read. `units` frames are kept, the single `summary` frame closes the stream and is folded into the result, and frames from nodes the liaison reported unreachable are dropped so a half-answered node counts as a coverage gap, not as a source; a frame from a node the summary lists as neither answered nor unreachable breaks the protocol. A `created` frame at this point, a second summary or any frame after it breaks the protocol; a stream that ends without the summary is an error too: without it the coverage is unknown.
func RunPlan ¶
func RunPlan(ctx context.Context, conn *grpc.ClientConn, selectors []*transferv1.Selector) (*PlanResult, error)
RunPlan performs the single server-streaming live-directory Plan call of a dry run.