handler

package
v0.10.3-0...-e092884 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientClosed             = errors.New("handler client is closed")
	ErrClientAssignmentNotReady = errors.New("handler client assignment not ready")
	ErrReadOnlyWAL              = errors.New("wal is read only")
)

Functions

This section is empty.

Types

type Consumer

type Consumer = consumer.Consumer

type ConsumerOptions

type ConsumerOptions struct {
	// PChannel is the pchannel of the consumer.
	PChannel string

	// VChannel is the vchannel of the consumer.
	VChannel string

	// DeliverPolicy is the deliver policy of the consumer.
	DeliverPolicy options.DeliverPolicy

	// DeliverFilters is the deliver filters of the consumer.
	DeliverFilters []options.DeliverFilter

	// Handler is the message handler used to handle message after recv from consumer.
	MessageHandler message.Handler

	// IgnorePauseConsumption is the flag to ignore the consumption pause of the consumer.
	IgnorePauseConsumption bool
}

ConsumerOptions is the options for creating a consumer.

type HandlerClient

type HandlerClient interface {
	// GetLatestMVCCTimestampIfLocal gets the latest mvcc timestamp of the vchannel.
	// If the wal is located at remote, it will return 0, error.
	GetLatestMVCCTimestampIfLocal(ctx context.Context, vchannel string) (uint64, error)

	// GetReplicateCheckpoint returns the WAL checkpoint that will be used to create scanner.
	GetReplicateCheckpoint(ctx context.Context, channelName string) (*wal.ReplicateCheckpoint, error)

	// GetWALMetricsIfLocal gets the metrics of the local wal.
	// It will only return the metrics of the local wal but not the remote wal.
	GetWALMetricsIfLocal(ctx context.Context) (*types.StreamingNodeMetrics, error)

	// CreateProducer creates a producer.
	// Producer is a stream client without keep alive promise.
	// It will be available until context canceled, active close, streaming error or remote server wal closing.
	// Because of there's no more ProducerOptions except PChannel, so a producer of same PChannel is shared by reference count.
	CreateProducer(ctx context.Context, opts *ProducerOptions) (Producer, error)

	// CreateConsumer creates a consumer.
	// Consumer is a stream client without keep alive promise.
	// It will be available until context canceled, active close, streaming error or remote server wal closing.
	// A consumer will not share stream connection with other consumers.
	CreateConsumer(ctx context.Context, opts *ConsumerOptions) (Consumer, error)

	// Close closes the handler client.
	// It will only stop the underlying service discovery, but don't stop the producer and consumer created by it.
	// So please close Producer and Consumer created by it before close the handler client.
	Close()
}

HandlerClient is the interface that wraps streamingpb.StreamingNodeHandlerServiceClient. HandlerClient wraps the PChannel Assignment Service Discovery. Provides the ability to create pchannel-level producer and consumer.

func NewHandlerClient

func NewHandlerClient(w types.AssignmentDiscoverWatcher) HandlerClient

NewHandlerClient creates a new handler client.

type Producer

type Producer = producer.Producer

type ProducerOptions

type ProducerOptions struct {
	// PChannel is the pchannel of the producer.
	PChannel string
}

ProducerOptions is the options for creating a producer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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