2021-04-19 10:09:43 +08:00
|
|
|
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
|
|
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
|
|
// or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
|
|
|
2021-01-15 14:38:36 +08:00
|
|
|
package proxynode
|
2020-11-23 16:52:17 +08:00
|
|
|
|
|
|
|
import (
|
2021-04-22 14:45:57 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/msgstream"
|
2020-11-23 16:52:17 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func insertRepackFunc(tsMsgs []msgstream.TsMsg,
|
2021-05-25 19:53:15 +08:00
|
|
|
hashKeys [][]int32) (map[int32]*msgstream.MsgPack, error) {
|
2020-11-23 16:52:17 +08:00
|
|
|
|
|
|
|
result := make(map[int32]*msgstream.MsgPack)
|
|
|
|
for i, request := range tsMsgs {
|
2020-11-26 16:01:31 +08:00
|
|
|
keys := hashKeys[i]
|
2021-05-25 19:53:15 +08:00
|
|
|
if len(keys) > 0 {
|
|
|
|
key := keys[0]
|
2020-11-23 16:52:17 +08:00
|
|
|
_, ok := result[key]
|
|
|
|
if !ok {
|
2021-05-25 19:53:15 +08:00
|
|
|
result[key] = &msgstream.MsgPack{}
|
2020-11-23 16:52:17 +08:00
|
|
|
}
|
2021-05-25 19:53:15 +08:00
|
|
|
result[key].Msgs = append(result[key].Msgs, request)
|
2020-11-23 16:52:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|