Documentation
¶
Index ¶
- type BulkSrv
- type BulkSrvImpl
- type CollStatsSrv
- type CollStatsSrvImpl
- type OverviewSrv
- type OverviewSrvImpl
- type PrintSrv
- type PrintSrvImpl
- func (p *PrintSrvImpl) Ahead(uri string)
- func (p *PrintSrvImpl) CollStats(stats mongo.CollStats)
- func (p *PrintSrvImpl) Database(db mongo.DBStats, width int)
- func (p *PrintSrvImpl) Hosts(hosts []string)
- func (p *PrintSrvImpl) OverviewRepl(stats []*model.OverviewStats)
- func (p *PrintSrvImpl) PrintBlankLine()
- func (p *PrintSrvImpl) PrintDashedLine()
- func (p *PrintSrvImpl) PrintHorizontalLine()
- func (p *PrintSrvImpl) Repl(set string)
- func (p *PrintSrvImpl) ShardCollStats(stats mongo.CollStats, showAll bool)
- func (p *PrintSrvImpl) ShardDatabase(db mongo.DBStats, width int)
- func (p *PrintSrvImpl) SingleHost(host string, state mongo.ReplicaState)
- func (p *PrintSrvImpl) SlowDetail(ns, indexes, slow string)
- func (p *PrintSrvImpl) SlowOverView(logs []*mongo.SlowlogView)
- type SlowlogSrv
- type SlowlogSrvImpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BulkSrv ¶
BulkSrv 批量操作服务接口,提供批量删除和批量更新能力。
入参: 无 出参: 无 注意: 实现方需支持优雅退出和错误即停。
func NewBulkSrv ¶
NewBulkSrv 创建批量操作服务实例。
入参: - ctx: 上下文,用于超时与取消 - cfg: 批量操作配置,包含数据库、集合、filter、批次大小等 - conn: MongoDB 连接实例
出参: - BulkSrv: 批量操作服务接口 - error: 参数校验失败时非 nil
注意: 会校验 Database 和 Collection 不能为空。
type BulkSrvImpl ¶
type BulkSrvImpl struct {
// contains filtered or unexported fields
}
BulkSrvImpl BulkSrv 的具体实现。
func (*BulkSrvImpl) Close ¶
func (s *BulkSrvImpl) Close()
Close 关闭 MongoDB 连接。
入参: 无 出参: 无
注意: 幂等操作,conn 为 nil 时不会 panic;关闭失败时打印警告日志。
func (*BulkSrvImpl) Delete ¶
func (s *BulkSrvImpl) Delete() error
Delete 执行批量删除操作。
入参: 无(使用构造时注入的 cfg) 出参: - error: 执行失败或被中断时非 nil
注意: 支持 dry-run 模式仅统计;支持 Ctrl+C 优雅退出;某批次失败立即停止。
func (*BulkSrvImpl) Update ¶
func (s *BulkSrvImpl) Update() error
Update 执行批量更新操作。
入参: 无(使用构造时注入的 cfg) 出参: - error: 执行失败或被中断时非 nil
注意: 支持 dry-run 模式仅统计;支持 Ctrl+C 优雅退出;某批次失败立即停止;
update 字段必须为合法的 MongoDB 更新操作符(如 $set、$unset)。
type CollStatsSrv ¶
func NewCollStatsSrv ¶
func NewCollStatsSrv(ctx context.Context, cfg *config.StatsConfig, conn *mongo.Conn, checkSh bool) (CollStatsSrv, error)
type CollStatsSrvImpl ¶
type CollStatsSrvImpl struct {
// contains filtered or unexported fields
}
func (*CollStatsSrvImpl) Close ¶
func (c *CollStatsSrvImpl) Close()
func (*CollStatsSrvImpl) Stats ¶
func (c *CollStatsSrvImpl) Stats(isSh bool) error
type OverviewSrvImpl ¶
type OverviewSrvImpl struct {
// contains filtered or unexported fields
}
func (*OverviewSrvImpl) Close ¶
func (o *OverviewSrvImpl) Close()
func (*OverviewSrvImpl) GetOverview ¶
func (o *OverviewSrvImpl) GetOverview() error
type PrintSrv ¶
type PrintSrv interface {
Ahead(uri string)
SingleHost(host string, state mongo.ReplicaState)
Hosts(hosts []string)
Repl(set string)
OverviewRepl(stats []*model.OverviewStats)
Database(db mongo.DBStats, width int)
ShardDatabase(db mongo.DBStats, width int)
CollStats(stats mongo.CollStats)
ShardCollStats(stats mongo.CollStats, showAll bool)
SlowOverView(logs []*mongo.SlowlogView)
SlowDetail(ns, indexes, slow string)
PrintBlankLine()
PrintDashedLine()
PrintHorizontalLine()
}
func NewPrintSrv ¶
func NewPrintSrv() PrintSrv
type PrintSrvImpl ¶
type PrintSrvImpl struct {
// contains filtered or unexported fields
}
func (*PrintSrvImpl) Ahead ¶
func (p *PrintSrvImpl) Ahead(uri string)
func (*PrintSrvImpl) CollStats ¶
func (p *PrintSrvImpl) CollStats(stats mongo.CollStats)
func (*PrintSrvImpl) Hosts ¶
func (p *PrintSrvImpl) Hosts(hosts []string)
func (*PrintSrvImpl) OverviewRepl ¶
func (p *PrintSrvImpl) OverviewRepl(stats []*model.OverviewStats)
func (*PrintSrvImpl) PrintBlankLine ¶
func (p *PrintSrvImpl) PrintBlankLine()
func (*PrintSrvImpl) PrintDashedLine ¶
func (p *PrintSrvImpl) PrintDashedLine()
func (*PrintSrvImpl) PrintHorizontalLine ¶
func (p *PrintSrvImpl) PrintHorizontalLine()
func (*PrintSrvImpl) Repl ¶
func (p *PrintSrvImpl) Repl(set string)
func (*PrintSrvImpl) ShardCollStats ¶
func (p *PrintSrvImpl) ShardCollStats(stats mongo.CollStats, showAll bool)
func (*PrintSrvImpl) ShardDatabase ¶
func (p *PrintSrvImpl) ShardDatabase(db mongo.DBStats, width int)
func (*PrintSrvImpl) SingleHost ¶
func (p *PrintSrvImpl) SingleHost(host string, state mongo.ReplicaState)
func (*PrintSrvImpl) SlowDetail ¶
func (p *PrintSrvImpl) SlowDetail(ns, indexes, slow string)
func (*PrintSrvImpl) SlowOverView ¶
func (p *PrintSrvImpl) SlowOverView(logs []*mongo.SlowlogView)
type SlowlogSrv ¶
func NewSlowlogSrv ¶
func NewSlowlogSrv(ctx context.Context, cfg *config.SlowlogConfig, conn *mongo.Conn) (SlowlogSrv, error)
type SlowlogSrvImpl ¶
func (*SlowlogSrvImpl) Close ¶
func (s *SlowlogSrvImpl) Close()
func (*SlowlogSrvImpl) GetOverview ¶
func (s *SlowlogSrvImpl) GetOverview() error
func (*SlowlogSrvImpl) GetSlowDetail ¶
func (s *SlowlogSrvImpl) GetSlowDetail() error
Click to show internal directories.
Click to hide internal directories.