handler

package
v1.24.3 Latest Latest
Warning

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

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

Documentation

Overview

Package handler provides implementations of command handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	*NewOpts
	// contains filtered or unexported fields
}

Handler provides a set of methods to process clients' requests sent over wire protocol.

The methods msgXXX handle OP_MSG commands. CmdQuery handles a limited subset of OP_QUERY messages.

Handler instance is shared between all client connections.

func New

func New(opts *NewOpts) (*Handler, error)

New returns a new handler. Handler.Run must be called on the returned value.

func (*Handler) CmdQuery

func (h *Handler) CmdQuery(connCtx context.Context, query *middleware.Request) (*middleware.Response, error)

CmdQuery implements deprecated OP_QUERY message handling.

The passed context is canceled when the client connection is closed.

func (*Handler) Collect

func (h *Handler) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*Handler) Describe

func (h *Handler) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, req *middleware.Request) (*middleware.Response, error)

Handle implements middleware.Handler.

func (*Handler) Run

func (h *Handler) Run(ctx context.Context)

Run implements middleware.Handler.

When this method returns, handler is stopped and pool is closed.

type NewOpts

type NewOpts struct {
	PostgreSQLURL string
	Auth          bool
	TCPHost       string
	ReplSetName   string

	L             *slog.Logger
	Metrics       *middleware.Metrics
	StateProvider *state.Provider

	SessionCleanupInterval time.Duration
}

NewOpts represents handler configuration.

Directories

Path Synopsis
Package middleware provides connection between listeners and handlers.
Package middleware provides connection between listeners and handlers.
Package session provides access to session registry.
Package session provides access to session registry.

Jump to

Keyboard shortcuts

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