diff --git a/internal/util/rocksmq/client/rocksmq/consumer.go b/internal/util/rocksmq/client/rocksmq/consumer.go index 3c661a2083..372f0334bd 100644 --- a/internal/util/rocksmq/client/rocksmq/consumer.go +++ b/internal/util/rocksmq/client/rocksmq/consumer.go @@ -13,18 +13,24 @@ package rocksmq import server "github.com/milvus-io/milvus/internal/util/rocksmq/server/rocksmq" +// SubscriptionInitialPosition is the initial subscription position type SubscriptionInitialPosition int + +// UniqueID is the type of message ID type UniqueID = server.UniqueID +// List 2 kinds of SubscriptionInitialPosition const ( SubscriptionPositionLatest SubscriptionInitialPosition = iota SubscriptionPositionEarliest ) +// EarliestMessageID is used to get the earliest message ID, default -1 func EarliestMessageID() UniqueID { return -1 } +// ConsumerOptions is the options of a consumer type ConsumerOptions struct { // The topic that this consumer will subscribe on Topic string @@ -41,6 +47,7 @@ type ConsumerOptions struct { MessageChannel chan ConsumerMessage } +// ConsumerMessage is the message content of a consumer message type ConsumerMessage struct { Consumer MsgID UniqueID @@ -48,6 +55,7 @@ type ConsumerMessage struct { Payload []byte } +// Consumer interface provide operations for a consumer type Consumer interface { // returns the subscription for the consumer Subscription() string diff --git a/internal/util/rocksmq/client/rocksmq/producer.go b/internal/util/rocksmq/client/rocksmq/producer.go index ab150d8bb1..dd4f3aac59 100644 --- a/internal/util/rocksmq/client/rocksmq/producer.go +++ b/internal/util/rocksmq/client/rocksmq/producer.go @@ -11,14 +11,17 @@ package rocksmq +// ProducerOptions is the options of a producer type ProducerOptions struct { Topic string } +// ProducerMessage is the message of a producer type ProducerMessage struct { Payload []byte } +// Producer provedes some operations for a producer type Producer interface { // return the topic which producer is publishing to Topic() string