ack

package
v0.10.3-0...-589b5b9 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AckDetail

type AckDetail struct {
	BeginTimestamp uint64 // the timestamp when acker is allocated.
	EndTimestamp   uint64 // the timestamp when acker is acknowledged.
	// for avoiding allocation of timestamp failure, the timestamp will use the ack manager last allocated timestamp.
	LastConfirmedMessageID message.MessageID
	MessageID              message.MessageID
	TxnSession             *txn.TxnSession
	IsSync                 bool
	Err                    error
}

AckDetail records the information of acker.

type AckDetails

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

AckDetails records the information of AckDetail. Used to analyze the all acknowledged details. TODO: add more analysis methods. e.g. such as counter function with filter.

func NewAckDetails

func NewAckDetails() *AckDetails

NewAckDetails creates a new AckDetails.

func (*AckDetails) AddDetails

func (ad *AckDetails) AddDetails(details sortedDetails)

AddDetails adds details to AckDetails. The input details must be sorted by timestamp.

func (*AckDetails) Clear

func (ad *AckDetails) Clear()

Clear clears the AckDetails.

func (*AckDetails) EarliestLastConfirmedMessageID

func (ad *AckDetails) EarliestLastConfirmedMessageID() message.MessageID

EarliestLastConfirmedMessageID returns the last confirmed message id.

func (*AckDetails) Empty

func (ad *AckDetails) Empty() bool

Empty returns true if the AckDetails is empty.

func (*AckDetails) IsNoPersistedMessage

func (ad *AckDetails) IsNoPersistedMessage() bool

IsNoPersistedMessage returns true if no persisted message.

func (*AckDetails) LastAllAcknowledgedTimestamp

func (ad *AckDetails) LastAllAcknowledgedTimestamp() uint64

LastAllAcknowledgedTimestamp returns the last timestamp which all timestamps before it have been acknowledged. panic if no timestamp has been acknowledged.

func (*AckDetails) Len

func (ad *AckDetails) Len() int

Len returns the count of AckDetail.

func (*AckDetails) Range

func (ad *AckDetails) Range(fn func(detail *AckDetail) bool)

Range iterates the AckDetail.

type AckManager

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

AckManager manages the timestampAck.

func NewAckManager

func NewAckManager(
	lastConfirmedTimeTick uint64,
	lastConfirmedMessageID message.MessageID,
	metrics *metricsutil.TimeTickMetrics,
) *AckManager

NewAckManager creates a new timestampAckHelper.

func (*AckManager) Allocate

func (ta *AckManager) Allocate(ctx context.Context) (*Acker, error)

Allocate allocates a timestamp. Concurrent safe to call with Sync and Allocate.

func (*AckManager) AllocateWithBarrier

func (ta *AckManager) AllocateWithBarrier(ctx context.Context, barrierTimeTick uint64) (*Acker, error)

AllocateWithBarrier allocates a timestamp with a barrier.

func (*AckManager) SyncAndGetAcknowledged

func (ta *AckManager) SyncAndGetAcknowledged(ctx context.Context) ([]*AckDetail, error)

SyncAndGetAcknowledged syncs the ack records with allocator, and get the last all acknowledged info. Concurrent safe to call with Allocate.

type AckOption

type AckOption func(*AckDetail)

AckOption is the option for acker.

func OptError

func OptError(err error) AckOption

OptError marks the timestamp ack with error info.

func OptMessageID

func OptMessageID(messageID message.MessageID) AckOption

OptMessageID marks the message id for acker.

func OptSync

func OptSync() AckOption

OptSync marks the acker is sync message.

func OptTxnSession

func OptTxnSession(session *txn.TxnSession) AckOption

OptTxnSession marks the session for acker.

type Acker

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

Acker records the timestamp and last confirmed message id that has not been acknowledged.

func (*Acker) Ack

func (ta *Acker) Ack(opts ...AckOption)

Ack marks the timestamp as acknowledged.

func (*Acker) LastConfirmedMessageID

func (ta *Acker) LastConfirmedMessageID() message.MessageID

LastConfirmedMessageID returns the last confirmed message id.

func (*Acker) Timestamp

func (ta *Acker) Timestamp() uint64

Timestamp returns the timestamp.

Jump to

Keyboard shortcuts

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