aboutsummaryrefslogtreecommitdiff
path: root/weed/mq/topic.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/mq/topic.go')
-rw-r--r--weed/mq/topic.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/weed/mq/topic.go b/weed/mq/topic.go
new file mode 100644
index 000000000..87621fca7
--- /dev/null
+++ b/weed/mq/topic.go
@@ -0,0 +1,36 @@
+package mq
+
+import (
+ "github.com/chrislusf/seaweedfs/weed/pb/mq_pb"
+ "time"
+)
+
+type Namespace string
+
+type Topic struct {
+ Namespace Namespace
+ Name string
+}
+
+type Partition struct {
+ RangeStart int
+ RangeStop int // exclusive
+ RingSize int
+}
+
+type Segment struct {
+ 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,
+ }
+}