refactor: ponytail-audit cuts — dead Windows Publish stub + dedup Daemon iface 🧹
Repo-wide audit (per request) came back lean — no dead exports, no reinvented stdlib. Two real cuts: - delete the Windows control.Server.Publish no-op: Publish was removed from the real server when /events was trimmed, so nothing calls it. - move the control.Daemon interface into shared control.go (was duplicated across server.go + server_windows.go build-tag split → drift risk). Kept (disagreed with cutting): blobstore.Store interface is the documented M9 S3 seam (6 lines, clean contract); c.Bearer() is a tiny test accessor.
This commit is contained in:
parent
81fbc5c81a
commit
3213149974
3 changed files with 10 additions and 19 deletions
|
|
@ -41,6 +41,16 @@ type MountState struct {
|
|||
BaseSnapshot string `json:"base_snapshot"`
|
||||
}
|
||||
|
||||
// Daemon is the slice of the running daemon the control server steers. The
|
||||
// daemon package implements it; declared here (not in the build-tagged server
|
||||
// files) so the real server and the Windows stub share one definition and can't
|
||||
// drift. The server depends on this behaviour, not the daemon package — no cycle.
|
||||
type Daemon interface {
|
||||
StateSnapshot() State // live per-mount + paused view for GET /state
|
||||
Pause() // stop syncing until resumed
|
||||
Resume() // clear pause + catch up all mounts
|
||||
}
|
||||
|
||||
// ErrNotRunning is returned by the client helpers when the control socket is
|
||||
// absent or unreachable — i.e. the daemon isn't running — so callers can fall
|
||||
// back to disk-based behaviour instead of treating it as a hard error.
|
||||
|
|
|
|||
|
|
@ -11,15 +11,6 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
// Daemon is the slice of the running daemon the control server steers. The
|
||||
// daemon package implements it; kept here so the server depends on a behaviour,
|
||||
// not on the daemon package (no import cycle).
|
||||
type Daemon interface {
|
||||
StateSnapshot() State // live per-mount + paused view for GET /state
|
||||
Pause() // stop syncing until resumed
|
||||
Resume() // clear pause + catch up all mounts
|
||||
}
|
||||
|
||||
// Server hosts the control API on a Unix socket. The zero value is unusable;
|
||||
// build one with Serve.
|
||||
type Server struct {
|
||||
|
|
|
|||
|
|
@ -13,13 +13,6 @@ import (
|
|||
// net.Listen("unix", …) in server.go for winio.ListenPipe and the client's
|
||||
// net.Dial for winio.DialPipe. Until a Windows user exists, we don't build it.
|
||||
|
||||
// Daemon is the slice of the running daemon the control server would steer.
|
||||
type Daemon interface {
|
||||
StateSnapshot() State
|
||||
Pause()
|
||||
Resume()
|
||||
}
|
||||
|
||||
// Server is a no-op on Windows.
|
||||
type Server struct{}
|
||||
|
||||
|
|
@ -28,6 +21,3 @@ type Server struct{}
|
|||
func Serve(_ context.Context, _ string, _ Daemon, _ func(string, ...any)) (*Server, error) {
|
||||
return nil, errors.New("control socket not supported on windows yet")
|
||||
}
|
||||
|
||||
// Publish is a no-op on Windows.
|
||||
func (s *Server) Publish(_, _ string) {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue