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(ctx 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(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgBuildInfo(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCollMod(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCollStats(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCompact(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgConnectionStatus(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCount(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCreate(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCreateIndexes(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCreateUser(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgCurrentOp(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDBStats(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDataSize(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDebugError(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDelete(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDistinct(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDrop(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDropAllUsersFromDatabase(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDropDatabase(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDropIndexes(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgDropUser(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgExplain(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgFind(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgFindAndModify(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgGetCmdLineOpts(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgGetFreeMonitoringStatus(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgGetLog(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgGetMore(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgGetParameter(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgHello(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgHostInfo(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgInsert(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgIsMaster(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgKillCursors(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgListCollections(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgListCommands(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgListDatabases(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgListIndexes(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgLogout(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgPing(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgRenameCollection(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgSASLStart(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgServerStatus(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgSetFreeMonitoring(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgUpdate(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgUpdateUser(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgUsersInfo(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgValidate(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgWhatsMyURI(ctx 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) Collect ¶
func (h *Handler) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector interface.
func (*Handler) Describe ¶
func (h *Handler) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector interface.
func (*Handler) MsgAggregate ¶
MsgAggregate implements `aggregate` command.
func (*Handler) MsgBuildInfo ¶
MsgBuildInfo implements `buildInfo` command.
func (*Handler) MsgCollMod ¶
MsgCollMod implements `collMod` command.
func (*Handler) MsgCollStats ¶
MsgCollStats implements `collStats` command.
func (*Handler) MsgCompact ¶
MsgCompact implements `compact` command.
func (*Handler) MsgConnectionStatus ¶
MsgConnectionStatus implements `connectionStatus` command.
func (*Handler) MsgCreateIndexes ¶
MsgCreateIndexes implements `createIndexes` command.
func (*Handler) MsgCreateUser ¶
MsgCreateUser implements `createUser` command.
func (*Handler) MsgCurrentOp ¶
MsgCurrentOp implements `currentOp` command.
func (*Handler) MsgDBStats ¶
MsgDBStats implements `dbStats` command.
func (*Handler) MsgDataSize ¶
MsgDataSize implements `dataSize` command.
func (*Handler) MsgDebugError ¶
MsgDebugError implements `debugError` command.
func (*Handler) MsgDistinct ¶
MsgDistinct implements `distinct` command.
func (*Handler) MsgDropAllUsersFromDatabase ¶
func (h *Handler) MsgDropAllUsersFromDatabase(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
MsgDropAllUsersFromDatabase implements `dropAllUsersFromDatabase` command.
func (*Handler) MsgDropDatabase ¶
MsgDropDatabase implements `dropDatabase` command.
func (*Handler) MsgDropIndexes ¶
MsgDropIndexes implements `dropIndexes` command.
func (*Handler) MsgDropUser ¶
MsgDropUser implements `dropUser` command.
func (*Handler) MsgExplain ¶
MsgExplain implements `explain` command.
func (*Handler) MsgFindAndModify ¶
MsgFindAndModify implements `findAndModify` command.
func (*Handler) MsgGetCmdLineOpts ¶
MsgGetCmdLineOpts implements `getCmdLineOpts` command.
func (*Handler) MsgGetFreeMonitoringStatus ¶
func (h *Handler) MsgGetFreeMonitoringStatus(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
MsgGetFreeMonitoringStatus implements `getFreeMonitoringStatus` command.
func (*Handler) MsgGetMore ¶
MsgGetMore implements `getMore` command.
func (*Handler) MsgGetParameter ¶
MsgGetParameter implements `getParameter` command.
func (*Handler) MsgHostInfo ¶
MsgHostInfo implements `hostInfo` command.
func (*Handler) MsgIsMaster ¶
MsgIsMaster implements `isMaster` command.
func (*Handler) MsgKillCursors ¶
MsgKillCursors implements `killCursors` command.
func (*Handler) MsgListCollections ¶
MsgListCollections implements `listCollections` command.
func (*Handler) MsgListCommands ¶
MsgListCommands implements `listCommands` command.
func (*Handler) MsgListDatabases ¶
MsgListDatabases implements `listDatabases` command.
func (*Handler) MsgListIndexes ¶
MsgListIndexes implements `listIndexes` command.
func (*Handler) MsgRenameCollection ¶
MsgRenameCollection implements `renameCollection` command.
func (*Handler) MsgSASLStart ¶
MsgSASLStart implements `saslStart` command.
func (*Handler) MsgServerStatus ¶
MsgServerStatus implements `serverStatus` command.
func (*Handler) MsgSetFreeMonitoring ¶
MsgSetFreeMonitoring implements `setFreeMonitoring` command.
func (*Handler) MsgUpdateUser ¶
MsgUpdateUser implements `updateUser` command.
func (*Handler) MsgUsersInfo ¶
MsgUsersInfo implements `usersInfo` command.
func (*Handler) MsgValidate ¶
MsgValidate implements `validate` command.
type NewOpts ¶
type NewOpts struct { Backend backends.Backend TCPHost string ReplSetName string L *zap.Logger ConnMetrics *connmetrics.ConnMetrics StateProvider *state.Provider // test options DisablePushdown bool CappedCleanupInterval time.Duration CappedCleanupPercentage uint8 EnableNewAuth bool }
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_saslstart.go
- msg_serverstatus.go
- msg_setfreemonitoring.go
- msg_update.go
- msg_updateuser.go
- msg_usersinfo.go
- msg_validate.go
- msg_whatsmyuri.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. |