Documentation
¶
Index ¶
- func SupportedCommands(context.Context, *wire.OpMsg) (*wire.OpMsg, error)
- type Handler
- func (h *Handler) Handle(ctx context.Context, reqHeader *wire.MsgHeader, reqBody wire.MsgBody) (resHeader *wire.MsgHeader, resBody wire.MsgBody, closeConn bool)
- func (h *Handler) MsgAuthenticate(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) MsgConnectionStatus(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) MsgDBStats(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) MsgDropDatabase(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgGetLastError(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) 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) MsgListCollections(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) MsgPing(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) MsgRolesInfo(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) MsgWhatsMyURI(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg, error)
- func (h *Handler) QueryCmd(ctx context.Context, query *wire.OpQuery) (*wire.OpReply, error)
- type Metrics
- type NewOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) Handle ¶
func (h *Handler) Handle(ctx context.Context, reqHeader *wire.MsgHeader, reqBody wire.MsgBody) (resHeader *wire.MsgHeader, resBody wire.MsgBody, closeConn bool)
Handle handles the message.
Message handlers should:
- return normal response body;
- return protocol error (*common.Error) - it will be returned to the client;
- return any other error - it will be returned to the client as InternalError before terminating connection;
- panic - that will terminate the connection without a response.
func (*Handler) MsgAuthenticate ¶
MsgAuthenticate is so far only used for the authentication needed by MongoDB drivers when using tls. Since username and password is so far not implemented, MsgAuthenticate sends ok: 1 no matter what.
func (*Handler) MsgBuildInfo ¶
MsgBuildInfo returns an OpMsg with the build information.
func (*Handler) MsgConnectionStatus ¶
MsgConnectionStatus is a common implementation of the connectionStatus command. Is a workaround to make it possible to connect and use GUI's like Studio 3T.
func (*Handler) MsgCreate ¶
MsgCreate adds a collection and if the database is not created yet, it also creates a schema.
func (*Handler) MsgDBStats ¶
Is a workaround to make it possible to connect and use GUI's like Studio 3T.
func (*Handler) MsgDropDatabase ¶
MsgDropDatabase removes the current database.
func (*Handler) MsgGetLastError ¶
MsgGetLastError is an implementation of the command getlasterror. Is a workaround to make it possible to connect and use GUI's like Studio 3T.
func (*Handler) MsgGetLog ¶
MsgGetLog is an administrative command that returns the most recent 1024 logged events.
func (*Handler) MsgHostInfo ¶
MsgHostInfo returns an OpMsg with the host information.
func (*Handler) MsgListCollections ¶
MsgListCollections retrieves information (i.e. the name and options) about the collections and views in a database.
func (*Handler) MsgListDatabases ¶
MsgListDatabases command provides a list of all existing databases along with basic statistics about them.
func (*Handler) MsgPing ¶
MsgPing OpMsg containing a ping, used to test whether a server is responding to commands.
func (*Handler) MsgRolesInfo ¶
MsgRolesinfo returns information about the given roles. Is a workaround to make it possible to connect and use GUI's like Studio 3T.
func (*Handler) MsgUsersInfo ¶
MsgUsersInfo returns information about users. Is a workaround to make it possible to connect and use GUI's like Studio 3T.
func (*Handler) MsgWhatsMyURI ¶
MsgWhatsMyURI is an internal command, returns the peerAddress of the handler.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics represents handler metrics.
func (*Metrics) Collect ¶
func (lm *Metrics) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*Metrics) Describe ¶
func (lm *Metrics) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.
Source Files
¶
- command.go
- handler.go
- handler_metrics.go
- msg_authenticate.go
- msg_buildinfo.go
- msg_collstats.go
- msg_connectionstatus.go
- msg_create.go
- msg_datasize.go
- msg_dbstats.go
- msg_drop.go
- msg_dropdatabase.go
- msg_getcmdlineopts.go
- msg_getlasterror.go
- msg_getlog.go
- msg_getparameter.go
- msg_hello.go
- msg_hostinfo.go
- msg_listcollections.go
- msg_listdatabases.go
- msg_ping.go
- msg_rolesinfo.go
- msg_serverstatus.go
- msg_usersinfo.go
- msg_whatsmyuri.go
- query_cmd.go