github.com/matrixorigin/matrixone@v1.2.0/pkg/hakeeper/operator/create_operator.go (about) 1 // Copyright 2020 PingCAP, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 // Portions of this file are additionally subject to the following 15 // copyright. 16 // 17 // Copyright (C) 2021 Matrix Origin. 18 // 19 // Modified the behavior and the interface of the step. 20 21 package operator 22 23 import ( 24 pb "github.com/matrixorigin/matrixone/pkg/pb/logservice" 25 ) 26 27 func CreateAddReplica(uuid string, shardInfo pb.LogShardInfo, replicaID uint64) (*Operator, error) { 28 return NewBuilder("", shardInfo).AddPeer(string(uuid), replicaID).Build() 29 } 30 31 func CreateRemoveReplica(uuid string, shardInfo pb.LogShardInfo) (*Operator, error) { 32 return NewBuilder("", shardInfo).RemovePeer(string(uuid)).Build() 33 } 34 35 func CreateStopReplica(brief string, uuid string, shardID uint64, epoch uint64) *Operator { 36 return NewOperator(brief, shardID, 0, 37 StopLogService{Replica{uuid, shardID, 0, epoch}}) 38 } 39 40 func CreateKillZombie(brief, uuid string, shardID, replicaID uint64) *Operator { 41 return NewOperator(brief, shardID, 0, 42 KillLogZombie{Replica{UUID: uuid, ShardID: shardID, ReplicaID: replicaID}}) 43 } 44 45 func CreateStartReplica(brief, uuid string, shardID, replicaID uint64) *Operator { 46 return NewOperator(brief, shardID, 0, 47 StartLogService{Replica{UUID: uuid, ShardID: shardID, ReplicaID: replicaID}}) 48 } 49 50 func CreateTaskServiceOp(brief, uuid string, serviceType pb.ServiceType, user pb.TaskTableUser) *Operator { 51 return NewOperator(brief, 0, 0, 52 CreateTaskService{StoreID: uuid, StoreType: serviceType, TaskUser: user}, 53 ) 54 } 55 56 func CreateDeleteCNOp(brief, uuid string) *Operator { 57 return NewOperator(brief, 0, 0, DeleteCNStore{StoreID: uuid}) 58 } 59 60 func JoinGossipClusterOp(brief, uuid string, existing []string) *Operator { 61 return NewOperator(brief, 0, 0, 62 JoinGossipCluster{StoreID: uuid, Existing: existing}, 63 ) 64 } 65 66 func CreateDeleteProxyOp(brief, uuid string) *Operator { 67 return NewOperator(brief, 0, 0, DeleteProxyStore{StoreID: uuid}) 68 }