返回 DeepSeek-Reasonix
backend.go
根目录 / internal / skill / skillwatch / backend.go
1 package skillwatch
2
3 import (
4 "errors"
5 "io"
6 )
7
8 // errHelperStopped reports a helper backend that cannot serve registrations:
9 // process dead and out of restart budget, or never started.
10 var errHelperStopped = errors.New("watch helper stopped")
11
12 // helperProcess is the minimal process handle the helper client needs; it
13 // exists so tests can inject a re-exec without depending on os/exec here.
14 type helperProcess interface {
15 Stdin() io.Writer
16 Stdout() io.Reader
17 Wait() error
18 Kill() error
19 }
20
21 // backend abstracts the physical watch mechanism. register may block (the
22 // helper path waits for the pipe round trip), so the service always calls it
23 // from its own goroutine; cancel is fire-and-forget and close is terminal.
24 type backend interface {
25 register(id, rootGen uint64, root string, dirs []string) error
26 cancel(id uint64)
27 close() error
28 physicalWatches() uint64
29 }
30
30 lines GO