metadata

package
v0.0.0-...-163fb5e Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 8 Imported by: 0

Documentation

Overview

Package metadata defines all the metadata of the TubeMQ broker and producer.

Index

Constants

View Source
const (
	Disconnect     = 2
	OnlyDisconnect = 20
	Connect        = 1
	OnlyConnect    = 10
)
View Source
const (
	Todo       = 0
	Processing = 1
	Done       = 2
	Unknown    = -1
	Failed     = -2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsumeData

type ConsumeData struct {
	// contains filtered or unexported fields
}

ConsumeData represents the consumption metadata of a partition.

func NewConsumeData

func NewConsumeData(time int64, errCode int32, escLimit bool, msgSize int32, dltLimit int64,
	curDataDlt int64, requireSlow bool) *ConsumeData

NewConsumeData returns a consume data.

type ConsumerEvent

type ConsumerEvent struct {
	// contains filtered or unexported fields
}

ConsumerEvent represents the metadata of a consumer event

func NewEvent

func NewEvent(rebalanceID int64, eventType int32, subscribeInfo []*SubscribeInfo) *ConsumerEvent

NewEvent returns a new consumer event.

func (*ConsumerEvent) GetEventStatus

func (c *ConsumerEvent) GetEventStatus() int32

GetEventStatus returns the event status of a consumer event.

func (*ConsumerEvent) GetEventType

func (c *ConsumerEvent) GetEventType() int32

GetEventType returns the event type of a consumer event.

func (*ConsumerEvent) GetRebalanceID

func (c *ConsumerEvent) GetRebalanceID() int64

GetRebalanceID returns the rebalanceID of a consumer event.

func (*ConsumerEvent) GetSubscribeInfo

func (c *ConsumerEvent) GetSubscribeInfo() []*SubscribeInfo

GetSubscribeInfo returns the list of SubscribeInfo of a consumer event.

func (*ConsumerEvent) SetEventStatus

func (c *ConsumerEvent) SetEventStatus(eventStatus int32)

SetEventStatus sets the event status.

func (*ConsumerEvent) SetEventType

func (c *ConsumerEvent) SetEventType(eventType int32)

SetEventType sets the event type.

type Metadata

type Metadata struct {
	// contains filtered or unexported fields
}

Metadata represents the metadata of

func (*Metadata) GetNode

func (m *Metadata) GetNode() *Node

GetNode returns the node of the metadata.

func (*Metadata) GetReadStatus

func (m *Metadata) GetReadStatus() int32

GetReadStatus returns the read status.

func (*Metadata) GetReportTimes

func (m *Metadata) GetReportTimes() bool

GetReportTimes returns the report times.

func (*Metadata) GetSubscribeInfo

func (m *Metadata) GetSubscribeInfo() *SubscribeInfo

GetSubscribeInfo returns the SubscribeInfo of the metadata.

func (*Metadata) SetNode

func (m *Metadata) SetNode(node *Node)

SetNode sets the node.

func (*Metadata) SetReadStatus

func (m *Metadata) SetReadStatus(status int32)

SetReadStatus sets the status.

func (*Metadata) SetReportTimes

func (m *Metadata) SetReportTimes(reportTimes bool)

SetReportTimes sets the reportTimes.

func (*Metadata) SetSubscribeInfo

func (m *Metadata) SetSubscribeInfo(sub *SubscribeInfo)

SetSubscribeInfo sets the subscribeInfo.

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node represents the metadata of a node.

func NewNode

func NewNode(isBroker bool, node string) (*Node, error)

NewNode constructs a node from a given string. If the given string is invalid, it will return error. The format of node string: nodeID:host:port

func (*Node) GetAddress

func (n *Node) GetAddress() string

GetAddress returns the address of a node.

func (*Node) GetHost

func (n *Node) GetHost() string

GetHost returns the hostname of a node.

func (*Node) GetID

func (n *Node) GetID() uint32

GetID returns the id of a node.

func (*Node) GetPort

func (n *Node) GetPort() uint32

GetPort returns the port of a node.

func (*Node) SetAddress

func (n *Node) SetAddress(address string) error

SetAddress sets the address.

func (*Node) SetHost

func (n *Node) SetHost(host string)

SetHost sets the host.

func (*Node) String

func (n *Node) String() string

String returns the metadata of a node as a string.

type Partition

type Partition struct {
	// contains filtered or unexported fields
}

Partition represents the metadata of a partition.

func NewPartition

func NewPartition(partition string) (*Partition, error)

NewPartition parses a partition from the given string. The format of partition string: brokerInfo#topic:partitionId

func (*Partition) BookConsumeData

func (p *Partition) BookConsumeData(data *ConsumeData)

BookConsumeData sets the consumeData.

func (*Partition) GetBroker

func (p *Partition) GetBroker() *Node

GetBroker returns the broker.

func (*Partition) GetDelayTimestamp

func (p *Partition) GetDelayTimestamp() int64

func (*Partition) GetLastConsumed

func (p *Partition) GetLastConsumed() bool

GetLastConsumed returns lastConsumed of a partition.

func (*Partition) GetPartitionID

func (p *Partition) GetPartitionID() int32

GetPartitionID returns the partition id of a partition.

func (*Partition) GetPartitionKey

func (p *Partition) GetPartitionKey() string

GetPartitionKey returns the partition key of a partition.

func (*Partition) GetTopic

func (p *Partition) GetTopic() string

GetTopic returns the topic of the partition subscribed to.

func (*Partition) ProcConsumeResult

func (p *Partition) ProcConsumeResult(defHandler *flowctrl.RuleHandler, groupHandler *flowctrl.RuleHandler,
	filterConsume bool, lastConsumed bool) int64

ProcConsumeResult processes consume result.

func (*Partition) SetLastConsumed

func (p *Partition) SetLastConsumed(lastConsumed bool)

SetLastConsumed sets the last consumed.

func (*Partition) String

func (p *Partition) String() string

String returns the metadata of a Partition as a string.

type SubscribeInfo

type SubscribeInfo struct {
	// contains filtered or unexported fields
}

SubscribeInfo represents the metadata of the subscribe info.

func NewSubscribeInfo

func NewSubscribeInfo(subscribeInfo string) (*SubscribeInfo, error)

NewSubscribeInfo constructs a SubscribeInfo from a given string. If the given is invalid, it will return error. The format of subscribeInfo string: consumerId@group#broker_info#topic:partitionId

func (*SubscribeInfo) GetConsumerID

func (s *SubscribeInfo) GetConsumerID() string

GetConsumerID returns the consumer id.

func (*SubscribeInfo) GetGroup

func (s *SubscribeInfo) GetGroup() string

GetGroup returns the group name.

func (*SubscribeInfo) GetPartition

func (s *SubscribeInfo) GetPartition() *Partition

GetPartition returns the partition.

func (*SubscribeInfo) SetConsumerID

func (s *SubscribeInfo) SetConsumerID(id string)

SetConsumerID sets the consumerID.

func (*SubscribeInfo) SetGroup

func (s *SubscribeInfo) SetGroup(group string)

SetGroup sets the group.

func (*SubscribeInfo) SetPartition

func (s *SubscribeInfo) SetPartition(partition *Partition)

SetPartition sets the partition.

func (*SubscribeInfo) String

func (s *SubscribeInfo) String() string

String returns the contents of SubscribeInfo as a string.

type TopicInfo

type TopicInfo struct {
	// contains filtered or unexported fields
}

func NewTopicInfo

func NewTopicInfo(node *Node, topic string, partitionNum int, storeNum int) *TopicInfo

New topicinfo

func (*TopicInfo) GetNode

func (p *TopicInfo) GetNode() *Node

func (*TopicInfo) GetPartitionNum

func (p *TopicInfo) GetPartitionNum() int

func (*TopicInfo) GetStoreNum

func (p *TopicInfo) GetStoreNum() int

func (*TopicInfo) GetTopic

func (p *TopicInfo) GetTopic() string

Jump to

Keyboard shortcuts

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