Documentation
¶
Overview ¶
Package settingssnap 是 settings 全量内存快照的唯一事实源(根因重开): Service 与 MailWorker 同源共享单个 *Snapshot(单指针,无双快照分叉)。 叶子包:仅依赖 domain + logx + 标准库,不 import internal/repository(防环—— SettingsLoader 窄接口由 repos/fakeStore 结构性满足)。
Index ¶
- type SettingsLoader
- type Snapshot
- func (s *Snapshot) Int(key string) int64
- func (s *Snapshot) Load(ctx context.Context) error
- func (s *Snapshot) Log() *logx.Logger
- func (s *Snapshot) MailConfig() (host string, port int, username, password, fromAddr, tlsPolicy string, ok bool)
- func (s *Snapshot) Reload(ctx context.Context) error
- func (s *Snapshot) Value(key string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SettingsLoader ¶
SettingsLoader 窄接口:快照唯一上游。repos 与测试 fake 均已满足。
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot settings 全量内存快照(默认值 + DB 覆盖):公开读路径零 DB 直读; 仅管理面 UpdateSetting / NOTIFY dispatcher 低频重载(无锁,atomic 指针交换)。
func New ¶
func New(store SettingsLoader, log *logx.Logger) *Snapshot
New 构造快照(不加载;调用方 Load 首载,失败 Warn 语义由调用方保持)。
func (*Snapshot) MailConfig ¶
func (s *Snapshot) MailConfig() (host string, port int, username, password, fromAddr, tlsPolicy string, ok bool)
MailConfig 邮件通道配置(7 返回;语义与原 service.mailConfig 逐行一致)。 nil 接收者 → !ok(未配置降级,与旧空快照语义一致)。
Click to show internal directories.
Click to hide internal directories.