Add rocksmq comments (#8362)

Signed-off-by: fishpenguin <kun.yu@zilliz.com>
pull/8246/head
yukun 2021-09-23 16:59:54 +08:00 committed by GitHub
parent 8b81ceb5d7
commit 78e8e4aa22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -11,21 +11,26 @@
package rocksmq
// ProducerMessage that will be write to rocksdb
type ProducerMessage struct {
Payload []byte
}
// Rocksmq consumer
type Consumer struct {
Topic string
GroupName string
MsgMutex chan struct{}
}
// ConsumerMessage that consumed from rocksdb
type ConsumerMessage struct {
MsgID UniqueID
Payload []byte
}
// Rocksmq is an interface thatmay be implemented by the application
// to do message queue operations based ion rocksdb
type RocksMQ interface {
CreateTopic(topicName string) error
DestroyTopic(topicName string) error

View File

@ -27,10 +27,16 @@ import (
"go.uber.org/zap"
)
// RocksmqRetentionTimeInMinutes is the time of retention
var RocksmqRetentionTimeInMinutes int64
// RocksmqRetentionSizeInMB is the size of retention
var RocksmqRetentionSizeInMB int64
// TickerTimeInMinutes is the time of expired check
var TickerTimeInMinutes int64 = 1
// Const value that used to convert unit
const (
MB = 2 << 20
MINUTE = 60
@ -477,6 +483,7 @@ func (ri *retentionInfo) expiredCleanUp(topic string) error {
return DeleteMessages(ri.db, topic, startID, endID)
}
// Delte messages in rocksdb by range of [startID, endID)
func DeleteMessages(db *gorocksdb.DB, topic string, startID, endID UniqueID) error {
// Delete msg by range of startID and endID
startKey, err := combKey(topic, startID)