Change int to MessageID

Signed-off-by: Xiangyu Wang <xiangyu.wang@zilliz.com>
pull/4973/head^2
Xiangyu Wang 2021-01-12 10:52:57 +08:00 committed by yefu.chen
parent f3d2afa4f4
commit b6e1713044
6 changed files with 91 additions and 237 deletions

View File

@ -13,8 +13,8 @@
```go
type Client interface {
BuildIndex(req BuildIndexRequest) (BuildIndexResponse, error)
GetIndexStates(req IndexStatesRequest) (IndexStatesResponse, error)
GetIndexFilePaths(req IndexFilePathRequest) (IndexFilePathsResponse, error)
DescribeIndex(indexID UniqueID) (IndexDescription, error)
GetIndexFilePaths(indexID UniqueID) (IndexFilePaths, error)
}
```
@ -36,23 +36,19 @@ type BuildIndexResponse struct {
* *GetIndexStates*
* *DescribeIndex*
```go
type IndexStatesRequest struct {
IndexID UniqueID
}
enum IndexState {
enum IndexStatus {
NONE = 0;
UNISSUED = 1;
INPROGRESS = 2;
FINISHED = 3;
}
type IndexStatesResponse struct {
type IndexDescription struct {
ID UniqueID
State IndexState
Status IndexStatus
EnqueueTime time.Time
ScheduleTime time.Time
BuildCompleteTime time.Time
@ -64,11 +60,7 @@ type IndexStatesResponse struct {
* *GetIndexFilePaths*
```go
type IndexFilePathRequest struct {
IndexID UniqueID
}
type IndexFilePathsResponse struct {
type IndexFilePaths struct {
FilePaths []string
}
```
@ -82,7 +74,7 @@ type IndexNode interface {
Start() error
Close() error
// SetTimeTickChannel(channelID string) error
SetTimeTickChannel(channelID string) error
SetStatsChannel(channelID string) error
BuildIndex(req BuildIndexRequest) (BuildIndexResponse, error)

View File

@ -6,13 +6,13 @@
#### 8.2 Message Stream Service API
#### 8.2 API
```go
type Client interface {
CreateChannels(req CreateChannelRequest) (CreateChannelResponse, error)
DestoryChannels(req DestoryChannelRequest) error
DescribeChannels(req DescribeChannelRequest) (DescribeChannelResponse, error)
CreateChannels(req CreateChannelRequest) (ChannelID []string, error)
DestoryChannels(channelID []string) error
DescribeChannels(channelID []string) (ChannelDescriptions, error)
}
```
@ -28,19 +28,7 @@ type OwnerDescription struct {
type CreateChannelRequest struct {
OwnerDescription OwnerDescription
NumChannels int
}
type CreateChannelResponse struct {
ChannelIDs []string
}
```
* *DestoryChannels*
```go
type DestoryChannelRequest struct {
ChannelIDs []string
numChannels int
}
```
@ -49,16 +37,11 @@ type DestoryChannelRequest struct {
* *DescribeChannels*
```go
type DescribeChannelRequest struct {
ChannelIDs []string
}
type ChannelDescription struct {
ChannelID string
Owner OwnerDescription
}
type DescribeChannelResponse struct {
type ChannelDescriptions struct {
Descriptions []ChannelDescription
}
```
@ -73,7 +56,7 @@ const {
kInsert MsgType = 400
kDelete MsgType = 401
kSearch MsgType = 500
kSearchResult MsgType = 1000
KSearchResult MsgType = 1000
kSegStatistics MsgType = 1100
@ -174,42 +157,55 @@ RocksMQ is a RocksDB-based messaging/streaming library.
```go
type ProducerMessage struct {
Key string
Payload []byte
payload []byte
}
```
```go
type ConsumerMessage struct {
MsgID MessageID
Key string
Payload []byte
msgID MessageID
payload []byte
}
```
```GO
type RocksMQ struct {
CreateChannel(channelName string) error
DestroyChannel(channelName string) error
CreateConsumerGroup(groupName string) error
DestroyConsumerGroup(groupName string) error
Produce(channelName string, messages []ProducerMessage) error
Consume(groupName string, channelName string, n int) ([]ConsumerMessage, error)
Seek(groupName string, channelName string, msgID MessageID) error
type Channel struct {
beginOffset MessageID
endOffset MessageID
}
type ComsumerGroupContext struct {
currentOffset MessageID
}
// Every collection has its RocksMQ
type RocksMQ struct {
channels map[string]Channel
cgCtxs map[string]ComsumerGroupContext
mu sync.Mutex
}
func (rmq *RocksMQ) CreateChannel(channelName string) error // create channel, add record in meta-store
func (rmq *RocksMQ) DestroyChannel(channelName string) error // drop channel, delete record in meta-store
func (rmq *RocksMQ) CreateConsumerGroup(groupName string) error // create consumer group, add record in meta-store
func (rmq *RocksMQ) DestroyConsumerGroup(groupName string) error // drop consumer group, delete record in meta-store
func (rmq *RocksMQ) Produce(channelName string, messages []ProducerMessage) error // produce a batch of message, insert into rocksdb
func (rmq *RocksMQ) Consume(groupName string, channelName string, n int) ([]ConsumerMessage, error) // comsume up to n messages, modify current_id in Etcd
func (rmq *RocksMQ) Seek(groupName string, channelName string, msgID MessageID) error // modify current_id in Etcd
```
##### A.4.1 Meta
##### A.4.1 Meta (stored in Etcd)
* channel meta
```go
"$(channel_name)/start_id", MessageID
"$(channel_name)/begin_id", MessageID
"$(channel_name)/end_id", MessageID
```
@ -219,3 +215,12 @@ type RocksMQ struct {
"$(group_name)/$(channel_name)/current_id", MessageID
```
##### A.4.2 Data (stored in RocksDB)
- data
```go
"$(channel_name)/$(unique_id)", []byte
```

View File

@ -51,16 +51,13 @@ type ProxyNode interface {
CreateCollection(req CreateCollectionRequest) error
DropCollection(req DropCollectionRequest) error
HasCollection(req HasCollectionRequest) (bool, error)
DescribeCollection(req DescribeCollectionRequest) (DescribeCollectionResponse, error)
GetCollectionStatistics(req CollectionStatsRequest) (CollectionStatsResponse, error)
DescribeCollection(req DescribeCollectionRequest) (CollectionDescription, error)
ShowCollections(req ShowCollectionRequest) ([]string, error)
CreatePartition(req CreatePartitionRequest) error
DropPartition(req DropPartitionRequest) error
HasPartition(req HasPartitionRequest) (bool, error)
GetPartitionStatistics(req PartitionStatsRequest) (PartitionStatsResponse, error)
DescribePartition(req DescribePartitionRequest) (PartitionDescription, error)
ShowPartitions(req ShowPartitionRequest) ([]string, error)
CreateIndex(req CreateIndexRequest) error
DescribeIndex(DescribeIndexRequest) (DescribeIndexResponse, error)

View File

@ -12,22 +12,15 @@ type Client interface {
CreateCollection(req CreateCollectionRequest) error
DropCollection(req DropCollectionRequest) error
HasCollection(req HasCollectionRequest) (bool, error)
DescribeCollection(req DescribeCollectionRequest) (CollectionDescriptionResponse, error)
GetCollectionStatistics(req CollectionStatsRequest) (CollectionStatsResponse, error)
ShowCollections(req ShowCollectionRequest) (ShowCollectionResponse, error)
DescribeCollection(req DescribeCollectionRequest) (CollectionDescription, error)
ShowCollections(req ShowCollectionRequest) ([]string, error)
CreatePartition(req CreatePartitionRequest) error
DropPartition(req DropPartitionRequest) error
HasPartition(req HasPartitionRequest) (bool, error)
GetPartitionStatistics(req PartitionStatsRequest) (PartitionStatsResponse, error)
ShowPartitions(req ShowPartitionRequest) (ShowPartitionResponse, error)
CreateIndex(req CreateIndexRequest) error
DescribeIndex(DescribeIndexRequest) (DescribeIndexResponse, error)
DescribePartition(req DescribePartitionRequest) (PartitionDescription, error)
ShowPartitions(req ShowPartitionRequest) ([]string, error)
AllocTimestamp(req TsoRequest) (TsoResponse, error)
AllocID(req IDRequest) (IDResponse, error)
GetDdChannel() (string, error)
GetTimeTickChannel() (string, error)
GetStatsChannel() (string, error)
@ -36,81 +29,6 @@ type Client interface {
* *DescribeCollection*
```go
type DescribeCollectionRequest struct {
CollectionName string
}
type CollectionDescriptionResponse struct {
Schema CollectionSchema
}
```
* *GetCollectionStatistics*
```go
type CollectionStatsRequest struct {
CollectionName string
}
type CollectionStatsResponse struct {
Stats []KeyValuePair
}
```
* *ShowCollections*
```go
type ShowCollectionResponse struct {
CollectionNames []string
}
```
* *GetPartitionStatistics*
```go
type PartitionStatsRequest struct {
CollectionName string
PartitionTag string
}
type PartitionStatsResponse struct {
Stats []KeyValuePair
}
```
* *ShowPartitions*
```go
type ShowPartitionResponse struct {
PartitionTags []string
}
```
* *DescribeIndex*
```go
type DescribeIndexRequest struct {
CollectionName string
FieldName string
}
type IndexDescription struct {
IndexName string
params []KeyValuePair
}
type DescribeIndexResponse struct {
IndexDescriptions []IndexDescription
}
```
#### 10.1 Interfaces (RPC)
| RPC | description |

View File

@ -8,15 +8,13 @@
#### 8.2 Query Service API
#### 8.2 API
```go
type Client interface {
RegisterNode(req NodeInfo) (InitParams, error)
GetServiceStates() (ServiceStatesResponse, error)
ShowCollections(req ShowCollectionRequest) (ShowCollectionResponse, error)
ShowPartitions(req ShowPartitionRequest) (ShowPartitionResponse, error)
GetPartitionStates(req PartitionStatesRequest) (PartitionStatesResponse, error)
DescribeService() (ServiceDescription, error)
DescribeParition(req DescribeParitionRequest) (PartitionDescriptions, error)
LoadPartitions(req LoadPartitonRequest) error
ReleasePartitions(req ReleasePartitionRequest) error
CreateQueryChannel() (QueryChannels, error)
@ -35,7 +33,7 @@ type NodeInfo struct {}
type InitParams struct {}
```
* *GetServiceStates*
* *DescribeService*
```go
type NodeState = int
@ -46,51 +44,36 @@ const (
ABNORMAL NodeState = 2
)
//type ResourceCost struct {
// MemUsage int64
// CpuUsage float32
//}
type QueryNodeStates struct {
type QueryNodeDescription struct {
NodeState NodeState
//ResourceCost ResourceCost
ResourceCost ResourceCost
}
type ServiceStatesResponse struct {
ServiceState NodeState
type CollectionDescription struct {
ParitionIDs []UniqueID
}
type DbDescription struct {
CollectionDescriptions []CollectionDescription
}
type ServiceDescription struct {
DbDescriptions map[UniqueID]DbDescription
NodeDescriptions map[UniqueID]QueryNodeDescription
}
```
* *ShowCollections*
* *DescribeParition*
```go
type ShowCollectionRequest struct {
DbID UniqueID
}
type ShowCollectionResponse struct {
CollectionIDs []UniqueID
}
```
* *ShowPartitions*
```go
type ShowPartitionRequest struct {
type DescribeParitionRequest struct {
DbID UniqueID
CollectionID UniqueID
partitionIDs []UniqueID
}
type ShowPartitionResponse struct {
PartitionIDs []UniqueID
}
```
* *GetPartitionStates*
```go
type PartitionState = int
const (
@ -103,19 +86,19 @@ const (
IN_GPU PartitionState = 6
)
type PartitionStatesRequest struct {
DbID UniqueID
CollectionID UniqueID
partitionIDs []UniqueID
type ResourceCost struct {
MemUsage int64
CpuUsage float32
}
type PartitionStates struct {
PartitionID UniqueID
type PartitionDescription struct {
ID UniqueID
State PartitionState
ResourceCost ResourceCost
}
type PartitionStatesResponse struct {
States []PartitionStates
type PartitionDescriptions struct {
PartitionDescriptions []PartitionDescription
}
```

View File

@ -15,10 +15,7 @@ type Client interface {
RegisterNode(req NodeInfo) (InitParams, error)
AssignSegmentID(req AssignSegIDRequest) (AssignSegIDResponse, error)
Flush(req FlushRequest) error
ShowSegments(req ShowSegmentRequest) (ShowSegmentResponse, error)
GetSegmentStates(req SegmentStatesRequest) (SegmentStatesResponse, error)
GetInsertBinlogPaths(req InsertBinlogPathRequest) (InsertBinlogPathsResponse, error)
GetInsertChannels(req InsertChannelRequest) ([]string, error)
GetTimeTickChannel() (string, error)
GetStatsChannel() (string, error)
@ -76,53 +73,15 @@ type FlushRequest struct {
* *ShowSegments*
```go
type ShowSegmentRequest struct {
CollectionID UniqueID
PartitionID UniqueID
}
type ShowSegmentResponse struct {
SegmentIDs []UniqueID
}
```
* *GetSegmentStates*
```go
enum SegmentState {
NONE = 0;
NOT_EXIST = 1;
GROWING = 2;
SEALED = 3;
}
type SegmentStatesRequest struct {
SegmentID UniqueID
}
type SegmentStatesResponse struct {
State SegmentState
CreateTime Timestamp
SealedTime Timestamp
}
```
* *GetInsertBinlogPaths*
```go
type InsertBinlogPathRequest struct {
SegmentID UniqueID
segmentID UniqueID
}
type InsertBinlogPathsResponse struct {
FieldIDToPaths map[int64][]string
FieldIdxToPaths map[int32][]string
}
```