1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//! Peer and service discovery extension traits.
//!
//! Out-of-tree backends (etcd, Consul, custom k8s, …) implement these traits
//! against `velo-ext` and integrate with the Velo runtime without pulling
//! the runtime crate as a build dep.
use Pin;
use Result;
use Stream;
use BoxFuture;
use crate;
// ---------------------------------------------------------------------------
// Peer discovery
// ---------------------------------------------------------------------------
/// Abstraction over peer discovery mechanisms.
///
/// Higher-level crates implement this trait to integrate with concrete discovery
/// backends (e.g., etcd, consul) without pulling those dependencies into the
/// messenger layer.
/// RAII guard that unregisters a peer when dropped or explicitly unregistered.
///
/// Backends implement this trait to provide async cleanup via `unregister()`.
/// Callers that can await should prefer `unregister()` over relying on `Drop`.
// ---------------------------------------------------------------------------
// Service discovery
// ---------------------------------------------------------------------------
/// Event emitted by a service instance watch stream.
/// Abstraction over service discovery mechanisms.
///
/// Maps named services to sets of [`InstanceId`]s. For example, finding all
/// instances that expose a "rhino-router" service. Clients should treat results
/// as best-effort — returned instance IDs may refer to instances that have
/// already departed. The caller is responsible for handling failures when
/// communicating with discovered instances.
/// RAII guard that unregisters a service instance when dropped or explicitly unregistered.
///
/// Backends implement this trait to provide async cleanup via `unregister()`.
/// Callers that can await should prefer `unregister()` over relying on `Drop`.