Documentation
¶
Overview ¶
Package handler provides a universal handler implementation for all backends.
Index ¶
- func WriteErrorDocument(we *mongo.WriteError) *types.Document
- type Handler
- func (h *Handler) Close()
- func (h *Handler) CmdQuery(connCtx context.Context, query *wire.OpQuery) (*wire.OpReply, error)
- func (h *Handler) Collect(ch chan<- prometheus.Metric)
- func (h *Handler) Commands() map[string]*command
- func (h *Handler) Describe(ch chan<- *prometheus.Desc)
- func (h *Handler) MsgAggregate(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgBuildInfo(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCollMod(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCollStats(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCompact(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgConnectionStatus(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCount(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCreate(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCreateIndexes(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCreateUser(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCurrentOp(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDBStats(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDataSize(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDebugError(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDelete(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDistinct(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDrop(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDropAllUsersFromDatabase(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDropDatabase(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDropIndexes(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDropUser(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgExplain(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgFind(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgFindAndModify(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgGetCmdLineOpts(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgGetFreeMonitoringStatus(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgGetLog(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgGetMore(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgGetParameter(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgHello(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgHostInfo(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgInsert(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgIsMaster(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgKillCursors(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgListCollections(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgListCommands(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgListDatabases(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgListIndexes(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgLogout(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgPing(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgRenameCollection(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgSASLContinue(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgSASLStart(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgServerStatus(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgSetFreeMonitoring(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgUpdate(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgUpdateUser(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgUsersInfo(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgValidate(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgWhatsMyURI(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- type NewOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteErrorDocument ¶
func WriteErrorDocument(we *mongo.WriteError) *types.Document
WriteErrorDocument returns a document representation of the write error.
Find a better place for this function. TODO https://github.com/FerretDB/FerretDB/issues/3263
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.
MsgXXX methods handle OP_MSG commands. CmdQuery handles a limited subset of OP_QUERY messages.
Handler instance is shared between all client connections.
func (*Handler) Close ¶
func (h *Handler) Close()
Close gracefully shutdowns handler. It should be called after listener closes all client connections and stops listening.
func (*Handler) CmdQuery ¶
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) MsgAggregate ¶
MsgAggregate implements `aggregate` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgBuildInfo ¶
MsgBuildInfo implements `buildInfo` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgCollMod ¶
MsgCollMod implements `collMod` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgCollStats ¶
MsgCollStats implements `collStats` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgCompact ¶
MsgCompact implements `compact` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgConnectionStatus ¶
func (h *Handler) MsgConnectionStatus(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
MsgConnectionStatus implements `connectionStatus` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgCount ¶
MsgCount implements `count` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgCreate ¶
MsgCreate implements `create` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgCreateIndexes ¶
MsgCreateIndexes implements `createIndexes` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgCreateUser ¶
MsgCreateUser implements `createUser` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgCurrentOp ¶
MsgCurrentOp implements `currentOp` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgDBStats ¶
MsgDBStats implements `dbStats` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgDataSize ¶
MsgDataSize implements `dataSize` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgDebugError ¶
MsgDebugError implements `debugError` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgDelete ¶
MsgDelete implements `delete` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgDistinct ¶
MsgDistinct implements `distinct` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgDrop ¶
MsgDrop implements `drop` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgDropAllUsersFromDatabase ¶
func (h *Handler) MsgDropAllUsersFromDatabase(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
MsgDropAllUsersFromDatabase implements `dropAllUsersFromDatabase` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgDropDatabase ¶
MsgDropDatabase implements `dropDatabase` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgDropIndexes ¶
MsgDropIndexes implements `dropIndexes` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgDropUser ¶
MsgDropUser implements `dropUser` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgExplain ¶
MsgExplain implements `explain` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgFind ¶
MsgFind implements `find` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgFindAndModify ¶
MsgFindAndModify implements `findAndModify` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgGetCmdLineOpts ¶
MsgGetCmdLineOpts implements `getCmdLineOpts` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgGetFreeMonitoringStatus ¶
func (h *Handler) MsgGetFreeMonitoringStatus(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
MsgGetFreeMonitoringStatus implements `getFreeMonitoringStatus` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgGetLog ¶
MsgGetLog implements `getLog` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgGetMore ¶
MsgGetMore implements `getMore` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgGetParameter ¶
MsgGetParameter implements `getParameter` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgHello ¶
MsgHello implements `hello` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgHostInfo ¶
MsgHostInfo implements `hostInfo` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgInsert ¶
MsgInsert implements `insert` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgIsMaster ¶
MsgIsMaster implements `isMaster` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgKillCursors ¶
MsgKillCursors implements `killCursors` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgListCollections ¶
MsgListCollections implements `listCollections` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgListCommands ¶
MsgListCommands implements `listCommands` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgListDatabases ¶
MsgListDatabases implements `listDatabases` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgListIndexes ¶
MsgListIndexes implements `listIndexes` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgLogout ¶
MsgLogout implements `logout` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgPing ¶
MsgPing implements `ping` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgRenameCollection ¶
func (h *Handler) MsgRenameCollection(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
MsgRenameCollection implements `renameCollection` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgSASLContinue ¶ added in v1.20.0
MsgSASLContinue implements `saslContinue` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgSASLStart ¶
MsgSASLStart implements `saslStart` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgServerStatus ¶
MsgServerStatus implements `serverStatus` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgSetFreeMonitoring ¶
func (h *Handler) MsgSetFreeMonitoring(connCtx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
MsgSetFreeMonitoring implements `setFreeMonitoring` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgUpdate ¶
MsgUpdate implements `update` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgUpdateUser ¶
MsgUpdateUser implements `updateUser` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgUsersInfo ¶
MsgUsersInfo implements `usersInfo` command.
The passed context is canceled when the client connection is closed.
func (*Handler) MsgValidate ¶
MsgValidate implements `validate` command.
The passed context is canceled when the client connection is closed.
type NewOpts ¶
type NewOpts struct {
Backend backends.Backend
TCPHost string
ReplSetName string
SetupDatabase string
SetupUsername string
SetupPassword password.Password
SetupTimeout time.Duration
L *slog.Logger
ConnMetrics *connmetrics.ConnMetrics
StateProvider *state.Provider
// test options
DisablePushdown bool
EnableNestedPushdown bool
CappedCleanupInterval time.Duration
CappedCleanupPercentage uint8
EnableNewAuth bool
BatchSize int
MaxBsonObjectSizeBytes int
}
NewOpts represents handler configuration.
Source Files
¶
- cmd_query.go
- commands.go
- handler.go
- msg_aggregate.go
- msg_buildinfo.go
- msg_collmod.go
- msg_collstats.go
- msg_compact.go
- msg_connectionstatus.go
- msg_count.go
- msg_create.go
- msg_createindexes.go
- msg_createuser.go
- msg_currentop.go
- msg_datasize.go
- msg_dbstats.go
- msg_debugerror.go
- msg_delete.go
- msg_distinct.go
- msg_drop.go
- msg_dropallusersfromdatabase.go
- msg_dropdatabase.go
- msg_dropindexes.go
- msg_dropuser.go
- msg_explain.go
- msg_find.go
- msg_findandmodify.go
- msg_getcmdlineopts.go
- msg_getfreemonitoringstatus.go
- msg_getlog.go
- msg_getmore.go
- msg_getparameter.go
- msg_hello.go
- msg_hostinfo.go
- msg_insert.go
- msg_ismaster.go
- msg_killcursors.go
- msg_listcollections.go
- msg_listcommands.go
- msg_listdatabases.go
- msg_listindexes.go
- msg_logout.go
- msg_ping.go
- msg_renamecollection.go
- msg_saslcontinue.go
- msg_saslstart.go
- msg_serverstatus.go
- msg_setfreemonitoring.go
- msg_update.go
- msg_updateuser.go
- msg_usersinfo.go
- msg_validate.go
- msg_whatsmyuri.go
- wire.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package common contains code used to be shared by different handlers.
|
Package common contains code used to be shared by different 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 commonpath contains functions used for path.
|
Package commonpath contains functions used for path. |
|
Package handlererrors provides handlers errors.
|
Package handlererrors provides handlers errors. |
|
Package handlerparams provides functions for parsing handlers parameters.
|
Package handlerparams provides functions for parsing handlers parameters. |
|
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 users provides helper function for user operations.
|
Package users provides helper function for user operations. |