Documentation
¶
Overview ¶
Package msgproc provides a service for processing of incoming events.
Index ¶
- Constants
- func InitConn(ctx context.Context, dblabClone models.Clone) (*pgxpool.Pool, *pgx.Conn, error)
- type ProcessingConfig
- type ProcessingService
- func (s *ProcessingService) CheckIdleSessions(ctx context.Context)
- func (s *ProcessingService) ProcessAppMentionEvent(incomingMessage models.IncomingMessage)
- func (s *ProcessingService) ProcessMessageEvent(ctx context.Context, incomingMessage models.IncomingMessage)
- func (s *ProcessingService) RestoreSessions(ctx context.Context) error
- func (s *ProcessingService) Users() usermanager.UserList
Constants ¶
const ( HintExplain = "Consider using `explain` command for DML statements. See `help` for details." HintExec = "Consider using `exec` command for DDL statements. See `help` for details." )
Hint messages.
const ( PasswordLength = 16 PasswordMinDigits = 4 PasswordMinSymbols = 0 )
Constants for autogenerated passwords.
const ( CommandExplain = "explain" CommandExec = "exec" CommandReset = "reset" CommandHelp = "help" CommandHypo = "hypo" CommandActivity = "activity" CommandTerminate = "terminate" CommandPlan = "plan" CommandPsqlD = `\d` CommandPsqlDP = `\d+` CommandPsqlDT = `\dt` CommandPsqlDTP = `\dt+` CommandPsqlDI = `\di` CommandPsqlDIP = `\di+` CommandPsqlL = `\l` CommandPsqlLP = `\l+` CommandPsqlDV = `\dv` CommandPsqlDVP = `\dv+` CommandPsqlDM = `\dm` CommandPsqlDMP = `\dm+` )
Constants declare supported commands.
const HelpMessage = "\n• `explain` — analyze your query (SELECT, INSERT, DELETE, UPDATE or WITH) and generate recommendations\n" +
"• `plan` — analyze your query (SELECT, INSERT, DELETE, UPDATE or WITH) without execution\n" +
"• `exec` — execute any query (for example, CREATE INDEX)\n" +
"• `activity` — show currently running sessions in Postgres (states: `active`, `idle in transaction`, `disabled`)\n" +
"• `terminate [pid]` — terminate Postgres backend that has the specified PID.\n" +
"• `reset` — revert the database to the initial state (usually takes less than a minute, :warning: all changes will be lost)\n" +
"• `\\d`, `\\d+`, `\\dt`, `\\dt+`, `\\di`, `\\di+`, `\\l`, `\\l+`, `\\dv`, `\\dv+`, `\\dm`, `\\dm+` — psql meta information commands\n" +
"• `hypo` — create hypothetical indexes using the HypoPG extension\n" +
"• `help` — this message\n\n" +
"• Sessions are fully independent. Feel free to do anything.\n" +
"• The session will be destroyed after the certain amount of time ('idle timeout') of inactivity.\n" +
"• EXPLAIN plans here are expected to be identical to production plans.\n" +
"• The actual timing values may differ from production because actual caches in DB Lab are smaller. " +
"However, the number of bytes and pages/buffers in plans match the production database.\n"
HelpMessage defines available commands provided with the help message.
const MsgSessionStarting = "Starting a new session..."
MsgSessionStarting provides a message for a session start.
const QueryPreviewSize = 400
QueryPreviewSize defines a max preview size of query in message.
const SeparatorEllipsis = "\n[...SKIP...]\n"
SeparatorEllipsis provides a separator for cut messages.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ProcessingConfig ¶
type ProcessingConfig struct { App config.App Platform config.Platform DBLab config.DBLabParams EntOpts definition.EnterpriseOptions Project string }
ProcessingConfig declares a configuration of Processing Service.
type ProcessingService ¶
type ProcessingService struct { DBLab *dblabapi.Client UserManager *usermanager.UserManager // contains filtered or unexported fields }
func NewProcessingService ¶
func NewProcessingService(messengerSvc connection.Messenger, msgValidator connection.MessageValidator, dblab *dblabapi.Client, userSvc *usermanager.UserManager, platform *platform.Client, cfg ProcessingConfig, featurePack *features.Pack) *ProcessingService
NewProcessingService creates a new processing service.
func (*ProcessingService) CheckIdleSessions ¶
func (s *ProcessingService) CheckIdleSessions(ctx context.Context)
CheckIdleSessions checks user idleness sessions and notifies about their finishing.
func (*ProcessingService) ProcessAppMentionEvent ¶
func (s *ProcessingService) ProcessAppMentionEvent(incomingMessage models.IncomingMessage)
ProcessAppMentionEvent replies to an application mention event.
func (*ProcessingService) ProcessMessageEvent ¶
func (s *ProcessingService) ProcessMessageEvent(ctx context.Context, incomingMessage models.IncomingMessage)
ProcessMessageEvent replies to a message.
func (*ProcessingService) RestoreSessions ¶
func (s *ProcessingService) RestoreSessions(ctx context.Context) error
RestoreSessions checks sessions after restart and establishes DB connection.
func (*ProcessingService) Users ¶
func (s *ProcessingService) Users() usermanager.UserList
Users returns all tracked users with session data.