pub struct DrainArgs {
pub admin_url: Option<String>,
pub config: Option<PathBuf>,
pub json: bool,
pub timeout_ms: u64,
pub wait: bool,
pub wait_timeout_secs: NonZeroU64,
pub wait_poll_ms: NonZeroU64,
}Expand description
decdn node drain — trigger graceful shutdown of the running node via
admin_v1_drain (issue #244, adr/appendix-local-admin-http.md). Fires the same runtime shutdown
path as SIGTERM without needing the process PID.
Without --wait, the command is fire-and-forget: it returns
drain_initiated=true as soon as the trigger lands and the admin
server begins its early-stop sequence (metrics, then admin, both
before router.shutdown). The connection will close before the
node fully exits — observe completion via process exit
(systemd/K8s) or decdn node health until ECONNREFUSED.
Pass --wait (issue #604) to opt the runtime into keeping the
admin server alive through router.shutdown and have the CLI
poll admin_v1_health.in_flight_streams until it reaches 0 (or
the wait budget expires). On a clean drain the command returns
success once the count is zero; on overrun it prints
drain_timeout=true in_flight_streams=N to stderr and exits
non-zero so operator scripts can fail closed during a stuck
rolling upgrade.
Fields§
§admin_url: Option<String>Base URL of the node’s admin HTTP surface. See health --admin-url
for resolution precedence (flag → env → config → default).
config: Option<PathBuf>Path to the TOML config file used to derive the admin URL when
--admin-url / DECDN_ADMIN_URL are unset.
json: boolEmit the admin response as JSON instead of a one-line confirmation.
timeout_ms: u64Roundtrip timeout in milliseconds for each individual RPC
(the initial drain call and each poll under --wait).
wait: boolBlock until all in-flight client streams complete (or the wait
budget expires) before returning. Opt-in seam for #604: when set,
the server keeps admin alive through router.shutdown so the CLI
can poll admin_v1_health.in_flight_streams to observe
completion. Without it, the original SIGTERM-equivalent
ordering applies.
wait_timeout_secs: NonZeroU64Wall-clock budget (seconds) for the --wait polling loop. On
overrun the CLI exits non-zero and prints drain_timeout=true.
Ignored without --wait. Default 30s covers the runtime’s 15s
SHUTDOWN_DEADLINE plus typical settle time. NonZeroU64 so
clap rejects 0 at parse time — a zero-second budget would
deadline-overrun on the first iteration with no signal of why.
wait_poll_ms: NonZeroU64Cadence (milliseconds) at which --wait polls
admin_v1_health. Lower values converge faster on short
drains; higher values reduce admin churn on long ones. Ignored
without --wait. NonZeroU64 so clap rejects 0 at parse
time — a zero-millisecond poll interval would spin a busy loop
against the loopback admin port.
Trait Implementations§
Source§impl Args for DrainArgs
impl Args for DrainArgs
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl FromArgMatches for DrainArgs
impl FromArgMatches for DrainArgs
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Auto Trait Implementations§
impl Freeze for DrainArgs
impl RefUnwindSafe for DrainArgs
impl Send for DrainArgs
impl Sync for DrainArgs
impl Unpin for DrainArgs
impl UnsafeUnpin for DrainArgs
impl UnwindSafe for DrainArgs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more