models

package
v0.0.0-...-5aa5535 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	ID         string `gorm:"primaryKey"`
	TopicID    string
	Group      string
	Position   string
	CreatedAt  int64 `gorm:"autoCreateTime"`
	UpdatedAt  int64 `gorm:"autoUpdateTime"`
	Partitions datatypes.JSONSlice[int64]
}

func ConsumerFromProto

func ConsumerFromProto(pc *kayakv1.TopicConsumer) *Consumer

func (*Consumer) GetPartitions

func (c *Consumer) GetPartitions() []int64

type Record

type Record struct {
	ID        string `gorm:"primaryKey"`
	TopicID   string
	Partition int64
	// Headers map[string]string
	Headers   datatypes.JSONMap
	Payload   []byte
	UpdatedAt int64 `gorm:"autoUpdateTime"`
	CreatedAt int64 `gorm:"autoCreateTime"`
}

func RecordFromProto

func RecordFromProto(pr *kayakv1.Record) *Record

func (*Record) AddHeaders

func (r *Record) AddHeaders(headers map[string]string)

func (*Record) GetHeaders

func (r *Record) GetHeaders() map[string]string

func (*Record) ToProto

func (r *Record) ToProto() *kayakv1.Record

type Topic

type Topic struct {
	ID             string `gorm:"primaryKey"` // name
	PartitionCount int
	Archived       bool
	DefaultHash    string
	UpdatedAt      int64 `gorm:"autoUpdateTime"`
	CreatedAt      int64 `gorm:"autoCreateTime"`
	Consumers      []Consumer
	TTL            int64
}

func TopicFromProto

func TopicFromProto(pt *kayakv1.Topic) *Topic

func (*Topic) Balance

func (t *Topic) Balance(record *Record)

func (*Topic) MurmurBalancer

func (t *Topic) MurmurBalancer(record *Record)

func (*Topic) Partitions

func (t *Topic) Partitions() []int64

func (*Topic) RandomBalancer

func (t *Topic) RandomBalancer(record *Record)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL