feat(shipote): throughput + stats persistente + auth peer (fase P)
- FlowMeter (atomic u64 + rolling window 32 samples) en cada FlowChannel. flow_throughput() → (socket, bytes_total, bytes_per_sec). CLI: shipote flow throughput. Idle threshold 5s = rate 0.0. - Snapshot v4 con stats_history persistente por workspace (cap 16). PersistedStats separado para evitar Instant. Restore hidrata el VecDeque con source="persisted". - Auth SO_PEERCRED: daemon rechaza peers con uid distinto al propio. SHIPOTE_TRUST_ANYONE=1 = escape hatch documentado. 84 tests pasan (ente-incarnate 16, nouser-core 27, shipote-card 8, shipote-core 25, shipote-discern 5, yahweh-provider-fs 3). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -442,6 +442,22 @@ impl WorkspaceManager {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Throughput per-socket: bytes_total + bytes_per_sec por flow socket.
|
||||
pub async fn flow_throughput(&self) -> Vec<(std::path::PathBuf, u64, f64)> {
|
||||
let g = self.inner.lock().await;
|
||||
let mut out = Vec::new();
|
||||
for flows in g.pipeline_flows.values() {
|
||||
for fc in flows {
|
||||
out.push((
|
||||
fc.socket_path().to_path_buf(),
|
||||
fc.meter().total_bytes(),
|
||||
fc.meter().bytes_per_sec(),
|
||||
));
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Cierra el data plane de un pipeline (drop = remove_file de sockets).
|
||||
pub async fn drop_pipeline_flows(&self, pipeline: Ulid) -> bool {
|
||||
self.inner.lock().await.pipeline_flows.remove(&pipeline).is_some()
|
||||
|
||||
Reference in New Issue
Block a user