Add some CAS WIP

This commit is contained in:
Philip O'Toole
2025-06-22 10:00:52 -04:00
parent 9ebdeccdd7
commit c151bfa41f
3 changed files with 309 additions and 79 deletions

View File

@@ -128,14 +128,16 @@ func (BackupRequest_Format) EnumDescriptor() ([]byte, []int) {
type Command_Type int32 type Command_Type int32
const ( const (
Command_COMMAND_TYPE_UNKNOWN Command_Type = 0 Command_COMMAND_TYPE_UNKNOWN Command_Type = 0
Command_COMMAND_TYPE_QUERY Command_Type = 1 Command_COMMAND_TYPE_QUERY Command_Type = 1
Command_COMMAND_TYPE_EXECUTE Command_Type = 2 Command_COMMAND_TYPE_EXECUTE Command_Type = 2
Command_COMMAND_TYPE_NOOP Command_Type = 3 Command_COMMAND_TYPE_NOOP Command_Type = 3
Command_COMMAND_TYPE_LOAD Command_Type = 4 Command_COMMAND_TYPE_LOAD Command_Type = 4
Command_COMMAND_TYPE_JOIN Command_Type = 5 Command_COMMAND_TYPE_JOIN Command_Type = 5
Command_COMMAND_TYPE_EXECUTE_QUERY Command_Type = 6 Command_COMMAND_TYPE_EXECUTE_QUERY Command_Type = 6
Command_COMMAND_TYPE_LOAD_CHUNK Command_Type = 7 Command_COMMAND_TYPE_LOAD_CHUNK Command_Type = 7
Command_COMMAND_TYPE_COMPARE_AND_SWAP Command_Type = 8
Command_COMMAND_TYPE_COMPARE_AND_DELETE Command_Type = 9
) )
// Enum value maps for Command_Type. // Enum value maps for Command_Type.
@@ -149,16 +151,20 @@ var (
5: "COMMAND_TYPE_JOIN", 5: "COMMAND_TYPE_JOIN",
6: "COMMAND_TYPE_EXECUTE_QUERY", 6: "COMMAND_TYPE_EXECUTE_QUERY",
7: "COMMAND_TYPE_LOAD_CHUNK", 7: "COMMAND_TYPE_LOAD_CHUNK",
8: "COMMAND_TYPE_COMPARE_AND_SWAP",
9: "COMMAND_TYPE_COMPARE_AND_DELETE",
} }
Command_Type_value = map[string]int32{ Command_Type_value = map[string]int32{
"COMMAND_TYPE_UNKNOWN": 0, "COMMAND_TYPE_UNKNOWN": 0,
"COMMAND_TYPE_QUERY": 1, "COMMAND_TYPE_QUERY": 1,
"COMMAND_TYPE_EXECUTE": 2, "COMMAND_TYPE_EXECUTE": 2,
"COMMAND_TYPE_NOOP": 3, "COMMAND_TYPE_NOOP": 3,
"COMMAND_TYPE_LOAD": 4, "COMMAND_TYPE_LOAD": 4,
"COMMAND_TYPE_JOIN": 5, "COMMAND_TYPE_JOIN": 5,
"COMMAND_TYPE_EXECUTE_QUERY": 6, "COMMAND_TYPE_EXECUTE_QUERY": 6,
"COMMAND_TYPE_LOAD_CHUNK": 7, "COMMAND_TYPE_LOAD_CHUNK": 7,
"COMMAND_TYPE_COMPARE_AND_SWAP": 8,
"COMMAND_TYPE_COMPARE_AND_DELETE": 9,
} }
) )
@@ -186,7 +192,7 @@ func (x Command_Type) Number() protoreflect.EnumNumber {
// Deprecated: Use Command_Type.Descriptor instead. // Deprecated: Use Command_Type.Descriptor instead.
func (Command_Type) EnumDescriptor() ([]byte, []int) { func (Command_Type) EnumDescriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{17, 0} return file_command_proto_rawDescGZIP(), []int{20, 0}
} }
type CDCEvent_Operation int32 type CDCEvent_Operation int32
@@ -238,7 +244,7 @@ func (x CDCEvent_Operation) Number() protoreflect.EnumNumber {
// Deprecated: Use CDCEvent_Operation.Descriptor instead. // Deprecated: Use CDCEvent_Operation.Descriptor instead.
func (CDCEvent_Operation) EnumDescriptor() ([]byte, []int) { func (CDCEvent_Operation) EnumDescriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{20, 0} return file_command_proto_rawDescGZIP(), []int{23, 0}
} }
type UpdateHookEvent_Operation int32 type UpdateHookEvent_Operation int32
@@ -290,7 +296,7 @@ func (x UpdateHookEvent_Operation) Number() protoreflect.EnumNumber {
// Deprecated: Use UpdateHookEvent_Operation.Descriptor instead. // Deprecated: Use UpdateHookEvent_Operation.Descriptor instead.
func (UpdateHookEvent_Operation) EnumDescriptor() ([]byte, []int) { func (UpdateHookEvent_Operation) EnumDescriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{22, 0} return file_command_proto_rawDescGZIP(), []int{25, 0}
} }
type Parameter struct { type Parameter struct {
@@ -1393,6 +1399,186 @@ func (x *RemoveNodeRequest) GetId() string {
return "" return ""
} }
type CompareAndSwapRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
PrevExist bool `protobuf:"varint,3,opt,name=prevExist,proto3" json:"prevExist,omitempty"`
PrevValue string `protobuf:"bytes,4,opt,name=prevValue,proto3" json:"prevValue,omitempty"`
PrevIndex uint64 `protobuf:"varint,5,opt,name=prevIndex,proto3" json:"prevIndex,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CompareAndSwapRequest) Reset() {
*x = CompareAndSwapRequest{}
mi := &file_command_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CompareAndSwapRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CompareAndSwapRequest) ProtoMessage() {}
func (x *CompareAndSwapRequest) ProtoReflect() protoreflect.Message {
mi := &file_command_proto_msgTypes[16]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CompareAndSwapRequest.ProtoReflect.Descriptor instead.
func (*CompareAndSwapRequest) Descriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{16}
}
func (x *CompareAndSwapRequest) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *CompareAndSwapRequest) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
func (x *CompareAndSwapRequest) GetPrevExist() bool {
if x != nil {
return x.PrevExist
}
return false
}
func (x *CompareAndSwapRequest) GetPrevValue() string {
if x != nil {
return x.PrevValue
}
return ""
}
func (x *CompareAndSwapRequest) GetPrevIndex() uint64 {
if x != nil {
return x.PrevIndex
}
return 0
}
type CompareAndSwapResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CompareAndSwapResponse) Reset() {
*x = CompareAndSwapResponse{}
mi := &file_command_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CompareAndSwapResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CompareAndSwapResponse) ProtoMessage() {}
func (x *CompareAndSwapResponse) ProtoReflect() protoreflect.Message {
mi := &file_command_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CompareAndSwapResponse.ProtoReflect.Descriptor instead.
func (*CompareAndSwapResponse) Descriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{17}
}
type CompareAndDeleteRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
PrevExist bool `protobuf:"varint,2,opt,name=prevExist,proto3" json:"prevExist,omitempty"`
PrevValue string `protobuf:"bytes,3,opt,name=prevValue,proto3" json:"prevValue,omitempty"`
PrevIndex uint64 `protobuf:"varint,4,opt,name=prevIndex,proto3" json:"prevIndex,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CompareAndDeleteRequest) Reset() {
*x = CompareAndDeleteRequest{}
mi := &file_command_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CompareAndDeleteRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CompareAndDeleteRequest) ProtoMessage() {}
func (x *CompareAndDeleteRequest) ProtoReflect() protoreflect.Message {
mi := &file_command_proto_msgTypes[18]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CompareAndDeleteRequest.ProtoReflect.Descriptor instead.
func (*CompareAndDeleteRequest) Descriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{18}
}
func (x *CompareAndDeleteRequest) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *CompareAndDeleteRequest) GetPrevExist() bool {
if x != nil {
return x.PrevExist
}
return false
}
func (x *CompareAndDeleteRequest) GetPrevValue() string {
if x != nil {
return x.PrevValue
}
return ""
}
func (x *CompareAndDeleteRequest) GetPrevIndex() uint64 {
if x != nil {
return x.PrevIndex
}
return 0
}
type Noop struct { type Noop struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
@@ -1402,7 +1588,7 @@ type Noop struct {
func (x *Noop) Reset() { func (x *Noop) Reset() {
*x = Noop{} *x = Noop{}
mi := &file_command_proto_msgTypes[16] mi := &file_command_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -1414,7 +1600,7 @@ func (x *Noop) String() string {
func (*Noop) ProtoMessage() {} func (*Noop) ProtoMessage() {}
func (x *Noop) ProtoReflect() protoreflect.Message { func (x *Noop) ProtoReflect() protoreflect.Message {
mi := &file_command_proto_msgTypes[16] mi := &file_command_proto_msgTypes[19]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -1427,7 +1613,7 @@ func (x *Noop) ProtoReflect() protoreflect.Message {
// Deprecated: Use Noop.ProtoReflect.Descriptor instead. // Deprecated: Use Noop.ProtoReflect.Descriptor instead.
func (*Noop) Descriptor() ([]byte, []int) { func (*Noop) Descriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{16} return file_command_proto_rawDescGZIP(), []int{19}
} }
func (x *Noop) GetId() string { func (x *Noop) GetId() string {
@@ -1448,7 +1634,7 @@ type Command struct {
func (x *Command) Reset() { func (x *Command) Reset() {
*x = Command{} *x = Command{}
mi := &file_command_proto_msgTypes[17] mi := &file_command_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -1460,7 +1646,7 @@ func (x *Command) String() string {
func (*Command) ProtoMessage() {} func (*Command) ProtoMessage() {}
func (x *Command) ProtoReflect() protoreflect.Message { func (x *Command) ProtoReflect() protoreflect.Message {
mi := &file_command_proto_msgTypes[17] mi := &file_command_proto_msgTypes[20]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -1473,7 +1659,7 @@ func (x *Command) ProtoReflect() protoreflect.Message {
// Deprecated: Use Command.ProtoReflect.Descriptor instead. // Deprecated: Use Command.ProtoReflect.Descriptor instead.
func (*Command) Descriptor() ([]byte, []int) { func (*Command) Descriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{17} return file_command_proto_rawDescGZIP(), []int{20}
} }
func (x *Command) GetType() Command_Type { func (x *Command) GetType() Command_Type {
@@ -1513,7 +1699,7 @@ type CDCValue struct {
func (x *CDCValue) Reset() { func (x *CDCValue) Reset() {
*x = CDCValue{} *x = CDCValue{}
mi := &file_command_proto_msgTypes[18] mi := &file_command_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -1525,7 +1711,7 @@ func (x *CDCValue) String() string {
func (*CDCValue) ProtoMessage() {} func (*CDCValue) ProtoMessage() {}
func (x *CDCValue) ProtoReflect() protoreflect.Message { func (x *CDCValue) ProtoReflect() protoreflect.Message {
mi := &file_command_proto_msgTypes[18] mi := &file_command_proto_msgTypes[21]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -1538,7 +1724,7 @@ func (x *CDCValue) ProtoReflect() protoreflect.Message {
// Deprecated: Use CDCValue.ProtoReflect.Descriptor instead. // Deprecated: Use CDCValue.ProtoReflect.Descriptor instead.
func (*CDCValue) Descriptor() ([]byte, []int) { func (*CDCValue) Descriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{18} return file_command_proto_rawDescGZIP(), []int{21}
} }
func (x *CDCValue) GetValue() isCDCValue_Value { func (x *CDCValue) GetValue() isCDCValue_Value {
@@ -1636,7 +1822,7 @@ type CDCRow struct {
func (x *CDCRow) Reset() { func (x *CDCRow) Reset() {
*x = CDCRow{} *x = CDCRow{}
mi := &file_command_proto_msgTypes[19] mi := &file_command_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -1648,7 +1834,7 @@ func (x *CDCRow) String() string {
func (*CDCRow) ProtoMessage() {} func (*CDCRow) ProtoMessage() {}
func (x *CDCRow) ProtoReflect() protoreflect.Message { func (x *CDCRow) ProtoReflect() protoreflect.Message {
mi := &file_command_proto_msgTypes[19] mi := &file_command_proto_msgTypes[22]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -1661,7 +1847,7 @@ func (x *CDCRow) ProtoReflect() protoreflect.Message {
// Deprecated: Use CDCRow.ProtoReflect.Descriptor instead. // Deprecated: Use CDCRow.ProtoReflect.Descriptor instead.
func (*CDCRow) Descriptor() ([]byte, []int) { func (*CDCRow) Descriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{19} return file_command_proto_rawDescGZIP(), []int{22}
} }
func (x *CDCRow) GetValues() []*CDCValue { func (x *CDCRow) GetValues() []*CDCValue {
@@ -1686,7 +1872,7 @@ type CDCEvent struct {
func (x *CDCEvent) Reset() { func (x *CDCEvent) Reset() {
*x = CDCEvent{} *x = CDCEvent{}
mi := &file_command_proto_msgTypes[20] mi := &file_command_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -1698,7 +1884,7 @@ func (x *CDCEvent) String() string {
func (*CDCEvent) ProtoMessage() {} func (*CDCEvent) ProtoMessage() {}
func (x *CDCEvent) ProtoReflect() protoreflect.Message { func (x *CDCEvent) ProtoReflect() protoreflect.Message {
mi := &file_command_proto_msgTypes[20] mi := &file_command_proto_msgTypes[23]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -1711,7 +1897,7 @@ func (x *CDCEvent) ProtoReflect() protoreflect.Message {
// Deprecated: Use CDCEvent.ProtoReflect.Descriptor instead. // Deprecated: Use CDCEvent.ProtoReflect.Descriptor instead.
func (*CDCEvent) Descriptor() ([]byte, []int) { func (*CDCEvent) Descriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{20} return file_command_proto_rawDescGZIP(), []int{23}
} }
func (x *CDCEvent) GetError() string { func (x *CDCEvent) GetError() string {
@@ -1773,7 +1959,7 @@ type CDCEvents struct {
func (x *CDCEvents) Reset() { func (x *CDCEvents) Reset() {
*x = CDCEvents{} *x = CDCEvents{}
mi := &file_command_proto_msgTypes[21] mi := &file_command_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -1785,7 +1971,7 @@ func (x *CDCEvents) String() string {
func (*CDCEvents) ProtoMessage() {} func (*CDCEvents) ProtoMessage() {}
func (x *CDCEvents) ProtoReflect() protoreflect.Message { func (x *CDCEvents) ProtoReflect() protoreflect.Message {
mi := &file_command_proto_msgTypes[21] mi := &file_command_proto_msgTypes[24]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -1798,7 +1984,7 @@ func (x *CDCEvents) ProtoReflect() protoreflect.Message {
// Deprecated: Use CDCEvents.ProtoReflect.Descriptor instead. // Deprecated: Use CDCEvents.ProtoReflect.Descriptor instead.
func (*CDCEvents) Descriptor() ([]byte, []int) { func (*CDCEvents) Descriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{21} return file_command_proto_rawDescGZIP(), []int{24}
} }
func (x *CDCEvents) GetK() uint64 { func (x *CDCEvents) GetK() uint64 {
@@ -1827,7 +2013,7 @@ type UpdateHookEvent struct {
func (x *UpdateHookEvent) Reset() { func (x *UpdateHookEvent) Reset() {
*x = UpdateHookEvent{} *x = UpdateHookEvent{}
mi := &file_command_proto_msgTypes[22] mi := &file_command_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -1839,7 +2025,7 @@ func (x *UpdateHookEvent) String() string {
func (*UpdateHookEvent) ProtoMessage() {} func (*UpdateHookEvent) ProtoMessage() {}
func (x *UpdateHookEvent) ProtoReflect() protoreflect.Message { func (x *UpdateHookEvent) ProtoReflect() protoreflect.Message {
mi := &file_command_proto_msgTypes[22] mi := &file_command_proto_msgTypes[25]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -1852,7 +2038,7 @@ func (x *UpdateHookEvent) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateHookEvent.ProtoReflect.Descriptor instead. // Deprecated: Use UpdateHookEvent.ProtoReflect.Descriptor instead.
func (*UpdateHookEvent) Descriptor() ([]byte, []int) { func (*UpdateHookEvent) Descriptor() ([]byte, []int) {
return file_command_proto_rawDescGZIP(), []int{22} return file_command_proto_rawDescGZIP(), []int{25}
} }
func (x *UpdateHookEvent) GetError() string { func (x *UpdateHookEvent) GetError() string {
@@ -1977,16 +2163,28 @@ const file_command_proto_rawDesc = "" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x18\n" + "\x02id\x18\x01 \x01(\tR\x02id\x12\x18\n" +
"\aaddress\x18\x02 \x01(\tR\aaddress\"#\n" + "\aaddress\x18\x02 \x01(\tR\aaddress\"#\n" +
"\x11RemoveNodeRequest\x12\x0e\n" + "\x11RemoveNodeRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\"\x16\n" + "\x02id\x18\x01 \x01(\tR\x02id\"\x99\x01\n" +
"\x15CompareAndSwapRequest\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value\x12\x1c\n" +
"\tprevExist\x18\x03 \x01(\bR\tprevExist\x12\x1c\n" +
"\tprevValue\x18\x04 \x01(\tR\tprevValue\x12\x1c\n" +
"\tprevIndex\x18\x05 \x01(\x04R\tprevIndex\"\x18\n" +
"\x16CompareAndSwapResponse\"\x85\x01\n" +
"\x17CompareAndDeleteRequest\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x1c\n" +
"\tprevExist\x18\x02 \x01(\bR\tprevExist\x12\x1c\n" +
"\tprevValue\x18\x03 \x01(\tR\tprevValue\x12\x1c\n" +
"\tprevIndex\x18\x04 \x01(\x04R\tprevIndex\"\x16\n" +
"\x04Noop\x12\x0e\n" + "\x04Noop\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\"\xcc\x02\n" + "\x02id\x18\x01 \x01(\tR\x02id\"\x94\x03\n" +
"\aCommand\x12)\n" + "\aCommand\x12)\n" +
"\x04type\x18\x01 \x01(\x0e2\x15.command.Command.TypeR\x04type\x12\x1f\n" + "\x04type\x18\x01 \x01(\x0e2\x15.command.Command.TypeR\x04type\x12\x1f\n" +
"\vsub_command\x18\x02 \x01(\fR\n" + "\vsub_command\x18\x02 \x01(\fR\n" +
"subCommand\x12\x1e\n" + "subCommand\x12\x1e\n" +
"\n" + "\n" +
"compressed\x18\x03 \x01(\bR\n" + "compressed\x18\x03 \x01(\bR\n" +
"compressed\"\xd4\x01\n" + "compressed\"\x9c\x02\n" +
"\x04Type\x12\x18\n" + "\x04Type\x12\x18\n" +
"\x14COMMAND_TYPE_UNKNOWN\x10\x00\x12\x16\n" + "\x14COMMAND_TYPE_UNKNOWN\x10\x00\x12\x16\n" +
"\x12COMMAND_TYPE_QUERY\x10\x01\x12\x18\n" + "\x12COMMAND_TYPE_QUERY\x10\x01\x12\x18\n" +
@@ -1995,7 +2193,9 @@ const file_command_proto_rawDesc = "" +
"\x11COMMAND_TYPE_LOAD\x10\x04\x12\x15\n" + "\x11COMMAND_TYPE_LOAD\x10\x04\x12\x15\n" +
"\x11COMMAND_TYPE_JOIN\x10\x05\x12\x1e\n" + "\x11COMMAND_TYPE_JOIN\x10\x05\x12\x1e\n" +
"\x1aCOMMAND_TYPE_EXECUTE_QUERY\x10\x06\x12\x1b\n" + "\x1aCOMMAND_TYPE_EXECUTE_QUERY\x10\x06\x12\x1b\n" +
"\x17COMMAND_TYPE_LOAD_CHUNK\x10\a\"c\n" + "\x17COMMAND_TYPE_LOAD_CHUNK\x10\a\x12!\n" +
"\x1dCOMMAND_TYPE_COMPARE_AND_SWAP\x10\b\x12#\n" +
"\x1fCOMMAND_TYPE_COMPARE_AND_DELETE\x10\t\"c\n" +
"\bCDCValue\x12\x0e\n" + "\bCDCValue\x12\x0e\n" +
"\x01i\x18\x01 \x01(\x12H\x00R\x01i\x12\x0e\n" + "\x01i\x18\x01 \x01(\x12H\x00R\x01i\x12\x0e\n" +
"\x01d\x18\x02 \x01(\x01H\x00R\x01d\x12\x0e\n" + "\x01d\x18\x02 \x01(\x01H\x00R\x01d\x12\x0e\n" +
@@ -2053,36 +2253,39 @@ func file_command_proto_rawDescGZIP() []byte {
} }
var file_command_proto_enumTypes = make([]protoimpl.EnumInfo, 5) var file_command_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
var file_command_proto_msgTypes = make([]protoimpl.MessageInfo, 23) var file_command_proto_msgTypes = make([]protoimpl.MessageInfo, 26)
var file_command_proto_goTypes = []any{ var file_command_proto_goTypes = []any{
(QueryRequest_Level)(0), // 0: command.QueryRequest.Level (QueryRequest_Level)(0), // 0: command.QueryRequest.Level
(BackupRequest_Format)(0), // 1: command.BackupRequest.Format (BackupRequest_Format)(0), // 1: command.BackupRequest.Format
(Command_Type)(0), // 2: command.Command.Type (Command_Type)(0), // 2: command.Command.Type
(CDCEvent_Operation)(0), // 3: command.CDCEvent.Operation (CDCEvent_Operation)(0), // 3: command.CDCEvent.Operation
(UpdateHookEvent_Operation)(0), // 4: command.UpdateHookEvent.Operation (UpdateHookEvent_Operation)(0), // 4: command.UpdateHookEvent.Operation
(*Parameter)(nil), // 5: command.Parameter (*Parameter)(nil), // 5: command.Parameter
(*Statement)(nil), // 6: command.Statement (*Statement)(nil), // 6: command.Statement
(*Request)(nil), // 7: command.Request (*Request)(nil), // 7: command.Request
(*QueryRequest)(nil), // 8: command.QueryRequest (*QueryRequest)(nil), // 8: command.QueryRequest
(*Values)(nil), // 9: command.Values (*Values)(nil), // 9: command.Values
(*QueryRows)(nil), // 10: command.QueryRows (*QueryRows)(nil), // 10: command.QueryRows
(*ExecuteRequest)(nil), // 11: command.ExecuteRequest (*ExecuteRequest)(nil), // 11: command.ExecuteRequest
(*ExecuteResult)(nil), // 12: command.ExecuteResult (*ExecuteResult)(nil), // 12: command.ExecuteResult
(*ExecuteQueryRequest)(nil), // 13: command.ExecuteQueryRequest (*ExecuteQueryRequest)(nil), // 13: command.ExecuteQueryRequest
(*ExecuteQueryResponse)(nil), // 14: command.ExecuteQueryResponse (*ExecuteQueryResponse)(nil), // 14: command.ExecuteQueryResponse
(*BackupRequest)(nil), // 15: command.BackupRequest (*BackupRequest)(nil), // 15: command.BackupRequest
(*LoadRequest)(nil), // 16: command.LoadRequest (*LoadRequest)(nil), // 16: command.LoadRequest
(*LoadChunkRequest)(nil), // 17: command.LoadChunkRequest (*LoadChunkRequest)(nil), // 17: command.LoadChunkRequest
(*JoinRequest)(nil), // 18: command.JoinRequest (*JoinRequest)(nil), // 18: command.JoinRequest
(*NotifyRequest)(nil), // 19: command.NotifyRequest (*NotifyRequest)(nil), // 19: command.NotifyRequest
(*RemoveNodeRequest)(nil), // 20: command.RemoveNodeRequest (*RemoveNodeRequest)(nil), // 20: command.RemoveNodeRequest
(*Noop)(nil), // 21: command.Noop (*CompareAndSwapRequest)(nil), // 21: command.CompareAndSwapRequest
(*Command)(nil), // 22: command.Command (*CompareAndSwapResponse)(nil), // 22: command.CompareAndSwapResponse
(*CDCValue)(nil), // 23: command.CDCValue (*CompareAndDeleteRequest)(nil), // 23: command.CompareAndDeleteRequest
(*CDCRow)(nil), // 24: command.CDCRow (*Noop)(nil), // 24: command.Noop
(*CDCEvent)(nil), // 25: command.CDCEvent (*Command)(nil), // 25: command.Command
(*CDCEvents)(nil), // 26: command.CDCEvents (*CDCValue)(nil), // 26: command.CDCValue
(*UpdateHookEvent)(nil), // 27: command.UpdateHookEvent (*CDCRow)(nil), // 27: command.CDCRow
(*CDCEvent)(nil), // 28: command.CDCEvent
(*CDCEvents)(nil), // 29: command.CDCEvents
(*UpdateHookEvent)(nil), // 30: command.UpdateHookEvent
} }
var file_command_proto_depIdxs = []int32{ var file_command_proto_depIdxs = []int32{
5, // 0: command.Statement.parameters:type_name -> command.Parameter 5, // 0: command.Statement.parameters:type_name -> command.Parameter
@@ -2098,11 +2301,11 @@ var file_command_proto_depIdxs = []int32{
12, // 10: command.ExecuteQueryResponse.e:type_name -> command.ExecuteResult 12, // 10: command.ExecuteQueryResponse.e:type_name -> command.ExecuteResult
1, // 11: command.BackupRequest.format:type_name -> command.BackupRequest.Format 1, // 11: command.BackupRequest.format:type_name -> command.BackupRequest.Format
2, // 12: command.Command.type:type_name -> command.Command.Type 2, // 12: command.Command.type:type_name -> command.Command.Type
23, // 13: command.CDCRow.values:type_name -> command.CDCValue 26, // 13: command.CDCRow.values:type_name -> command.CDCValue
3, // 14: command.CDCEvent.op:type_name -> command.CDCEvent.Operation 3, // 14: command.CDCEvent.op:type_name -> command.CDCEvent.Operation
24, // 15: command.CDCEvent.old_row:type_name -> command.CDCRow 27, // 15: command.CDCEvent.old_row:type_name -> command.CDCRow
24, // 16: command.CDCEvent.new_row:type_name -> command.CDCRow 27, // 16: command.CDCEvent.new_row:type_name -> command.CDCRow
25, // 17: command.CDCEvents.events:type_name -> command.CDCEvent 28, // 17: command.CDCEvents.events:type_name -> command.CDCEvent
4, // 18: command.UpdateHookEvent.op:type_name -> command.UpdateHookEvent.Operation 4, // 18: command.UpdateHookEvent.op:type_name -> command.UpdateHookEvent.Operation
19, // [19:19] is the sub-list for method output_type 19, // [19:19] is the sub-list for method output_type
19, // [19:19] is the sub-list for method input_type 19, // [19:19] is the sub-list for method input_type
@@ -2128,7 +2331,7 @@ func file_command_proto_init() {
(*ExecuteQueryResponse_E)(nil), (*ExecuteQueryResponse_E)(nil),
(*ExecuteQueryResponse_Error)(nil), (*ExecuteQueryResponse_Error)(nil),
} }
file_command_proto_msgTypes[18].OneofWrappers = []any{ file_command_proto_msgTypes[21].OneofWrappers = []any{
(*CDCValue_I)(nil), (*CDCValue_I)(nil),
(*CDCValue_D)(nil), (*CDCValue_D)(nil),
(*CDCValue_B)(nil), (*CDCValue_B)(nil),
@@ -2141,7 +2344,7 @@ func file_command_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_command_proto_rawDesc), len(file_command_proto_rawDesc)), RawDescriptor: unsafe.Slice(unsafe.StringData(file_command_proto_rawDesc), len(file_command_proto_rawDesc)),
NumEnums: 5, NumEnums: 5,
NumMessages: 23, NumMessages: 26,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@@ -122,6 +122,24 @@ message RemoveNodeRequest {
string id = 1; string id = 1;
} }
message CompareAndSwapRequest {
string key = 1;
string value = 2;
bool prevExist = 3;
string prevValue = 4;
uint64 prevIndex = 5;
}
message CompareAndSwapResponse {
}
message CompareAndDeleteRequest {
string key = 1;
bool prevExist = 2;
string prevValue = 3;
uint64 prevIndex = 4;
}
message Noop { message Noop {
string id = 1; string id = 1;
} }
@@ -136,6 +154,8 @@ message Command {
COMMAND_TYPE_JOIN = 5; COMMAND_TYPE_JOIN = 5;
COMMAND_TYPE_EXECUTE_QUERY = 6; COMMAND_TYPE_EXECUTE_QUERY = 6;
COMMAND_TYPE_LOAD_CHUNK = 7; COMMAND_TYPE_LOAD_CHUNK = 7;
COMMAND_TYPE_COMPARE_AND_SWAP = 8;
COMMAND_TYPE_COMPARE_AND_DELETE = 9;
} }
Type type = 1; Type type = 1;
bytes sub_command = 2; bytes sub_command = 2;

View File

@@ -1829,6 +1829,13 @@ func (s *Store) Remove(rn *proto.RemoveNodeRequest) error {
return nil return nil
} }
func (s *Store) CompareAndSwap(req *proto.CompareAndSwapRequest) (*proto.CompareAndSwapResponse, uint64, error) {
if !s.open.Is() {
return nil, 0, ErrNotOpen
}
return nil, 0, nil
}
// Noop writes a noop command to the Raft log. A noop command simply // Noop writes a noop command to the Raft log. A noop command simply
// consumes a slot in the Raft log, but has no other effect on the // consumes a slot in the Raft log, but has no other effect on the
// system. // system.