You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
555 B

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. package mq
  2. import (
  3. "github.com/chrislusf/seaweedfs/weed/pb/mq_pb"
  4. "time"
  5. )
  6. type Namespace string
  7. type Topic struct {
  8. Namespace Namespace
  9. Name string
  10. }
  11. type Partition struct {
  12. RangeStart int
  13. RangeStop int // exclusive
  14. RingSize int
  15. }
  16. type Segment struct {
  17. Topic Topic
  18. Id int32
  19. Partition Partition
  20. LastModified time.Time
  21. }
  22. func FromPbSegment(segment *mq_pb.Segment) *Segment {
  23. return &Segment{
  24. Topic: Topic{
  25. Namespace: Namespace(segment.Namespace),
  26. Name: segment.Topic,
  27. },
  28. Id: segment.Id,
  29. }
  30. }