seaweedfs/weed/mq/topic.go

37 lines
555 B
Go
Raw Normal View History

2022-07-10 08:36:23 +00:00
package mq
2022-07-11 07:20:27 +00:00
import (
"github.com/chrislusf/seaweedfs/weed/pb/mq_pb"
"time"
)
2022-07-10 08:36:23 +00:00
type Namespace string
type Topic struct {
2022-07-11 07:20:27 +00:00
Namespace Namespace
Name string
2022-07-10 08:36:23 +00:00
}
type Partition struct {
2022-07-11 07:20:27 +00:00
RangeStart int
RangeStop int // exclusive
RingSize int
2022-07-10 08:36:23 +00:00
}
type Segment struct {
2022-07-11 07:20:27 +00:00
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,
}
2022-07-10 08:36:23 +00:00
}