Documentation
¶
Index ¶
- Constants
- func BalancerTaskStateToProto(state BalancerTaskState) protos.BalancerTaskStatus
- func BalancerTaskToDb(task *BalancerTask) *qdb.BalancerTask
- func BalancerTaskToProto(task *BalancerTask) *protos.BalancerTask
- func JoinTypeToProto(t JoinType) protos.JoinType
- func RedistributeTaskStateToProto(state RedistributeTaskState) protos.RedistributeTaskState
- func RedistributeTaskToDB(task *RedistributeTask) *qdb.RedistributeTask
- func RedistributeTaskToProto(task *RedistributeTask) *protos.RedistributeTask
- func SplitTypeToProto(t SplitType) protos.SplitType
- func TaskGroupToDb(group *MoveTaskGroup) *qdb.MoveTaskGroup
- func TaskGroupToProto(group *MoveTaskGroup) *protos.MoveTaskGroup
- func TaskStateToProto(state TaskState) protos.TaskStatus
- func TaskStateToStr(state TaskState) string
- func TaskToDb(task *MoveTask) *qdb.MoveTask
- func TaskToProto(task *MoveTask) *protos.MoveTask
- type BalancerTask
- type BalancerTaskState
- type JoinType
- type MoveTask
- type MoveTaskGroup
- type RedistributeTask
- type RedistributeTaskState
- type SplitType
- type TaskMgr
- type TaskState
Constants ¶
const ( TaskPlanned = iota TaskSplit TaskMoved )
const ( JoinNone = iota JoinLeft JoinRight )
const ( SplitLeft = iota SplitRight )
const ( RedistributeTaskPlanned = iota RedistributeTaskMoved )
const ( BalancerTaskPlanned = iota BalancerTaskMoved )
Variables ¶
This section is empty.
Functions ¶
func BalancerTaskStateToProto ¶
func BalancerTaskStateToProto(state BalancerTaskState) protos.BalancerTaskStatus
func BalancerTaskToDb ¶
func BalancerTaskToDb(task *BalancerTask) *qdb.BalancerTask
func BalancerTaskToProto ¶
func BalancerTaskToProto(task *BalancerTask) *protos.BalancerTask
func JoinTypeToProto ¶
JoinTypeToProto converts a JoinType to its corresponding protos.JoinType. It takes a JoinType as input and returns the corresponding protos.JoinType. If the input JoinType is not recognized, it panics with an "incorrect join type" error.
Parameters:
- t: The JoinType value to convert.
Returns:
- protos.JoinType: The converted protos.JoinType value.
func RedistributeTaskStateToProto ¶
func RedistributeTaskStateToProto(state RedistributeTaskState) protos.RedistributeTaskState
func RedistributeTaskToDB ¶
func RedistributeTaskToDB(task *RedistributeTask) *qdb.RedistributeTask
func RedistributeTaskToProto ¶
func RedistributeTaskToProto(task *RedistributeTask) *protos.RedistributeTask
func SplitTypeToProto ¶
SplitTypeToProto converts a SplitType to its corresponding protos.SplitType. It takes a SplitType as input and returns the corresponding protos.SplitType. If the input SplitType is not recognized, it panics with an "incorrect split type" error.
Parameters:
- t: The SplitType value to convert.
Returns:
- protos.SplitType: The converted protos.SplitType value.
func TaskGroupToDb ¶
func TaskGroupToDb(group *MoveTaskGroup) *qdb.MoveTaskGroup
TaskGroupToDb converts a MoveTaskGroup object to a qdb.MoveTaskGroup object. It creates a new qdb.MoveTaskGroup object and populates its fields based on the provided MoveTaskGroup object. The Tasks field is populated by converting each MoveTask object in the group.Tasks slice to a qdb.MoveTask object using the TaskToDb function. The JoinType field is set to the integer value of the group.JoinType. The converted qdb.MoveTaskGroup object is returned.
Parameters:
- group: The MoveTaskGroup object to convert.
Returns:
- *qdb.MoveTaskGroup: The converted qdb.MoveTaskGroup object.
func TaskGroupToProto ¶
func TaskGroupToProto(group *MoveTaskGroup) *protos.MoveTaskGroup
TaskGroupToProto converts a MoveTaskGroup object to its corresponding protobuf representation. It creates a new protos.MoveTaskGroup object and copies the values from the input object to the output object.
Parameters:
- group: The MoveTaskGroup object to convert.
Returns:
- *protos.MoveTaskGroup: The converted protos.MoveTaskGroup object.
func TaskStateToProto ¶
func TaskStateToProto(state TaskState) protos.TaskStatus
TaskStateToProto converts a TaskState value to its corresponding protos.TaskStatus value. It takes a TaskState as input and returns the corresponding protos.TaskStatus value. If the input TaskState is not recognized, it panics with an "incorrect task state" error.
Parameters:
- state: The TaskState value to convert.
Returns:
- protos.TaskStatus: The converted protos.TaskStatus value.
func TaskStateToStr ¶
TaskStateToStr converts a TaskState value to its corresponding string representation. It takes a TaskState as input and returns the corresponding string representation. If the input TaskState is not recognized, it panics with an "incorrect task state" error.
Parameters:
- state: The TaskState value to convert.
Returns:
- string: The string representation of the TaskState value.
func TaskToDb ¶
TaskToDb converts a MoveTask struct to a qdb.MoveTask struct. It takes a pointer to a MoveTask struct as input and returns a pointer to a qdb.MoveTask struct. The function creates a new qdb.MoveTask object and copies the values from the input MoveTask object to the output qdb.MoveTask object.
Parameters:
- task: The MoveTask object to convert.
Returns:
- *qdb.MoveTask: The converted qdb.MoveTask object.
func TaskToProto ¶
TaskToProto converts a MoveTask struct to a protos.MoveTask struct. It creates a new protos.MoveTask object and copies the values from the input object to the output object.
Parameters:
- task: The MoveTask object to convert.
Returns:
- *protos.MoveTask: The converted protos.MoveTask object.
Types ¶
type BalancerTask ¶
type BalancerTask struct { Type JoinType KrIdFrom string KrIdTo string KrIdTemp string ShardIdTo string KeyCount int64 State BalancerTaskState }
func BalancerTaskFromDb ¶
func BalancerTaskFromDb(task *qdb.BalancerTask) *BalancerTask
func BalancerTaskFromProto ¶
func BalancerTaskFromProto(task *protos.BalancerTask) *BalancerTask
type BalancerTaskState ¶
type BalancerTaskState int
func BalancerTaskStateFromProto ¶
func BalancerTaskStateFromProto(state protos.BalancerTaskStatus) BalancerTaskState
type JoinType ¶
type JoinType int
func JoinTypeFromProto ¶
JoinTypeFromProto converts a protos.JoinType to a JoinType. It maps the given protos.JoinType to the corresponding JoinType value. If the given protos.JoinType is not recognized, it panics with an "incorrect join type" error.
Parameters:
- t: The protos.JoinType value to convert.
Returns:
- JoinType: The converted JoinType value.
type MoveTask ¶
func TaskFromDb ¶
TaskFromDb converts a qdb.MoveTask object to a MoveTask object. It takes a pointer to a qdb.MoveTask as input and returns a pointer to a MoveTask. The function creates a new MoveTask object and copies the values from the input qdb.MoveTask object to the output MoveTask object.
Parameters:
- task: The qdb.MoveTask object to convert.
Returns:
- *MoveTask: The converted MoveTask object.
func TaskFromProto ¶
TaskFromProto converts a protos.MoveTask object to a MoveTask object. It creates a new MoveTask object and copies the values from the input object to the output object.
Parameters:
- task: The protos.MoveTask object to convert.
Returns:
- *MoveTask: The converted MoveTask object.
type MoveTaskGroup ¶
type MoveTaskGroup struct { ShardToId string KrIdFrom string KrIdTo string Tasks []*MoveTask Type SplitType }
func TaskGroupFromDb ¶
func TaskGroupFromDb(group *qdb.MoveTaskGroup) *MoveTaskGroup
TaskGroupFromDb converts a database task group to a MoveTaskGroup struct. It takes a pointer to a qdb.MoveTaskGroup as input and returns a pointer to a MoveTaskGroup. The function creates a new MoveTaskGroup object and populates its fields based on the provided qdb.MoveTaskGroup object. The Tasks field is populated by converting each qdb.MoveTask object in the group.Tasks slice to a MoveTask object using the TaskFromDb function. The JoinType field is set to the JoinType value of the qdb.MoveTaskGroup object.
Parameters:
- group: The qdb.MoveTaskGroup object to convert.
Returns:
- *MoveTaskGroup: The converted MoveTaskGroup object.
func TaskGroupFromProto ¶
func TaskGroupFromProto(group *protos.MoveTaskGroup) *MoveTaskGroup
TaskGroupFromProto converts a protos.MoveTaskGroup object to a MoveTaskGroup object. It creates a new MoveTaskGroup object and copies the values from the input object to the output object.
Parameters:
- group: The protos.MoveTaskGroup object to convert.
Returns:
- *MoveTaskGroup: The converted MoveTaskGroup object.
type RedistributeTask ¶
type RedistributeTask struct { KrId string ShardId string BatchSize int TempKrId string State RedistributeTaskState }
func RedistributeTaskFromDB ¶
func RedistributeTaskFromDB(task *qdb.RedistributeTask) *RedistributeTask
func RedistributeTaskFromProto ¶
func RedistributeTaskFromProto(task *protos.RedistributeTask) *RedistributeTask
type RedistributeTaskState ¶
type RedistributeTaskState int
func RedistributeTaskStateFromProto ¶
func RedistributeTaskStateFromProto(state protos.RedistributeTaskState) RedistributeTaskState
type SplitType ¶
type SplitType int
func SplitTypeFromProto ¶
SplitTypeFromProto converts a protos.JoinType to a SplitType. It maps the given protos.SplitType to the corresponding SplitType value. If the given protos.SplitType is not recognized, it panics with an "incorrect split type" error.
Parameters:
- t: The protos.SplitType value to convert.
Returns:
- SplitType: The converted SplitType value.
type TaskMgr ¶
type TaskMgr interface { GetMoveTaskGroup(ctx context.Context) (*MoveTaskGroup, error) WriteMoveTaskGroup(ctx context.Context, taskGroup *MoveTaskGroup) error RemoveMoveTaskGroup(ctx context.Context) error GetBalancerTask(ctx context.Context) (*BalancerTask, error) WriteBalancerTask(ctx context.Context, task *BalancerTask) error RemoveBalancerTask(ctx context.Context) error }
type TaskState ¶
type TaskState int
func TaskStateFromProto ¶
func TaskStateFromProto(state protos.TaskStatus) TaskState
TaskStateFromProto converts a protos.TaskStatus value to a TaskState value. It maps the given protos.TaskStatus to the corresponding TaskState value. If the given protos.TaskStatus is not recognized, it panics with an "incorrect task state" error.
Parameters:
- state: The protos.TaskStatus value to convert.
Returns:
- TaskState: The converted TaskState value.