Documentation
¶
Overview ¶
Package pgbroker 是 taskgate 的 PostgreSQL 后端:database/sql + pgx(stdlib 模式,纯 Go 免 cgo)。 只是薄壳——把 PG 方言注入共享核心 internal/sqlbroker,认领互斥靠 FOR UPDATE SKIP LOCKED (要求 PostgreSQL 9.5+),语义与 sqlite 后端完全对齐,过 brokertest 18 条契约(env 门控)。
已知限制见 docs:跨进程新任务感知延迟 = 轮询间隔(默认 200ms,可调);不提供分布式限流 (LimiterProvider 不实现,scheduler 自动退回进程内限流);未实现 LISTEN/NOTIFY 即时唤醒。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*Options)
Option 函数式选项。
func WithMaxOpenConns ¶
WithMaxOpenConns 设置连接池上限(防阻塞轮询打爆 max_connections)。
func WithPollInterval ¶
WithPollInterval 设置 Dequeue 兜底轮询间隔(跨进程新任务感知延迟)。
func WithTablePrefix ¶
WithTablePrefix 设置表名/索引名前缀(多应用共享同一 PG 库时隔离)。
type Options ¶
type Options struct {
TablePrefix string `yaml:"table_prefix" json:"table_prefix"` // 默认 "taskgate_"
MaxOpenConns int `yaml:"max_open_conns" json:"max_open_conns"` // 默认 10
PollInterval time.Duration `yaml:"poll_interval" json:"poll_interval"` // 默认 200ms
}
Options pgbroker 的可选配置,字段带 tag 供应用自己 unmarshal(库内不读环境变量,宪法 I)。
Click to show internal directories.
Click to hide internal directories.