MCPcopy Create free account
hub / github.com/apache/incubator-pegasus / PrintSinglePausing

Function PrintSinglePausing

admin-cli/executor/bulk_load.go:397–424  ·  view source on GitHub ↗
(client *Client, resp *admin.QueryBulkLoadResponse, partitionIndex int, detailed bool)

Source from the content-addressed store, hash-verified

395}
396
397func PrintSinglePausing(client *Client, resp *admin.QueryBulkLoadResponse, partitionIndex int, detailed bool) {
398 stateMap := resp.GetBulkLoadStates()[partitionIndex]
399 if !detailed {
400 PrintSingleSummary(client, resp.GetAppName(), int32(partitionIndex), resp.GetPartitionsStatus()[partitionIndex])
401 return
402 }
403 var sList []interface{}
404 type singleStruct struct {
405 Node string `json:"NodeAddress"`
406 PStatus string `json:"PartitionStatus"`
407 Paused bool `json:"IsPaused"`
408 }
409 for node, state := range stateMap {
410 sList = append(sList, singleStruct{
411 Node: node.String(),
412 PStatus: resp.GetPartitionsStatus()[partitionIndex].String(),
413 Paused: state.GetIsPaused(),
414 })
415 }
416 util.SortStructsByField(sList, "Node")
417 tabular.New(client, sList, func(tbWriter *tablewriter.Table) {
418 tbWriter.SetFooter([]string{
419 fmt.Sprintf("Table(%s) Partition[%d]", resp.GetAppName(), partitionIndex),
420 fmt.Sprintf("Table(%s)", resp.GetAppStatus().String()),
421 "",
422 })
423 }).Render()
424}
425
426func PrintSingleSummary(client *Client, tableName string, pidx int32, partitionStatus admin.BulkLoadStatus) {
427 var tList []interface{}

Callers 1

QueryBulkLoadFunction · 0.85

Calls 3

PrintSingleSummaryFunction · 0.85
RenderMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected