handlers

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package handlers provides an interface for all handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface added in v0.3.0

type Interface interface {
	// Close gracefully shutdowns handler.
	// It should be called after listener closes all client connections and stops listening.
	Close()

	prometheus.Collector

	// CmdQuery queries collections for documents.
	// Used by deprecated OP_QUERY message during connection handshake with an old client.
	CmdQuery(ctx context.Context, query *wire.OpQuery) (*wire.OpReply, error)

	// MsgAggregate returns aggregated data.
	MsgAggregate(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgBuildInfo returns a summary of the build information.
	MsgBuildInfo(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgCollMod adds options to a collection or modify view definitions.
	MsgCollMod(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgCollStats returns storage data for a collection.
	MsgCollStats(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgConnectionStatus returns information about the current connection,
	// specifically the state of authenticated users and their available permissions.
	MsgConnectionStatus(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgCount returns the count of documents that's matched by the query.
	MsgCount(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgCreate creates the collection.
	MsgCreate(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgCreateIndexes creates indexes on a collection.
	MsgCreateIndexes(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgCurrentOp returns information about operations currently in progress.
	MsgCurrentOp(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgDataSize returns the size of the collection in bytes.
	MsgDataSize(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgDBStats returns the statistics of the database.
	MsgDBStats(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgDebugError returns error for debugging
	MsgDebugError(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgDelete deletes documents matched by the query.
	MsgDelete(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgDistinct returns an array of distinct values for the given field.
	MsgDistinct(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgDrop drops the collection.
	MsgDrop(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgDropIndexes drops indexes on a collection.
	MsgDropIndexes(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgDropDatabase drops production database.
	MsgDropDatabase(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgExplain returns the execution plan.
	MsgExplain(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgFind returns documents matched by the query.
	MsgFind(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgFindAndModify inserts, updates, or deletes, and returns a document matched by the query.
	MsgFindAndModify(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgGetCmdLineOpts returns a summary of all runtime and configuration options.
	MsgGetCmdLineOpts(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgGetFreeMonitoringStatus returns a status of the free monitoring.
	MsgGetFreeMonitoringStatus(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgGetLog returns the most recent logged events from memory.
	MsgGetLog(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgGetMore returns the next batch of documents from a cursor.
	MsgGetMore(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgGetParameter returns the value of the parameter.
	MsgGetParameter(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgHello returns the role of the FerretDB instance.
	MsgHello(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgHostInfo returns a summary of the system information.
	MsgHostInfo(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgInsert inserts documents into the database.
	MsgInsert(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgIsMaster returns the role of the FerretDB instance.
	MsgIsMaster(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgKillCursors closes server cursors.
	MsgKillCursors(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgListCollections returns the information of the collections and views in the database.
	MsgListCollections(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgListCommands returns a list of supported commands.
	MsgListCommands(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgListDatabases returns a summary of all the databases.
	MsgListDatabases(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgListIndexes returns a summary of indexes of the specified collection.
	MsgListIndexes(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgLogout logs out from the current session
	MsgLogout(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgPing returns a pong response.
	MsgPing(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgRenameCollection changes the name of an existing collection.
	MsgRenameCollection(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgSASLStart starts the SASL authentication process.
	MsgSASLStart(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgServerStatus returns an overview of the databases state.
	MsgServerStatus(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgSetFreeMonitoring toggles free monitoring.
	MsgSetFreeMonitoring(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgUpdate updates documents that are matched by the query.
	MsgUpdate(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgValidate validates collection.
	MsgValidate(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)

	// MsgWhatsMyURI returns peer information.
	MsgWhatsMyURI(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
}

Interface contains methods that should be implemented by all handlers.

Those methods are called to handle clients' requests sent over wire protocol. MsgXXX methods handle OP_MSG commands. CmdQuery handles a limited subset of OP_QUERY messages.

Handlers are shared between all connections! Be careful when you need connection-specific information. Currently, we pass connection information through context, see `ConnInfo` and its usage.

Please keep methods documentation in sync with commands help text in the handlers/common package.

Directories

Path Synopsis
Package common provides common code for all handlers.
Package common provides common code for all handlers.
aggregations
Package aggregations provides aggregation pipelines.
Package aggregations provides aggregation pipelines.
aggregations/operators
Package operators provides aggregation operators.
Package operators provides aggregation operators.
aggregations/operators/accumulators
Package accumulators provides aggregation accumulator operators.
Package accumulators provides aggregation accumulator operators.
aggregations/stages
Package stages provides aggregation stages.
Package stages provides aggregation stages.
aggregations/stages/projection
Package projection provides projection for aggregations.
Package projection provides projection for aggregations.
Package commoncommands provides command handlers shared by all handlers.
Package commoncommands provides command handlers shared by all handlers.
Package commonerrors providers errors shared by all handlers.
Package commonerrors providers errors shared by all handlers.
Package commonparams contains functions for parsing handlers parameters.
Package commonparams contains functions for parsing handlers parameters.
Package commonpath contains functions used for path.
Package commonpath contains functions used for path.
Package hana provides SAP HANA handler.
Package hana provides SAP HANA handler.
hanadb
Package hanadb provides SAP HANA connection utilities.
Package hanadb provides SAP HANA connection utilities.
pg
Package pg provides PostgreSQL handler.
Package pg provides PostgreSQL handler.
pgdb
Package pgdb provides PostgreSQL connection utilities.
Package pgdb provides PostgreSQL connection utilities.
Package proxy sends requests to another wire protocol compatible service.
Package proxy sends requests to another wire protocol compatible service.
Package registry provides a registry of handlers.
Package registry provides a registry of handlers.
Package sjson provides converters from/to jsonb with some extensions for built-in and `types` types.
Package sjson provides converters from/to jsonb with some extensions for built-in and `types` types.
Package sqlite provides SQLite handler.
Package sqlite provides SQLite handler.

Jump to

Keyboard shortcuts

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