aboutsummaryrefslogtreecommitdiff
path: root/weed/mq/topic.go
blob: 87621fca7c8306165fec1212b59fa201a82b0bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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,
	}
}