diff options
| author | chrislu <chris.lu@gmail.com> | 2023-08-28 09:02:12 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2023-08-28 09:02:12 -0700 |
| commit | 1eb2da46d5d5a52c1012aa19ef31c1c8ed568d9e (patch) | |
| tree | d808ee7c62bffa0a86ad908b9b533652f7227ef3 /weed/mq/topic/local_partition.go | |
| parent | 504ae8383ac3a0838d31d04b31623872b5734b31 (diff) | |
| download | seaweedfs-1eb2da46d5d5a52c1012aa19ef31c1c8ed568d9e.tar.xz seaweedfs-1eb2da46d5d5a52c1012aa19ef31c1c8ed568d9e.zip | |
connect and publish
Diffstat (limited to 'weed/mq/topic/local_partition.go')
| -rw-r--r-- | weed/mq/topic/local_partition.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/weed/mq/topic/local_partition.go b/weed/mq/topic/local_partition.go index a87922d9c..eaedb9f20 100644 --- a/weed/mq/topic/local_partition.go +++ b/weed/mq/topic/local_partition.go @@ -1,6 +1,7 @@ package topic import ( + "fmt" "github.com/seaweedfs/seaweedfs/weed/pb" "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb" @@ -15,6 +16,24 @@ type LocalPartition struct { logBuffer *log_buffer.LogBuffer } +func NewLocalPartition(topic Topic, partition Partition, isLeader bool, followerBrokers []pb.ServerAddress) *LocalPartition { + return &LocalPartition{ + Partition: partition, + isLeader: isLeader, + FollowerBrokers: followerBrokers, + logBuffer: log_buffer.NewLogBuffer( + fmt.Sprintf("%s/%s/%4d-%4d", topic.Namespace, topic.Name, partition.RangeStart, partition.RangeStop), + 2*time.Minute, + func(startTime, stopTime time.Time, buf []byte) { + + }, + func() { + + }, + ), + } +} + type OnEachMessageFn func(logEntry *filer_pb.LogEntry) error func (p LocalPartition) Publish(message *mq_pb.DataMessage) { |
