refactor(p0-5): 收敛热度相关注释

背景叙述与历史取舍已写进 `docs/design/hot-ranking.md`,从源码删除。
只保留不变式与安全约束:`clientFoundRows` 禁令、唯一索引判重、
成员补零的排序约定、快照用 `RENAMENX` 只建一次、`EXPIRE` 失败即删键。

`video_service.go` 的 `NewVideoService` 注释原本复述已删方法的来历,一并收敛。
`zset.go` 的 `ZUnionStore` 与 `RenameNX` 注释各压到四行以内。

验证:go build ./... 通过。
验证:go vet ./... 通过。
验证:go test -count=1 ./... 全绿(本机无 cgo,未跑 -race)。
验证:go test -tags integration -p 1 -count=1 ./internal/feed/ ./internal/video/ ./internal/worker/ 全绿。
This commit is contained in:
2026-11-01 16:47:31 +08:00
parent 006ec5f196
commit d782ccbb53
16 changed files with 74 additions and 132 deletions

View File

@@ -14,14 +14,13 @@ type Mention struct {
}
type CommentStore interface {
// CreateIdempotentWithPopularity 在同一事务内插入评论并给热度加 delta。
// CreateIdempotentWithPopularity 同事务插入评论并给热度加 delta;
// created=false 表示该意图已落库,调用方不得再加热度。
CreateIdempotentWithPopularity(ctx context.Context, c *Comment, delta int64) (created bool, err error)
GetByID(ctx context.Context, id uint) (*Comment, error)
// DeleteWithPopularity 在同一事务内删除评论并向热度 -1。
// 返回被删的行(拿 created_at 落桶);deleted=false 表示空操作。
// DeleteWithPopularity 同事务删除评论并给热度 -1,返回被删的行。
DeleteWithPopularity(ctx context.Context, id uint) (row *Comment, deleted bool, err error)
GetAllComments(ctx context.Context, videoID uint) ([]Comment, error)