ack

package
v0.0.0-...-34e0b2d Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 7 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 {
	Timestamp              uint64
	LastConfirmedMessageID message.MessageID
	IsSync                 bool
	Err                    error
}

AckDetail records the information of acker.

type AckManager

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

AckManager manages the timestampAck.

func NewAckManager

func NewAckManager() *AckManager

NewAckManager creates a new timestampAckHelper.

func (*AckManager) AdvanceLastConfirmedMessageID

func (ta *AckManager) AdvanceLastConfirmedMessageID(msgID message.MessageID)

AdvanceLastConfirmedMessageID update the last confirmed message id.

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) 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 OptSync

func OptSync() AckOption

OptSync marks the acker is sync message.

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