mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
- Implement flusher to: - Manage the pipelines (creation, deletion, etc.) - Manage the segment write buffer - Manage sync operation (including receive flushMsg and execute flush) - Add a new `GetChannelRecoveryInfo` RPC in DataCoord. - Reorganize packages: `flushcommon` and `datanode`. issue: https://github.com/milvus-io/milvus/issues/33285 --------- Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
55 lines
2.0 KiB
Go
55 lines
2.0 KiB
Go
package adaptor
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/apache/pulsar-client-go/pulsar"
|
|
|
|
"github.com/milvus-io/milvus/pkg/mq/common"
|
|
"github.com/milvus-io/milvus/pkg/mq/mqimpl/rocksmq/server"
|
|
mqpulsar "github.com/milvus-io/milvus/pkg/mq/msgstream/mqwrapper/pulsar"
|
|
"github.com/milvus-io/milvus/pkg/streaming/util/message"
|
|
msgpulsar "github.com/milvus-io/milvus/pkg/streaming/walimpls/impls/pulsar"
|
|
"github.com/milvus-io/milvus/pkg/streaming/walimpls/impls/rmq"
|
|
)
|
|
|
|
// MustGetMQWrapperIDFromMessage converts message.MessageID to common.MessageID
|
|
// TODO: should be removed in future after common.MessageID is removed
|
|
func MustGetMQWrapperIDFromMessage(messageID message.MessageID) common.MessageID {
|
|
if id, ok := messageID.(interface{ PulsarID() pulsar.MessageID }); ok {
|
|
return mqpulsar.NewPulsarID(id.PulsarID())
|
|
} else if id, ok := messageID.(interface{ RmqID() int64 }); ok {
|
|
return &server.RmqID{MessageID: id.RmqID()}
|
|
}
|
|
panic("unsupported now")
|
|
}
|
|
|
|
// MustGetMessageIDFromMQWrapperID converts common.MessageID to message.MessageID
|
|
// TODO: should be removed in future after common.MessageID is removed
|
|
func MustGetMessageIDFromMQWrapperID(commonMessageID common.MessageID) message.MessageID {
|
|
if id, ok := commonMessageID.(interface{ PulsarID() pulsar.MessageID }); ok {
|
|
return msgpulsar.NewPulsarID(id.PulsarID())
|
|
} else if id, ok := commonMessageID.(*server.RmqID); ok {
|
|
return rmq.NewRmqID(id.MessageID)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// DeserializeToMQWrapperID deserializes messageID bytes to common.MessageID
|
|
// TODO: should be removed in future after common.MessageID is removed
|
|
func DeserializeToMQWrapperID(msgID []byte, walName string) (common.MessageID, error) {
|
|
switch walName {
|
|
case "pulsar":
|
|
pulsarID, err := mqpulsar.DeserializePulsarMsgID(msgID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return mqpulsar.NewPulsarID(pulsarID), nil
|
|
case "rocksmq":
|
|
rID := server.DeserializeRmqID(msgID)
|
|
return &server.RmqID{MessageID: rID}, nil
|
|
default:
|
|
return nil, fmt.Errorf("unsupported mq type %s", walName)
|
|
}
|
|
}
|