Documentation
¶
Index ¶
- Constants
- type AuditLogPluginDecoder
- func (decoder *AuditLogPluginDecoder) Decode(reader LineReader) (*Command, error)
- func (decoder *AuditLogPluginDecoder) SetCommandStartTime(t time.Time)
- func (decoder *AuditLogPluginDecoder) SetIDAllocator(alloc *ConnIDAllocator)
- func (decoder *AuditLogPluginDecoder) SetPSCloseStrategy(s PSCloseStrategy)
- type CmdDecoder
- type CmdEncoder
- type Command
- type ConnIDAllocator
- type LineReader
- type NativeDecoder
- type NativeEncoder
- type PSCloseStrategy
Constants ¶
View Source
const ( FormatNative = "native" FormatAuditLogPlugin = "audit_log_plugin" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditLogPluginDecoder ¶
type AuditLogPluginDecoder struct {
// contains filtered or unexported fields
}
func NewAuditLogPluginDecoder ¶
func NewAuditLogPluginDecoder() *AuditLogPluginDecoder
func (*AuditLogPluginDecoder) Decode ¶
func (decoder *AuditLogPluginDecoder) Decode(reader LineReader) (*Command, error)
func (*AuditLogPluginDecoder) SetCommandStartTime ¶
func (decoder *AuditLogPluginDecoder) SetCommandStartTime(t time.Time)
func (*AuditLogPluginDecoder) SetIDAllocator ¶
func (decoder *AuditLogPluginDecoder) SetIDAllocator(alloc *ConnIDAllocator)
func (*AuditLogPluginDecoder) SetPSCloseStrategy ¶
func (decoder *AuditLogPluginDecoder) SetPSCloseStrategy(s PSCloseStrategy)
type CmdDecoder ¶
type CmdDecoder interface {
Decode(reader LineReader) (c *Command, err error)
SetCommandStartTime(t time.Time)
}
func NewCmdDecoder ¶
func NewCmdDecoder(format string) CmdDecoder
type CmdEncoder ¶
func NewCmdEncoder ¶
func NewCmdEncoder(_ string) CmdEncoder
type Command ¶
type Command struct {
PreparedStmt string
// CapturedPsID is the prepared statement ID in capture.
// The Execute command needs to update the prepared statement ID in replay.
CapturedPsID uint32
Params []any
// Payload starts with command type so that replay can reuse this byte array.
Payload []byte
StartTs time.Time
// For audit log plugin, the decoder will allocate a new id to avoid id collision. To make it easier
// to debug, we keep the upstream connection id here to store it in the exception report.
UpstreamConnID uint64
ConnID uint64
Type pnet.Command
// The place in the traffic file, used to report.
FileName string
Line int
// Logged only in audit log.
StmtType string
// Logged only in native log.
Success bool
// contains filtered or unexported fields
}
type ConnIDAllocator ¶
type ConnIDAllocator struct {
// contains filtered or unexported fields
}
ConnIDAllocator allocates connection IDs for new connections. It uses the first 10bits to distinguish different decoders, and the last 54bits are auto-incremented.
func NewConnIDAllocator ¶
func NewConnIDAllocator(decoderID int) (*ConnIDAllocator, error)
NewConnIDAllocator creates a new ConnIDAllocator.
type LineReader ¶
type NativeDecoder ¶
type NativeDecoder struct {
// contains filtered or unexported fields
}
func NewNativeDecoder ¶
func NewNativeDecoder() *NativeDecoder
func (*NativeDecoder) Decode ¶
func (rw *NativeDecoder) Decode(reader LineReader) (c *Command, err error)
func (*NativeDecoder) SetCommandStartTime ¶
func (rw *NativeDecoder) SetCommandStartTime(t time.Time)
type NativeEncoder ¶
type NativeEncoder struct {
}
func NewNativeEncoder ¶
func NewNativeEncoder() *NativeEncoder
type PSCloseStrategy ¶
type PSCloseStrategy string
PSCloseStrategy defines when to close the prepared statements.
const ( // PSCloseStrategyAlways means a prepared statement is closed right after it's executed. PSCloseStrategyAlways PSCloseStrategy = "always" // PSCloseStrategyNever means a prepared statement is never closed. It's re-used if the same statement // occurs again in the connection. PSCloseStrategyNever PSCloseStrategy = "never" // PSCloseStrategyDirected means a prepared statement is closed only when there's close command in the // traffic file. PSCloseStrategyDirected PSCloseStrategy = "directed" )
Click to show internal directories.
Click to hide internal directories.