Feature: return web-console remarks from the Go MCP host tools
list_hosts and get_host_detail now include the remark an admin set in the web console, and the name/query filters match it like the Win32 server (name: hostname + remark; query: hostname + remark + IP). The text-only host table gains a remark column, and the MCP instructions stop claiming the Go server keeps no remarks. The remark table is injected through a small Note() interface so the mcp package still does not import web. An optional Notes() snapshot capability is borrowed once per call, so a listing neither takes a read lock per device nor mixes labels across a concurrent save. The design docs are updated to match the new fields and table column. Verified: go build ./..., go vet, gofmt and the full go test ./... pass; new tests cover remark projection, both filters and the snapshot path. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
95d2bbc1b6
commit
5f764b2425
8 files changed
+136
-28
No files matched your search
@@ -114,6 +114,22 @@ func (n *DeviceNotes) Note(deviceID string) string {
|
||||
return n.entries[deviceID].Note
|
||||
}
|
||||
|
||||
// Notes returns a copy of the deviceID -> remark map. Callers that look up
|
||||
// many devices in one pass (MCP host listings) take this snapshot instead of a
|
||||
// read lock per device, so a save's fsync cannot stall the whole listing.
|
||||
func (n *DeviceNotes) Notes() map[string]string {
|
||||
if n == nil {
|
||||
return map[string]string{}
|
||||
}
|
||||
n.mu.RLock()
|
||||
defer n.mu.RUnlock()
|
||||
out := make(map[string]string, len(n.entries))
|
||||
for id, e := range n.entries {
|
||||
out[id] = e.Note
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// Snapshot returns a copy of the table (for logs and tests).
|
||||
func (n *DeviceNotes) Snapshot() map[string]DeviceNoteEntry {
|
||||
if n == nil {
|
||||
|
||||
Reference in new issue
Block a user