diff --git a/api/protoqueryservice/query.pb.go b/api/protoqueryservice/query.pb.go index 0cb63298..ec74cc3c 100644 --- a/api/protoqueryservice/query.pb.go +++ b/api/protoqueryservice/query.pb.go @@ -13,6 +13,7 @@ package protoqueryservice import ( protoblocktx "github.com/hyperledger/fabric-x-committer/api/protoblocktx" + protonotify "github.com/hyperledger/fabric-x-committer/api/protonotify" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" @@ -464,6 +465,108 @@ func (x *Row) GetVersion() uint64 { return 0 } +type TxStatusQuery struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + View *View `protobuf:"bytes,1,opt,name=view,proto3,oneof" json:"view,omitempty"` + TxIds []string `protobuf:"bytes,2,rep,name=tx_ids,json=txIds,proto3" json:"tx_ids,omitempty"` // List of transaction IDs. +} + +func (x *TxStatusQuery) Reset() { + *x = TxStatusQuery{} + if protoimpl.UnsafeEnabled { + mi := &file_api_protoqueryservice_query_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TxStatusQuery) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TxStatusQuery) ProtoMessage() {} + +func (x *TxStatusQuery) ProtoReflect() protoreflect.Message { + mi := &file_api_protoqueryservice_query_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TxStatusQuery.ProtoReflect.Descriptor instead. +func (*TxStatusQuery) Descriptor() ([]byte, []int) { + return file_api_protoqueryservice_query_proto_rawDescGZIP(), []int{7} +} + +func (x *TxStatusQuery) GetView() *View { + if x != nil { + return x.View + } + return nil +} + +func (x *TxStatusQuery) GetTxIds() []string { + if x != nil { + return x.TxIds + } + return nil +} + +type TxStatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Statuses []*protonotify.TxStatusEvent `protobuf:"bytes,1,rep,name=statuses,proto3" json:"statuses,omitempty"` +} + +func (x *TxStatusResponse) Reset() { + *x = TxStatusResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_protoqueryservice_query_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TxStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TxStatusResponse) ProtoMessage() {} + +func (x *TxStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_protoqueryservice_query_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TxStatusResponse.ProtoReflect.Descriptor instead. +func (*TxStatusResponse) Descriptor() ([]byte, []int) { + return file_api_protoqueryservice_query_proto_rawDescGZIP(), []int{8} +} + +func (x *TxStatusResponse) GetStatuses() []*protonotify.TxStatusEvent { + if x != nil { + return x.Statuses + } + return nil +} + var File_api_protoqueryservice_query_proto protoreflect.FileDescriptor var file_api_protoqueryservice_query_proto_rawDesc = []byte{ @@ -472,81 +575,100 @@ var file_api_protoqueryservice_query_proto_rawDesc = []byte{ 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x74, 0x78, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x74, - 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x16, 0x0a, 0x04, 0x56, 0x69, 0x65, 0x77, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x85, 0x01, 0x0a, - 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x76, 0x69, 0x65, 0x77, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x48, 0x00, 0x52, - 0x04, 0x76, 0x69, 0x65, 0x77, 0x88, 0x01, 0x01, 0x12, 0x41, 0x0a, 0x0a, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, - 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x76, 0x69, 0x65, 0x77, 0x22, 0x48, 0x0a, 0x04, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x40, 0x0a, 0x0a, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x6f, 0x77, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x22, 0xa3, - 0x01, 0x0a, 0x0e, 0x56, 0x69, 0x65, 0x77, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x73, 0x12, 0x38, 0x0a, 0x09, 0x69, 0x73, 0x6f, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x49, 0x73, 0x6f, 0x4c, 0x65, 0x76, 0x65, - 0x6c, 0x52, 0x08, 0x69, 0x73, 0x6f, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x24, 0x0a, 0x0d, 0x6e, - 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x65, 0x72, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0d, 0x6e, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x65, 0x72, 0x72, 0x61, 0x62, 0x6c, - 0x65, 0x12, 0x31, 0x0a, 0x14, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x69, 0x6c, - 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x13, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, - 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x39, 0x0a, 0x0e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x13, 0x0a, 0x05, 0x6e, 0x73, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x73, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6b, - 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, - 0x50, 0x0a, 0x0d, 0x52, 0x6f, 0x77, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x12, 0x13, 0x0a, 0x05, 0x6e, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x73, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x6f, 0x77, 0x52, 0x04, 0x72, 0x6f, 0x77, - 0x73, 0x22, 0x47, 0x0a, 0x03, 0x52, 0x6f, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2a, 0x58, 0x0a, 0x08, 0x49, 0x73, - 0x6f, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, - 0x69, 0x7a, 0x61, 0x62, 0x6c, 0x65, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x52, 0x65, 0x70, 0x65, - 0x61, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x61, 0x64, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, - 0x52, 0x65, 0x61, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x10, 0x02, 0x12, - 0x13, 0x0a, 0x0f, 0x52, 0x65, 0x61, 0x64, 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, - 0x65, 0x64, 0x10, 0x03, 0x32, 0xfe, 0x02, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x77, 0x73, - 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, - 0x6f, 0x77, 0x73, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x09, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x56, 0x69, - 0x65, 0x77, 0x12, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, - 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x22, 0x00, - 0x12, 0x3d, 0x0a, 0x07, 0x45, 0x6e, 0x64, 0x56, 0x69, 0x65, 0x77, 0x12, 0x17, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x56, 0x69, 0x65, 0x77, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x22, 0x00, 0x12, - 0x51, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x16, 0x0a, 0x04, 0x56, 0x69, 0x65, 0x77, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x85, 0x01, 0x0a, 0x05, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x76, 0x69, 0x65, 0x77, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x48, 0x00, 0x52, 0x04, 0x76, + 0x69, 0x65, 0x77, 0x88, 0x01, 0x01, 0x12, 0x41, 0x0a, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x0a, 0x6e, + 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x76, 0x69, + 0x65, 0x77, 0x22, 0x48, 0x0a, 0x04, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x40, 0x0a, 0x0a, 0x6e, 0x61, + 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x52, 0x6f, 0x77, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x22, 0xa3, 0x01, 0x0a, + 0x0e, 0x56, 0x69, 0x65, 0x77, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, + 0x38, 0x0a, 0x09, 0x69, 0x73, 0x6f, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x49, 0x73, 0x6f, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, + 0x08, 0x69, 0x73, 0x6f, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x6f, 0x6e, + 0x44, 0x65, 0x66, 0x65, 0x72, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0d, 0x6e, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x65, 0x72, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x12, + 0x31, 0x0a, 0x14, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x69, 0x6c, 0x6c, 0x69, + 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x13, 0x74, + 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e, + 0x64, 0x73, 0x22, 0x39, 0x0a, 0x0e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x12, 0x13, 0x0a, 0x05, 0x6e, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x73, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x50, 0x0a, + 0x0d, 0x52, 0x6f, 0x77, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x13, + 0x0a, 0x05, 0x6e, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x73, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x6f, 0x77, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x22, + 0x47, 0x0a, 0x03, 0x52, 0x6f, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x61, 0x0a, 0x0d, 0x54, 0x78, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x76, 0x69, 0x65, + 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, + 0x48, 0x00, 0x52, 0x04, 0x76, 0x69, 0x65, 0x77, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x06, 0x74, + 0x78, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x74, 0x78, 0x49, + 0x64, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x22, 0x4a, 0x0a, 0x10, 0x54, + 0x78, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x36, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e, + 0x54, 0x78, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x2a, 0x58, 0x0a, 0x08, 0x49, 0x73, 0x6f, 0x4c, 0x65, + 0x76, 0x65, 0x6c, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x61, + 0x62, 0x6c, 0x65, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x61, + 0x62, 0x6c, 0x65, 0x52, 0x65, 0x61, 0x64, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x65, 0x61, + 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, + 0x52, 0x65, 0x61, 0x64, 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x10, + 0x03, 0x32, 0xdf, 0x03, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x18, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x6f, 0x77, 0x73, + 0x22, 0x00, 0x12, 0x49, 0x0a, 0x09, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x56, 0x69, 0x65, 0x77, 0x12, + 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x73, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x22, 0x00, 0x12, 0x3d, 0x0a, + 0x07, 0x45, 0x6e, 0x64, 0x56, 0x69, 0x65, 0x77, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x56, 0x69, 0x65, + 0x77, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x14, + 0x47, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x69, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x74, 0x78, 0x2e, 0x4e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0x00, 0x12, + 0x51, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, - 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x74, 0x78, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, - 0x22, 0x00, 0x12, 0x51, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x54, - 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x74, - 0x78, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, - 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x78, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, - 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x74, 0x78, 0x2e, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x22, 0x00, 0x12, 0x5f, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, + 0x78, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x51, 0x75, 0x65, 0x72, 0x79, 0x1a, 0x23, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x54, 0x78, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, + 0x62, 0x72, 0x69, 0x63, 0x2d, 0x78, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x72, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -562,7 +684,7 @@ func file_api_protoqueryservice_query_proto_rawDescGZIP() []byte { } var file_api_protoqueryservice_query_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_api_protoqueryservice_query_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_api_protoqueryservice_query_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_api_protoqueryservice_query_proto_goTypes = []interface{}{ (IsoLevel)(0), // 0: protoqueryservice.IsoLevel (*View)(nil), // 1: protoqueryservice.View @@ -572,9 +694,12 @@ var file_api_protoqueryservice_query_proto_goTypes = []interface{}{ (*QueryNamespace)(nil), // 5: protoqueryservice.QueryNamespace (*RowsNamespace)(nil), // 6: protoqueryservice.RowsNamespace (*Row)(nil), // 7: protoqueryservice.Row - (*emptypb.Empty)(nil), // 8: google.protobuf.Empty - (*protoblocktx.NamespacePolicies)(nil), // 9: protoblocktx.NamespacePolicies - (*protoblocktx.ConfigTransaction)(nil), // 10: protoblocktx.ConfigTransaction + (*TxStatusQuery)(nil), // 8: protoqueryservice.TxStatusQuery + (*TxStatusResponse)(nil), // 9: protoqueryservice.TxStatusResponse + (*protonotify.TxStatusEvent)(nil), // 10: protonotify.TxStatusEvent + (*emptypb.Empty)(nil), // 11: google.protobuf.Empty + (*protoblocktx.NamespacePolicies)(nil), // 12: protoblocktx.NamespacePolicies + (*protoblocktx.ConfigTransaction)(nil), // 13: protoblocktx.ConfigTransaction } var file_api_protoqueryservice_query_proto_depIdxs = []int32{ 1, // 0: protoqueryservice.Query.view:type_name -> protoqueryservice.View @@ -582,21 +707,25 @@ var file_api_protoqueryservice_query_proto_depIdxs = []int32{ 6, // 2: protoqueryservice.Rows.namespaces:type_name -> protoqueryservice.RowsNamespace 0, // 3: protoqueryservice.ViewParameters.iso_level:type_name -> protoqueryservice.IsoLevel 7, // 4: protoqueryservice.RowsNamespace.rows:type_name -> protoqueryservice.Row - 2, // 5: protoqueryservice.QueryService.GetRows:input_type -> protoqueryservice.Query - 4, // 6: protoqueryservice.QueryService.BeginView:input_type -> protoqueryservice.ViewParameters - 1, // 7: protoqueryservice.QueryService.EndView:input_type -> protoqueryservice.View - 8, // 8: protoqueryservice.QueryService.GetNamespacePolicies:input_type -> google.protobuf.Empty - 8, // 9: protoqueryservice.QueryService.GetConfigTransaction:input_type -> google.protobuf.Empty - 3, // 10: protoqueryservice.QueryService.GetRows:output_type -> protoqueryservice.Rows - 1, // 11: protoqueryservice.QueryService.BeginView:output_type -> protoqueryservice.View - 1, // 12: protoqueryservice.QueryService.EndView:output_type -> protoqueryservice.View - 9, // 13: protoqueryservice.QueryService.GetNamespacePolicies:output_type -> protoblocktx.NamespacePolicies - 10, // 14: protoqueryservice.QueryService.GetConfigTransaction:output_type -> protoblocktx.ConfigTransaction - 10, // [10:15] is the sub-list for method output_type - 5, // [5:10] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 1, // 5: protoqueryservice.TxStatusQuery.view:type_name -> protoqueryservice.View + 10, // 6: protoqueryservice.TxStatusResponse.statuses:type_name -> protonotify.TxStatusEvent + 2, // 7: protoqueryservice.QueryService.GetRows:input_type -> protoqueryservice.Query + 4, // 8: protoqueryservice.QueryService.BeginView:input_type -> protoqueryservice.ViewParameters + 1, // 9: protoqueryservice.QueryService.EndView:input_type -> protoqueryservice.View + 11, // 10: protoqueryservice.QueryService.GetNamespacePolicies:input_type -> google.protobuf.Empty + 11, // 11: protoqueryservice.QueryService.GetConfigTransaction:input_type -> google.protobuf.Empty + 8, // 12: protoqueryservice.QueryService.GetTransactionStatus:input_type -> protoqueryservice.TxStatusQuery + 3, // 13: protoqueryservice.QueryService.GetRows:output_type -> protoqueryservice.Rows + 1, // 14: protoqueryservice.QueryService.BeginView:output_type -> protoqueryservice.View + 1, // 15: protoqueryservice.QueryService.EndView:output_type -> protoqueryservice.View + 12, // 16: protoqueryservice.QueryService.GetNamespacePolicies:output_type -> protoblocktx.NamespacePolicies + 13, // 17: protoqueryservice.QueryService.GetConfigTransaction:output_type -> protoblocktx.ConfigTransaction + 9, // 18: protoqueryservice.QueryService.GetTransactionStatus:output_type -> protoqueryservice.TxStatusResponse + 13, // [13:19] is the sub-list for method output_type + 7, // [7:13] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_api_protoqueryservice_query_proto_init() } @@ -689,15 +818,40 @@ func file_api_protoqueryservice_query_proto_init() { return nil } } + file_api_protoqueryservice_query_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TxStatusQuery); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_protoqueryservice_query_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TxStatusResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_api_protoqueryservice_query_proto_msgTypes[1].OneofWrappers = []interface{}{} + file_api_protoqueryservice_query_proto_msgTypes[7].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_api_protoqueryservice_query_proto_rawDesc, NumEnums: 1, - NumMessages: 7, + NumMessages: 9, NumExtensions: 0, NumServices: 1, }, diff --git a/api/protoqueryservice/query.proto b/api/protoqueryservice/query.proto index 4aaf1c04..3189e2ce 100644 --- a/api/protoqueryservice/query.proto +++ b/api/protoqueryservice/query.proto @@ -11,6 +11,7 @@ option go_package = "github.com/hyperledger/fabric-x-committer/api/protoqueryser package protoqueryservice; import "api/protoblocktx/block_tx.proto"; +import "api/protonotify/notify.proto"; import "google/protobuf/empty.proto"; service QueryService { @@ -19,6 +20,7 @@ service QueryService { rpc EndView(View) returns (View) {}; rpc GetNamespacePolicies(google.protobuf.Empty) returns (protoblocktx.NamespacePolicies) {}; rpc GetConfigTransaction(google.protobuf.Empty) returns (protoblocktx.ConfigTransaction) {}; + rpc GetTransactionStatus(TxStatusQuery) returns (TxStatusResponse) {}; } message View { @@ -62,3 +64,12 @@ message Row { bytes value = 2; uint64 version = 3; } + +message TxStatusQuery { + optional View view = 1; + repeated string tx_ids = 2; // List of transaction IDs. +} + +message TxStatusResponse { + repeated protonotify.TxStatusEvent statuses = 1; +} diff --git a/api/protoqueryservice/query_grpc.pb.go b/api/protoqueryservice/query_grpc.pb.go index 244a9f2e..e5ec1166 100644 --- a/api/protoqueryservice/query_grpc.pb.go +++ b/api/protoqueryservice/query_grpc.pb.go @@ -31,6 +31,7 @@ const ( QueryService_EndView_FullMethodName = "/protoqueryservice.QueryService/EndView" QueryService_GetNamespacePolicies_FullMethodName = "/protoqueryservice.QueryService/GetNamespacePolicies" QueryService_GetConfigTransaction_FullMethodName = "/protoqueryservice.QueryService/GetConfigTransaction" + QueryService_GetTransactionStatus_FullMethodName = "/protoqueryservice.QueryService/GetTransactionStatus" ) // QueryServiceClient is the client API for QueryService service. @@ -42,6 +43,7 @@ type QueryServiceClient interface { EndView(ctx context.Context, in *View, opts ...grpc.CallOption) (*View, error) GetNamespacePolicies(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*protoblocktx.NamespacePolicies, error) GetConfigTransaction(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*protoblocktx.ConfigTransaction, error) + GetTransactionStatus(ctx context.Context, in *TxStatusQuery, opts ...grpc.CallOption) (*TxStatusResponse, error) } type queryServiceClient struct { @@ -97,6 +99,15 @@ func (c *queryServiceClient) GetConfigTransaction(ctx context.Context, in *empty return out, nil } +func (c *queryServiceClient) GetTransactionStatus(ctx context.Context, in *TxStatusQuery, opts ...grpc.CallOption) (*TxStatusResponse, error) { + out := new(TxStatusResponse) + err := c.cc.Invoke(ctx, QueryService_GetTransactionStatus_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServiceServer is the server API for QueryService service. // All implementations must embed UnimplementedQueryServiceServer // for forward compatibility @@ -106,6 +117,7 @@ type QueryServiceServer interface { EndView(context.Context, *View) (*View, error) GetNamespacePolicies(context.Context, *emptypb.Empty) (*protoblocktx.NamespacePolicies, error) GetConfigTransaction(context.Context, *emptypb.Empty) (*protoblocktx.ConfigTransaction, error) + GetTransactionStatus(context.Context, *TxStatusQuery) (*TxStatusResponse, error) mustEmbedUnimplementedQueryServiceServer() } @@ -128,6 +140,9 @@ func (UnimplementedQueryServiceServer) GetNamespacePolicies(context.Context, *em func (UnimplementedQueryServiceServer) GetConfigTransaction(context.Context, *emptypb.Empty) (*protoblocktx.ConfigTransaction, error) { return nil, status.Errorf(codes.Unimplemented, "method GetConfigTransaction not implemented") } +func (UnimplementedQueryServiceServer) GetTransactionStatus(context.Context, *TxStatusQuery) (*TxStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTransactionStatus not implemented") +} func (UnimplementedQueryServiceServer) mustEmbedUnimplementedQueryServiceServer() {} // UnsafeQueryServiceServer may be embedded to opt out of forward compatibility for this service. @@ -231,6 +246,24 @@ func _QueryService_GetConfigTransaction_Handler(srv interface{}, ctx context.Con return interceptor(ctx, in, info, handler) } +func _QueryService_GetTransactionStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxStatusQuery) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServiceServer).GetTransactionStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: QueryService_GetTransactionStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServiceServer).GetTransactionStatus(ctx, req.(*TxStatusQuery)) + } + return interceptor(ctx, in, info, handler) +} + // QueryService_ServiceDesc is the grpc.ServiceDesc for QueryService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -258,6 +291,10 @@ var QueryService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetConfigTransaction", Handler: _QueryService_GetConfigTransaction_Handler, }, + { + MethodName: "GetTransactionStatus", + Handler: _QueryService_GetTransactionStatus_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/protoqueryservice/query.proto", diff --git a/integration/test/query_service_test.go b/integration/test/query_service_test.go index c23b068d..3afe7333 100644 --- a/integration/test/query_service_test.go +++ b/integration/test/query_service_test.go @@ -15,8 +15,10 @@ import ( "github.com/stretchr/testify/require" "github.com/hyperledger/fabric-x-committer/api/protoblocktx" + "github.com/hyperledger/fabric-x-committer/api/protonotify" "github.com/hyperledger/fabric-x-committer/api/protoqueryservice" "github.com/hyperledger/fabric-x-committer/integration/runner" + "github.com/hyperledger/fabric-x-committer/utils/test" ) func TestQueryService(t *testing.T) { @@ -33,8 +35,9 @@ func TestQueryService(t *testing.T) { ctx, cancel := context.WithTimeout(t.Context(), time.Minute*5) t.Cleanup(cancel) - c.MakeAndSendTransactionsToOrderer(t, [][]*protoblocktx.TxNamespace{{ - { + t.Log("Insert TXs") + txIDs := c.MakeAndSendTransactionsToOrderer(t, [][]*protoblocktx.TxNamespace{ + {{ NsId: "1", NsVersion: 0, BlindWrites: []*protoblocktx.Write{ @@ -47,8 +50,8 @@ func TestQueryService(t *testing.T) { Value: []byte("v2"), }, }, - }, - { + }}, + {{ NsId: "2", NsVersion: 0, BlindWrites: []*protoblocktx.Write{ @@ -61,72 +64,97 @@ func TestQueryService(t *testing.T) { Value: []byte("v4"), }, }, + }}, + }, []protoblocktx.Status{protoblocktx.Status_COMMITTED, protoblocktx.Status_COMMITTED}) + require.Len(t, txIDs, 2) + + t.Log("Query TXs status") + status, err := c.QueryServiceClient.GetTransactionStatus(ctx, &protoqueryservice.TxStatusQuery{ + TxIds: txIDs, + }) + require.NoError(t, err) + require.Len(t, status.Statuses, len(txIDs)) + test.RequireProtoElementsMatch(t, []*protonotify.TxStatusEvent{ + { + TxId: txIDs[0], + StatusWithHeight: &protoblocktx.StatusWithHeight{ + Code: protoblocktx.Status_COMMITTED, + TxNumber: uint32(0), + BlockNumber: uint64(2), + }, }, - }}, []protoblocktx.Status{protoblocktx.Status_COMMITTED}) + { + TxId: txIDs[1], + StatusWithHeight: &protoblocktx.StatusWithHeight{ + Code: protoblocktx.Status_COMMITTED, + TxNumber: uint32(1), + BlockNumber: uint64(2), + }, + }, + }, status.Statuses) - t.Run("Query-GetRows-Both-Namespaces", func(t *testing.T) { - ret, err := c.QueryServiceClient.GetRows( - ctx, - &protoqueryservice.Query{ - Namespaces: []*protoqueryservice.QueryNamespace{ - { - NsId: "1", - Keys: [][]byte{ - []byte("k1"), []byte("k2"), - }, + t.Log("Query Rows") + ret, err := c.QueryServiceClient.GetRows( + ctx, + &protoqueryservice.Query{ + Namespaces: []*protoqueryservice.QueryNamespace{ + { + NsId: "1", + Keys: [][]byte{ + []byte("k1"), []byte("k2"), }, - { - NsId: "2", - Keys: [][]byte{ - []byte("k3"), []byte("k4"), - }, + }, + { + NsId: "2", + Keys: [][]byte{ + []byte("k3"), []byte("k4"), }, }, }, - ) - require.NoError(t, err) + }, + ) + require.NoError(t, err) - testItemsVersion := uint64(0) + testItemsVersion := uint64(0) - requiredItems := []*protoqueryservice.RowsNamespace{ - { - NsId: "1", - Rows: []*protoqueryservice.Row{ - { - Key: []byte("k1"), - Value: []byte("v1"), - Version: testItemsVersion, - }, - { - Key: []byte("k2"), - Value: []byte("v2"), - Version: testItemsVersion, - }, + requiredItems := []*protoqueryservice.RowsNamespace{ + { + NsId: "1", + Rows: []*protoqueryservice.Row{ + { + Key: []byte("k1"), + Value: []byte("v1"), + Version: testItemsVersion, + }, + { + Key: []byte("k2"), + Value: []byte("v2"), + Version: testItemsVersion, }, }, - { - NsId: "2", - Rows: []*protoqueryservice.Row{ - { - Key: []byte("k3"), - Value: []byte("v3"), - Version: testItemsVersion, - }, - { - Key: []byte("k4"), - Value: []byte("v4"), - Version: testItemsVersion, - }, + }, + { + NsId: "2", + Rows: []*protoqueryservice.Row{ + { + Key: []byte("k3"), + Value: []byte("v3"), + Version: testItemsVersion, + }, + { + Key: []byte("k4"), + Value: []byte("v4"), + Version: testItemsVersion, }, }, - } + }, + } - requireQueryResults( - t, - requiredItems, - ret.Namespaces, - ) - }) + requireQueryResults( + t, + requiredItems, + ret.Namespaces, + ) } // requireQueryResults requires that the items retrieved by the Query service diff --git a/service/query/batcher.go b/service/query/batcher.go index bd979576..6a2d5f92 100644 --- a/service/query/batcher.go +++ b/service/query/batcher.go @@ -15,6 +15,7 @@ import ( "github.com/yugabyte/pgx/v4" "github.com/yugabyte/pgx/v4/pgxpool" + "github.com/hyperledger/fabric-x-committer/api/protonotify" "github.com/hyperledger/fabric-x-committer/api/protoqueryservice" "github.com/hyperledger/fabric-x-committer/utils" "github.com/hyperledger/fabric-x-committer/utils/monitoring/promutil" @@ -26,6 +27,9 @@ const ( minIsoLevel = 0 // 0b000 maxIsoLevel = 3 // 0b011 deferredBit = 4 // 0b100 + + // txStatusNsID we use "$" to identify a tx status request as "$" is not a valid namespace character. + txStatusNsID = "$tx_status$" ) // viewsBatcher is designed to allow maximal concurrency between requests. @@ -98,8 +102,9 @@ type ( submitter sync.Once // finalized is true once the query is actively executed. - finalized bool - result map[string]*protoqueryservice.Row + finalized bool + result map[string]*protoqueryservice.Row + statusResult map[string]*protonotify.TxStatusEvent } ) @@ -387,12 +392,12 @@ func (q *namespaceQueryBatch) execute() { m.Inc() defer m.Dec() - q.result = make(map[string]*protoqueryservice.Row) + uniqueMap := make(map[string]*protoqueryservice.Row) var uniqueKeys [][]byte for _, key := range q.keys { strKey := string(key) - if _, ok := q.result[strKey]; !ok { - q.result[strKey] = nil + if _, ok := uniqueMap[strKey]; !ok { + uniqueMap[strKey] = nil uniqueKeys = append(uniqueKeys, key) } } @@ -401,17 +406,34 @@ func (q *namespaceQueryBatch) execute() { promutil.ObserveSize(q.metrics.batchQuerySize, len(uniqueKeys)) start := time.Now() - rows, err := unsafeQueryRows(q.ctx, queryObj, q.nsID, uniqueKeys) + var queryRows []*protoqueryservice.Row + var statusRows []*protonotify.TxStatusEvent + if q.nsID != txStatusNsID { + queryRows, err = unsafeQueryRows(q.ctx, queryObj, q.nsID, uniqueKeys) + } else { + statusRows, err = unsafeQueryTxStatus(q.ctx, queryObj, uniqueKeys) + } if err != nil { q.cancel(err) return } promutil.Observe(q.metrics.queryLatencySeconds, time.Since(start)) - promutil.ObserveSize(q.metrics.batchResponseSize, len(rows)) + promutil.ObserveSize(q.metrics.batchResponseSize, len(queryRows)+len(statusRows)) + + if queryRows != nil { + q.result = make(map[string]*protoqueryservice.Row) + for _, r := range queryRows { + q.result[string(r.Key)] = r + } + } - for _, r := range rows { - q.result[string(r.Key)] = r + if statusRows != nil { + q.statusResult = make(map[string]*protonotify.TxStatusEvent) + for _, r := range statusRows { + q.statusResult[r.TxId] = r + } } + q.cancel(nil) } @@ -420,30 +442,42 @@ func (q *namespaceQueryBatch) execute() { func (q *namespaceQueryBatch) waitForRows( ctx context.Context, keys [][]byte, -) ([]*protoqueryservice.Row, error) { +) (res []*protoqueryservice.Row, statusRes []*protonotify.TxStatusEvent, err error) { // Wait for batch to be finalized or context to be canceled. select { case <-ctx.Done(): - return nil, ctx.Err() + return nil, nil, ctx.Err() case <-q.ctx.Done(): // Query completed. } if errors.Is(q.ctx.Err(), context.DeadlineExceeded) { - return nil, ErrInvalidOrStaleView + return nil, nil, ErrInvalidOrStaleView } // context.Cause() returns context.Canceled when err=nil is reported. if err := context.Cause(q.ctx); !errors.Is(err, context.Canceled) { //nolint:contextcheck // false positive. - return nil, err + return nil, nil, err } // Extract results for requested keys. - res := make([]*protoqueryservice.Row, 0, len(keys)) - for _, key := range keys { - // Get result for this key from the batch results. - if row, ok := q.result[string(key)]; ok && row != nil { - res = append(res, row) + if q.result != nil { + res = make([]*protoqueryservice.Row, 0, len(keys)) + for _, key := range keys { + // Get result for this key from the batch results. + if row, ok := q.result[string(key)]; ok && row != nil { + res = append(res, row) + } } } - return res, nil + if q.statusResult != nil { + statusRes = make([]*protonotify.TxStatusEvent, 0, len(keys)) + for _, key := range keys { + // Get result for this key from the batch results. + if row, ok := q.statusResult[string(key)]; ok && row != nil { + statusRes = append(statusRes, row) + } + } + } + + return res, statusRes, nil } diff --git a/service/query/metrics.go b/service/query/metrics.go index 017c0c75..969411b4 100644 --- a/service/query/metrics.go +++ b/service/query/metrics.go @@ -16,6 +16,7 @@ const ( grpcBeginView = "begin_view" grpcEndView = "end_view" grpcGetRows = "get_rows" + grpcGetTxStatus = "get_tx_status" sessionViews = "active_views" sessionProcessingQueries = "processing_queries" sessionWaitingQueries = "waiting_queries" diff --git a/service/query/query.go b/service/query/query.go index ae3624ab..ba75d1b8 100644 --- a/service/query/query.go +++ b/service/query/query.go @@ -17,6 +17,7 @@ import ( "github.com/yugabyte/pgx/v4/pgxpool" "github.com/hyperledger/fabric-x-committer/api/protoblocktx" + "github.com/hyperledger/fabric-x-committer/api/protonotify" "github.com/hyperledger/fabric-x-committer/api/protoqueryservice" "github.com/hyperledger/fabric-x-committer/api/types" "github.com/hyperledger/fabric-x-committer/service/vc" @@ -26,8 +27,9 @@ import ( var queryRowSQLTemplate string var ( - queryPoliciesStmt = fmt.Sprintf("SELECT key, value, version from ns_%s;", types.MetaNamespaceID) - queryConfigStmt = fmt.Sprintf("SELECT key, value, version from ns_%s;", types.ConfigNamespaceID) + queryPoliciesStmt = fmt.Sprintf("SELECT key, value, version from ns_%s;", types.MetaNamespaceID) + queryConfigStmt = fmt.Sprintf("SELECT key, value, version from ns_%s;", types.ConfigNamespaceID) + queryTxIDsStatusStmt = "SELECT tx_id, status, height FROM tx_status WHERE tx_id = ANY($1);" ) // sharedPool and sharedLazyTx implements of sharedQuerier. @@ -105,6 +107,19 @@ func unsafeQueryRows( return readQueryRows(r, len(keys)) } +// unsafeQueryTxStatus queries rows from the tx_status table. +// It may not support concurrent execution, depending on the querier implementation. +func unsafeQueryTxStatus( + ctx context.Context, queryObj querier, txIDs [][]byte, +) ([]*protonotify.TxStatusEvent, error) { + r, err := queryObj.Query(ctx, queryTxIDsStatusStmt, txIDs) + if err != nil { + return nil, err + } + defer r.Close() + return readTxStatusRows(r, len(txIDs)) +} + func queryPolicies(ctx context.Context, queryObj querier) (*protoblocktx.NamespacePolicies, error) { r, err := queryObj.Query(ctx, queryPoliciesStmt) if err != nil { @@ -157,3 +172,31 @@ func readQueryRows(r pgx.Rows, expectedSize int) ([]*protoqueryservice.Row, erro } return rows, r.Err() } + +func readTxStatusRows(r pgx.Rows, expectedSize int) ([]*protonotify.TxStatusEvent, error) { + rows := make([]*protonotify.TxStatusEvent, 0, expectedSize) + for r.Next() { + var id []byte + var status int32 + var height []byte + + if err := r.Scan(&id, &status, &height); err != nil { + return nil, errors.Wrap(err, "failed to read rows from the query result") + } + + ht, _, err := types.NewHeightFromBytes(height) + if err != nil { + return nil, errors.Wrap(err, "failed to create height") + } + + rows = append(rows, &protonotify.TxStatusEvent{ + TxId: string(id), + StatusWithHeight: &protoblocktx.StatusWithHeight{ + Code: protoblocktx.Status(status), + BlockNumber: ht.BlockNum, + TxNumber: ht.TxNum, + }, + }) + } + return rows, r.Err() +} diff --git a/service/query/query_service.go b/service/query/query_service.go index c4ce049d..973b63c4 100644 --- a/service/query/query_service.go +++ b/service/query/query_service.go @@ -158,7 +158,7 @@ func (q *Service) GetRows( Namespaces: make([]*protoqueryservice.RowsNamespace, len(query.Namespaces)), } for i, ns := range query.Namespaces { - resRows, resErr := batches[i].waitForRows(ctx, ns.Keys) + resRows, _, resErr := batches[i].waitForRows(ctx, ns.Keys) if resErr != nil { return nil, resErr } @@ -171,6 +171,40 @@ func (q *Service) GetRows( return res, err } +// GetTransactionStatus implements the query-service interface. +func (q *Service) GetTransactionStatus( + ctx context.Context, query *protoqueryservice.TxStatusQuery, +) (*protoqueryservice.TxStatusResponse, error) { + q.metrics.requests.WithLabelValues(grpcGetTxStatus).Inc() + + defer q.requestLatency(grpcGetTxStatus, time.Now()) + + keys := make([][]byte, len(query.TxIds)) + for i, txID := range query.TxIds { + keys[i] = []byte(txID) + } + + batches, err := q.assignRequest(ctx, &protoqueryservice.Query{ + View: query.View, + Namespaces: []*protoqueryservice.QueryNamespace{{ + NsId: txStatusNsID, + Keys: keys, + }}, + }) + if err != nil { + return nil, err + } + + res := &protoqueryservice.TxStatusResponse{} + _, resRows, resErr := batches[0].waitForRows(ctx, keys) + if resErr != nil { + return nil, resErr + } + res.Statuses = resRows + promutil.AddToCounter(q.metrics.keysResponded, len(resRows)) + return res, err +} + // GetNamespacePolicies implements the query-service interface. func (q *Service) GetNamespacePolicies( ctx context.Context,