aboutsummaryrefslogtreecommitdiff
path: root/weed/mq/topic.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-07-11 00:20:27 -0700
committerchrislu <chris.lu@gmail.com>2022-07-28 23:24:38 -0700
commit9f479aab98e6d8b02026d935af1f614ee8b0b403 (patch)
treefcc84420d1d6b8d13113413ced9920d9a5d10f0e /weed/mq/topic.go
parentbb01b68fa0066adecf8d6a2c336ffd6cb4363bdd (diff)
downloadseaweedfs-9f479aab98e6d8b02026d935af1f614ee8b0b403.tar.xz
seaweedfs-9f479aab98e6d8b02026d935af1f614ee8b0b403.zip
allocate brokers to serve segments
Diffstat (limited to 'weed/mq/topic.go')
-rw-r--r--weed/mq/topic.go33
1 files changed, 23 insertions, 10 deletions
diff --git a/weed/mq/topic.go b/weed/mq/topic.go
index fc1923af1..87621fca7 100644
--- a/weed/mq/topic.go
+++ b/weed/mq/topic.go
@@ -1,23 +1,36 @@
package mq
-import "time"
+import (
+ "github.com/chrislusf/seaweedfs/weed/pb/mq_pb"
+ "time"
+)
type Namespace string
type Topic struct {
- namespace Namespace
- name string
+ Namespace Namespace
+ Name string
}
type Partition struct {
- rangeStart int
- rangeStop int // exclusive
- ringSize int
+ RangeStart int
+ RangeStop int // exclusive
+ RingSize int
}
type Segment struct {
- topic Topic
- id int32
- partition Partition
- lastModified time.Time
+ Topic Topic
+ Id int32
+ Partition Partition
+ LastModified time.Time
+}
+
+func FromPbSegment(segment *mq_pb.Segment) *Segment {
+ return &Segment{
+ Topic: Topic{
+ Namespace: Namespace(segment.Namespace),
+ Name: segment.Topic,
+ },
+ Id: segment.Id,
+ }
}