Add "uptime" debug command

This commit is contained in:
neequ57 2024-10-19 15:18:26 +00:00 committed by Christien Rioux
parent 3625225014
commit 52ac599008
10 changed files with 379 additions and 85 deletions

View File

@ -246,3 +246,23 @@ of the build steps configured, consult the `Earthfile`, or you may use the
```shell ```shell
earthly ls earthly ls
``` ```
## Updating bindings
When changing Veilid API, bindings must be updated to reflect the changes.
For each language, perform the listed steps and commit changed files.
### Dart
1. Update sources in `veilid-flutter/lib`, ignoring `*.freezed.*` and `*.g.*`
2. Run `dart run build_runner build` inside `veilid-flutter`, allow to delete existing files if asked
### Python
1. Run `cargo build --bin=veilid-server`
2. Run `./veilid-python/update_schema.sh`
3. Update sources in `veilid-python/veilid`
### WASM
1. Update sources in `veilid-wasm/src`

View File

@ -8,6 +8,7 @@ struct AttachmentManagerInner {
last_attachment_state: AttachmentState, last_attachment_state: AttachmentState,
last_routing_table_health: Option<RoutingTableHealth>, last_routing_table_health: Option<RoutingTableHealth>,
maintain_peers: bool, maintain_peers: bool,
started_ts: Timestamp,
attach_ts: Option<Timestamp>, attach_ts: Option<Timestamp>,
update_callback: Option<UpdateCallback>, update_callback: Option<UpdateCallback>,
attachment_maintainer_jh: Option<MustJoinHandle<()>>, attachment_maintainer_jh: Option<MustJoinHandle<()>>,
@ -49,6 +50,7 @@ impl AttachmentManager {
last_attachment_state: AttachmentState::Detached, last_attachment_state: AttachmentState::Detached,
last_routing_table_health: None, last_routing_table_health: None,
maintain_peers: false, maintain_peers: false,
started_ts: Timestamp::now(),
attach_ts: None, attach_ts: None,
update_callback: None, update_callback: None,
attachment_maintainer_jh: None, attachment_maintainer_jh: None,
@ -177,6 +179,9 @@ impl AttachmentManager {
} }
fn update_attaching_detaching_state(&self, state: AttachmentState) { fn update_attaching_detaching_state(&self, state: AttachmentState) {
let uptime;
let attached_uptime;
let update_callback = { let update_callback = {
let mut inner = self.inner.lock(); let mut inner = self.inner.lock();
@ -197,6 +202,10 @@ impl AttachmentManager {
unreachable!("don't use this for attached states, use update_attachment()"); unreachable!("don't use this for attached states, use update_attachment()");
} }
let now = Timestamp::now();
uptime = now - inner.started_ts;
attached_uptime = inner.attach_ts.map(|ts| now - ts);
// Get callback // Get callback
inner.update_callback.clone() inner.update_callback.clone()
}; };
@ -207,6 +216,8 @@ impl AttachmentManager {
state, state,
public_internet_ready: false, public_internet_ready: false,
local_network_ready: false, local_network_ready: false,
uptime,
attached_uptime,
}))) })))
} }
} }
@ -355,6 +366,10 @@ impl AttachmentManager {
// } // }
fn get_veilid_state_inner(inner: &AttachmentManagerInner) -> Box<VeilidStateAttachment> { fn get_veilid_state_inner(inner: &AttachmentManagerInner) -> Box<VeilidStateAttachment> {
let now = Timestamp::now();
let uptime = now - inner.started_ts;
let attached_uptime = inner.attach_ts.map(|ts| now - ts);
Box::new(VeilidStateAttachment { Box::new(VeilidStateAttachment {
state: inner.last_attachment_state, state: inner.last_attachment_state,
public_internet_ready: inner public_internet_ready: inner
@ -367,6 +382,8 @@ impl AttachmentManager {
.as_ref() .as_ref()
.map(|x| x.local_network_ready) .map(|x| x.local_network_ready)
.unwrap_or(false), .unwrap_or(false),
uptime,
attached_uptime,
}) })
} }

View File

@ -7,6 +7,7 @@ use hashlink::LinkedHashMap;
use network_manager::*; use network_manager::*;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use routing_table::*; use routing_table::*;
use std::fmt::Write;
#[derive(Default)] #[derive(Default)]
pub(crate) struct DebugCache { pub(crate) struct DebugCache {
@ -2004,6 +2005,7 @@ impl VeilidAPI {
nodeinfo - display detailed information about this node nodeinfo - display detailed information about this node
dialinfo - display the dialinfo in the routing domains of this node dialinfo - display the dialinfo in the routing domains of this node
peerinfo [routingdomain] [published|current] - display the full PeerInfo for a routing domain of this node peerinfo [routingdomain] [published|current] - display the full PeerInfo for a routing domain of this node
uptime - display node uptime
Routing: Routing:
buckets [dead|reliable] - Display the routing table bucket statistics (default is only non-dead nodes) buckets [dead|reliable] - Display the routing table bucket statistics (default is only non-dead nodes)
@ -2093,6 +2095,24 @@ TableDB Operations:
.to_owned()) .to_owned())
} }
/// Get node uptime info.
pub async fn debug_uptime(&self, _args: String) -> VeilidAPIResult<String> {
let mut result = String::new();
writeln!(result, "Uptime...").ok();
let state = self.get_state().await?;
let uptime = state.attachment.uptime;
writeln!(result, " since launch: {uptime}").ok();
if let Some(attached_uptime) = state.attachment.attached_uptime {
writeln!(result, " since attachment: {attached_uptime}").ok();
}
Ok(result)
}
/// Execute an 'internal debug command'. /// Execute an 'internal debug command'.
pub async fn debug(&self, args: String) -> VeilidAPIResult<String> { pub async fn debug(&self, args: String) -> VeilidAPIResult<String> {
let res = { let res = {
@ -2156,6 +2176,8 @@ TableDB Operations:
self.debug_punish(rest).await self.debug_punish(rest).await
} else if arg == "table" { } else if arg == "table" {
self.debug_table(rest).await self.debug_table(rest).await
} else if arg == "uptime" {
self.debug_uptime(rest).await
} else { } else {
Err(VeilidAPIError::generic("Unknown debug command")) Err(VeilidAPIError::generic("Unknown debug command"))
} }

View File

@ -213,6 +213,8 @@ pub async fn test_veilidstateattachment() {
state: AttachmentState::OverAttached, state: AttachmentState::OverAttached,
public_internet_ready: true, public_internet_ready: true,
local_network_ready: false, local_network_ready: false,
uptime: TimestampDuration::new_secs(10),
attached_uptime: Some(TimestampDuration::new_secs(10)),
}; };
let copy = deserialize_json(&serialize_json(&orig)).unwrap(); let copy = deserialize_json(&serialize_json(&orig)).unwrap();
@ -277,6 +279,8 @@ pub async fn test_veilidstate() {
state: AttachmentState::OverAttached, state: AttachmentState::OverAttached,
public_internet_ready: true, public_internet_ready: true,
local_network_ready: false, local_network_ready: false,
uptime: TimestampDuration::new_secs(900),
attached_uptime: Some(TimestampDuration::new_secs(600)),
}), }),
network: Box::new(VeilidStateNetwork { network: Box::new(VeilidStateNetwork {
started: true, started: true,

View File

@ -73,11 +73,15 @@ impl TryFrom<String> for AttachmentState {
pub struct VeilidStateAttachment { pub struct VeilidStateAttachment {
/// The overall quality of the routing table if attached, or the current state the attachment state machine. /// The overall quality of the routing table if attached, or the current state the attachment state machine.
pub state: AttachmentState, pub state: AttachmentState,
/// If attached and there are enough eachable nodes in the routing table to perform all the actions of the PublicInternet RoutingDomain, /// If attached and there are enough reachable nodes in the routing table to perform all the actions of the PublicInternet RoutingDomain,
/// including things like private/safety route allocation and DHT operations. /// including things like private/safety route allocation and DHT operations.
pub public_internet_ready: bool, pub public_internet_ready: bool,
/// If attached and there are enough eachable nodes in the routing table to perform all the actions of the LocalNetwork RoutingDomain. /// If attached and there are enough reachable nodes in the routing table to perform all the actions of the LocalNetwork RoutingDomain.
pub local_network_ready: bool, pub local_network_ready: bool,
/// Node uptime
pub uptime: TimestampDuration,
/// Uptime since last attach, empty if the node is currently detached
pub attached_uptime: Option<TimestampDuration>,
} }
/// Describe a recently accessed peer /// Describe a recently accessed peer

View File

@ -215,7 +215,9 @@ sealed class VeilidUpdate with _$VeilidUpdate {
const factory VeilidUpdate.attachment( const factory VeilidUpdate.attachment(
{required AttachmentState state, {required AttachmentState state,
required bool publicInternetReady, required bool publicInternetReady,
required bool localNetworkReady}) = VeilidUpdateAttachment; required bool localNetworkReady,
required TimestampDuration uptime,
required TimestampDuration? attachedUptime}) = VeilidUpdateAttachment;
const factory VeilidUpdate.network( const factory VeilidUpdate.network(
{required bool started, {required bool started,
required BigInt bpsDown, required BigInt bpsDown,
@ -247,7 +249,9 @@ class VeilidStateAttachment with _$VeilidStateAttachment {
const factory VeilidStateAttachment( const factory VeilidStateAttachment(
{required AttachmentState state, {required AttachmentState state,
required bool publicInternetReady, required bool publicInternetReady,
required bool localNetworkReady}) = _VeilidStateAttachment; required bool localNetworkReady,
required TimestampDuration uptime,
required TimestampDuration? attachedUptime}) = _VeilidStateAttachment;
factory VeilidStateAttachment.fromJson(dynamic json) => factory VeilidStateAttachment.fromJson(dynamic json) =>
_$VeilidStateAttachmentFromJson(json as Map<String, dynamic>); _$VeilidStateAttachmentFromJson(json as Map<String, dynamic>);

View File

@ -2434,8 +2434,12 @@ mixin _$VeilidUpdate {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId) String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(
bool localNetworkReady) AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)
attachment, attachment,
required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers) List<PeerTableData> peers)
@ -2463,8 +2467,12 @@ mixin _$VeilidUpdate {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -2491,8 +2499,12 @@ mixin _$VeilidUpdate {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -2681,8 +2693,12 @@ class _$VeilidLogImpl implements VeilidLog {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId) String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(
bool localNetworkReady) AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)
attachment, attachment,
required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers) List<PeerTableData> peers)
@ -2713,8 +2729,12 @@ class _$VeilidLogImpl implements VeilidLog {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -2744,8 +2764,12 @@ class _$VeilidLogImpl implements VeilidLog {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -2957,8 +2981,12 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId) String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(
bool localNetworkReady) AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)
attachment, attachment,
required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers) List<PeerTableData> peers)
@ -2989,8 +3017,12 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -3020,8 +3052,12 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -3243,8 +3279,12 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId) String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(
bool localNetworkReady) AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)
attachment, attachment,
required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers) List<PeerTableData> peers)
@ -3275,8 +3315,12 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -3306,8 +3350,12 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -3416,7 +3464,9 @@ abstract class _$$VeilidUpdateAttachmentImplCopyWith<$Res> {
$Res call( $Res call(
{AttachmentState state, {AttachmentState state,
bool publicInternetReady, bool publicInternetReady,
bool localNetworkReady}); bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime});
} }
/// @nodoc /// @nodoc
@ -3436,6 +3486,8 @@ class __$$VeilidUpdateAttachmentImplCopyWithImpl<$Res>
Object? state = null, Object? state = null,
Object? publicInternetReady = null, Object? publicInternetReady = null,
Object? localNetworkReady = null, Object? localNetworkReady = null,
Object? uptime = null,
Object? attachedUptime = freezed,
}) { }) {
return _then(_$VeilidUpdateAttachmentImpl( return _then(_$VeilidUpdateAttachmentImpl(
state: null == state state: null == state
@ -3450,6 +3502,14 @@ class __$$VeilidUpdateAttachmentImplCopyWithImpl<$Res>
? _value.localNetworkReady ? _value.localNetworkReady
: localNetworkReady // ignore: cast_nullable_to_non_nullable : localNetworkReady // ignore: cast_nullable_to_non_nullable
as bool, as bool,
uptime: null == uptime
? _value.uptime
: uptime // ignore: cast_nullable_to_non_nullable
as TimestampDuration,
attachedUptime: freezed == attachedUptime
? _value.attachedUptime
: attachedUptime // ignore: cast_nullable_to_non_nullable
as TimestampDuration?,
)); ));
} }
} }
@ -3461,6 +3521,8 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
{required this.state, {required this.state,
required this.publicInternetReady, required this.publicInternetReady,
required this.localNetworkReady, required this.localNetworkReady,
required this.uptime,
required this.attachedUptime,
final String? $type}) final String? $type})
: $type = $type ?? 'Attachment'; : $type = $type ?? 'Attachment';
@ -3473,13 +3535,17 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
final bool publicInternetReady; final bool publicInternetReady;
@override @override
final bool localNetworkReady; final bool localNetworkReady;
@override
final TimestampDuration uptime;
@override
final TimestampDuration? attachedUptime;
@JsonKey(name: 'kind') @JsonKey(name: 'kind')
final String $type; final String $type;
@override @override
String toString() { String toString() {
return 'VeilidUpdate.attachment(state: $state, publicInternetReady: $publicInternetReady, localNetworkReady: $localNetworkReady)'; return 'VeilidUpdate.attachment(state: $state, publicInternetReady: $publicInternetReady, localNetworkReady: $localNetworkReady, uptime: $uptime, attachedUptime: $attachedUptime)';
} }
@override @override
@ -3491,13 +3557,16 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
(identical(other.publicInternetReady, publicInternetReady) || (identical(other.publicInternetReady, publicInternetReady) ||
other.publicInternetReady == publicInternetReady) && other.publicInternetReady == publicInternetReady) &&
(identical(other.localNetworkReady, localNetworkReady) || (identical(other.localNetworkReady, localNetworkReady) ||
other.localNetworkReady == localNetworkReady)); other.localNetworkReady == localNetworkReady) &&
(identical(other.uptime, uptime) || other.uptime == uptime) &&
(identical(other.attachedUptime, attachedUptime) ||
other.attachedUptime == attachedUptime));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => int get hashCode => Object.hash(runtimeType, state, publicInternetReady,
Object.hash(runtimeType, state, publicInternetReady, localNetworkReady); localNetworkReady, uptime, attachedUptime);
/// Create a copy of VeilidUpdate /// Create a copy of VeilidUpdate
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -3525,8 +3594,12 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId) String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(
bool localNetworkReady) AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)
attachment, attachment,
required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers) List<PeerTableData> peers)
@ -3539,7 +3612,8 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
List<ValueSubkeyRange> subkeys, int count, ValueData? value) List<ValueSubkeyRange> subkeys, int count, ValueData? value)
valueChange, valueChange,
}) { }) {
return attachment(state, publicInternetReady, localNetworkReady); return attachment(
state, publicInternetReady, localNetworkReady, uptime, attachedUptime);
} }
@override @override
@ -3557,8 +3631,12 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -3570,7 +3648,8 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
List<ValueSubkeyRange> subkeys, int count, ValueData? value)? List<ValueSubkeyRange> subkeys, int count, ValueData? value)?
valueChange, valueChange,
}) { }) {
return attachment?.call(state, publicInternetReady, localNetworkReady); return attachment?.call(
state, publicInternetReady, localNetworkReady, uptime, attachedUptime);
} }
@override @override
@ -3588,8 +3667,12 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -3603,7 +3686,8 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
required TResult orElse(), required TResult orElse(),
}) { }) {
if (attachment != null) { if (attachment != null) {
return attachment(state, publicInternetReady, localNetworkReady); return attachment(state, publicInternetReady, localNetworkReady, uptime,
attachedUptime);
} }
return orElse(); return orElse();
} }
@ -3669,7 +3753,10 @@ abstract class VeilidUpdateAttachment implements VeilidUpdate {
const factory VeilidUpdateAttachment( const factory VeilidUpdateAttachment(
{required final AttachmentState state, {required final AttachmentState state,
required final bool publicInternetReady, required final bool publicInternetReady,
required final bool localNetworkReady}) = _$VeilidUpdateAttachmentImpl; required final bool localNetworkReady,
required final TimestampDuration uptime,
required final TimestampDuration? attachedUptime}) =
_$VeilidUpdateAttachmentImpl;
factory VeilidUpdateAttachment.fromJson(Map<String, dynamic> json) = factory VeilidUpdateAttachment.fromJson(Map<String, dynamic> json) =
_$VeilidUpdateAttachmentImpl.fromJson; _$VeilidUpdateAttachmentImpl.fromJson;
@ -3677,6 +3764,8 @@ abstract class VeilidUpdateAttachment implements VeilidUpdate {
AttachmentState get state; AttachmentState get state;
bool get publicInternetReady; bool get publicInternetReady;
bool get localNetworkReady; bool get localNetworkReady;
TimestampDuration get uptime;
TimestampDuration? get attachedUptime;
/// Create a copy of VeilidUpdate /// Create a copy of VeilidUpdate
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -3813,8 +3902,12 @@ class _$VeilidUpdateNetworkImpl implements VeilidUpdateNetwork {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId) String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(
bool localNetworkReady) AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)
attachment, attachment,
required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers) List<PeerTableData> peers)
@ -3845,8 +3938,12 @@ class _$VeilidUpdateNetworkImpl implements VeilidUpdateNetwork {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -3876,8 +3973,12 @@ class _$VeilidUpdateNetworkImpl implements VeilidUpdateNetwork {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -4078,8 +4179,12 @@ class _$VeilidUpdateConfigImpl implements VeilidUpdateConfig {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId) String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(
bool localNetworkReady) AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)
attachment, attachment,
required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers) List<PeerTableData> peers)
@ -4110,8 +4215,12 @@ class _$VeilidUpdateConfigImpl implements VeilidUpdateConfig {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -4141,8 +4250,12 @@ class _$VeilidUpdateConfigImpl implements VeilidUpdateConfig {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -4357,8 +4470,12 @@ class _$VeilidUpdateRouteChangeImpl implements VeilidUpdateRouteChange {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId) String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(
bool localNetworkReady) AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)
attachment, attachment,
required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers) List<PeerTableData> peers)
@ -4389,8 +4506,12 @@ class _$VeilidUpdateRouteChangeImpl implements VeilidUpdateRouteChange {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -4420,8 +4541,12 @@ class _$VeilidUpdateRouteChangeImpl implements VeilidUpdateRouteChange {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -4666,8 +4791,12 @@ class _$VeilidUpdateValueChangeImpl implements VeilidUpdateValueChange {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId) String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(
bool localNetworkReady) AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)
attachment, attachment,
required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers) List<PeerTableData> peers)
@ -4698,8 +4827,12 @@ class _$VeilidUpdateValueChangeImpl implements VeilidUpdateValueChange {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -4729,8 +4862,12 @@ class _$VeilidUpdateValueChangeImpl implements VeilidUpdateValueChange {
Typed<FixedEncodedString43>? sender, Typed<FixedEncodedString43>? sender,
String? routeId)? String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(
bool localNetworkReady)? AttachmentState state,
bool publicInternetReady,
bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime)?
attachment, attachment,
TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, TResult Function(bool started, BigInt bpsDown, BigInt bpsUp,
List<PeerTableData> peers)? List<PeerTableData> peers)?
@ -4838,6 +4975,8 @@ mixin _$VeilidStateAttachment {
AttachmentState get state => throw _privateConstructorUsedError; AttachmentState get state => throw _privateConstructorUsedError;
bool get publicInternetReady => throw _privateConstructorUsedError; bool get publicInternetReady => throw _privateConstructorUsedError;
bool get localNetworkReady => throw _privateConstructorUsedError; bool get localNetworkReady => throw _privateConstructorUsedError;
TimestampDuration get uptime => throw _privateConstructorUsedError;
TimestampDuration? get attachedUptime => throw _privateConstructorUsedError;
/// Serializes this VeilidStateAttachment to a JSON map. /// Serializes this VeilidStateAttachment to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@ -4858,7 +4997,9 @@ abstract class $VeilidStateAttachmentCopyWith<$Res> {
$Res call( $Res call(
{AttachmentState state, {AttachmentState state,
bool publicInternetReady, bool publicInternetReady,
bool localNetworkReady}); bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime});
} }
/// @nodoc /// @nodoc
@ -4880,6 +5021,8 @@ class _$VeilidStateAttachmentCopyWithImpl<$Res,
Object? state = null, Object? state = null,
Object? publicInternetReady = null, Object? publicInternetReady = null,
Object? localNetworkReady = null, Object? localNetworkReady = null,
Object? uptime = null,
Object? attachedUptime = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
state: null == state state: null == state
@ -4894,6 +5037,14 @@ class _$VeilidStateAttachmentCopyWithImpl<$Res,
? _value.localNetworkReady ? _value.localNetworkReady
: localNetworkReady // ignore: cast_nullable_to_non_nullable : localNetworkReady // ignore: cast_nullable_to_non_nullable
as bool, as bool,
uptime: null == uptime
? _value.uptime
: uptime // ignore: cast_nullable_to_non_nullable
as TimestampDuration,
attachedUptime: freezed == attachedUptime
? _value.attachedUptime
: attachedUptime // ignore: cast_nullable_to_non_nullable
as TimestampDuration?,
) as $Val); ) as $Val);
} }
} }
@ -4910,7 +5061,9 @@ abstract class _$$VeilidStateAttachmentImplCopyWith<$Res>
$Res call( $Res call(
{AttachmentState state, {AttachmentState state,
bool publicInternetReady, bool publicInternetReady,
bool localNetworkReady}); bool localNetworkReady,
TimestampDuration uptime,
TimestampDuration? attachedUptime});
} }
/// @nodoc /// @nodoc
@ -4930,6 +5083,8 @@ class __$$VeilidStateAttachmentImplCopyWithImpl<$Res>
Object? state = null, Object? state = null,
Object? publicInternetReady = null, Object? publicInternetReady = null,
Object? localNetworkReady = null, Object? localNetworkReady = null,
Object? uptime = null,
Object? attachedUptime = freezed,
}) { }) {
return _then(_$VeilidStateAttachmentImpl( return _then(_$VeilidStateAttachmentImpl(
state: null == state state: null == state
@ -4944,6 +5099,14 @@ class __$$VeilidStateAttachmentImplCopyWithImpl<$Res>
? _value.localNetworkReady ? _value.localNetworkReady
: localNetworkReady // ignore: cast_nullable_to_non_nullable : localNetworkReady // ignore: cast_nullable_to_non_nullable
as bool, as bool,
uptime: null == uptime
? _value.uptime
: uptime // ignore: cast_nullable_to_non_nullable
as TimestampDuration,
attachedUptime: freezed == attachedUptime
? _value.attachedUptime
: attachedUptime // ignore: cast_nullable_to_non_nullable
as TimestampDuration?,
)); ));
} }
} }
@ -4954,7 +5117,9 @@ class _$VeilidStateAttachmentImpl implements _VeilidStateAttachment {
const _$VeilidStateAttachmentImpl( const _$VeilidStateAttachmentImpl(
{required this.state, {required this.state,
required this.publicInternetReady, required this.publicInternetReady,
required this.localNetworkReady}); required this.localNetworkReady,
required this.uptime,
required this.attachedUptime});
factory _$VeilidStateAttachmentImpl.fromJson(Map<String, dynamic> json) => factory _$VeilidStateAttachmentImpl.fromJson(Map<String, dynamic> json) =>
_$$VeilidStateAttachmentImplFromJson(json); _$$VeilidStateAttachmentImplFromJson(json);
@ -4965,10 +5130,14 @@ class _$VeilidStateAttachmentImpl implements _VeilidStateAttachment {
final bool publicInternetReady; final bool publicInternetReady;
@override @override
final bool localNetworkReady; final bool localNetworkReady;
@override
final TimestampDuration uptime;
@override
final TimestampDuration? attachedUptime;
@override @override
String toString() { String toString() {
return 'VeilidStateAttachment(state: $state, publicInternetReady: $publicInternetReady, localNetworkReady: $localNetworkReady)'; return 'VeilidStateAttachment(state: $state, publicInternetReady: $publicInternetReady, localNetworkReady: $localNetworkReady, uptime: $uptime, attachedUptime: $attachedUptime)';
} }
@override @override
@ -4980,13 +5149,16 @@ class _$VeilidStateAttachmentImpl implements _VeilidStateAttachment {
(identical(other.publicInternetReady, publicInternetReady) || (identical(other.publicInternetReady, publicInternetReady) ||
other.publicInternetReady == publicInternetReady) && other.publicInternetReady == publicInternetReady) &&
(identical(other.localNetworkReady, localNetworkReady) || (identical(other.localNetworkReady, localNetworkReady) ||
other.localNetworkReady == localNetworkReady)); other.localNetworkReady == localNetworkReady) &&
(identical(other.uptime, uptime) || other.uptime == uptime) &&
(identical(other.attachedUptime, attachedUptime) ||
other.attachedUptime == attachedUptime));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => int get hashCode => Object.hash(runtimeType, state, publicInternetReady,
Object.hash(runtimeType, state, publicInternetReady, localNetworkReady); localNetworkReady, uptime, attachedUptime);
/// Create a copy of VeilidStateAttachment /// Create a copy of VeilidStateAttachment
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -5009,7 +5181,10 @@ abstract class _VeilidStateAttachment implements VeilidStateAttachment {
const factory _VeilidStateAttachment( const factory _VeilidStateAttachment(
{required final AttachmentState state, {required final AttachmentState state,
required final bool publicInternetReady, required final bool publicInternetReady,
required final bool localNetworkReady}) = _$VeilidStateAttachmentImpl; required final bool localNetworkReady,
required final TimestampDuration uptime,
required final TimestampDuration? attachedUptime}) =
_$VeilidStateAttachmentImpl;
factory _VeilidStateAttachment.fromJson(Map<String, dynamic> json) = factory _VeilidStateAttachment.fromJson(Map<String, dynamic> json) =
_$VeilidStateAttachmentImpl.fromJson; _$VeilidStateAttachmentImpl.fromJson;
@ -5020,6 +5195,10 @@ abstract class _VeilidStateAttachment implements VeilidStateAttachment {
bool get publicInternetReady; bool get publicInternetReady;
@override @override
bool get localNetworkReady; bool get localNetworkReady;
@override
TimestampDuration get uptime;
@override
TimestampDuration? get attachedUptime;
/// Create a copy of VeilidStateAttachment /// Create a copy of VeilidStateAttachment
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.

View File

@ -268,6 +268,10 @@ _$VeilidUpdateAttachmentImpl _$$VeilidUpdateAttachmentImplFromJson(
state: AttachmentState.fromJson(json['state']), state: AttachmentState.fromJson(json['state']),
publicInternetReady: json['public_internet_ready'] as bool, publicInternetReady: json['public_internet_ready'] as bool,
localNetworkReady: json['local_network_ready'] as bool, localNetworkReady: json['local_network_ready'] as bool,
uptime: TimestampDuration.fromJson(json['uptime']),
attachedUptime: json['attached_uptime'] == null
? null
: TimestampDuration.fromJson(json['attached_uptime']),
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
@ -277,6 +281,8 @@ Map<String, dynamic> _$$VeilidUpdateAttachmentImplToJson(
'state': instance.state.toJson(), 'state': instance.state.toJson(),
'public_internet_ready': instance.publicInternetReady, 'public_internet_ready': instance.publicInternetReady,
'local_network_ready': instance.localNetworkReady, 'local_network_ready': instance.localNetworkReady,
'uptime': instance.uptime.toJson(),
'attached_uptime': instance.attachedUptime?.toJson(),
'kind': instance.$type, 'kind': instance.$type,
}; };
@ -363,6 +369,10 @@ _$VeilidStateAttachmentImpl _$$VeilidStateAttachmentImplFromJson(
state: AttachmentState.fromJson(json['state']), state: AttachmentState.fromJson(json['state']),
publicInternetReady: json['public_internet_ready'] as bool, publicInternetReady: json['public_internet_ready'] as bool,
localNetworkReady: json['local_network_ready'] as bool, localNetworkReady: json['local_network_ready'] as bool,
uptime: TimestampDuration.fromJson(json['uptime']),
attachedUptime: json['attached_uptime'] == null
? null
: TimestampDuration.fromJson(json['attached_uptime']),
); );
Map<String, dynamic> _$$VeilidStateAttachmentImplToJson( Map<String, dynamic> _$$VeilidStateAttachmentImplToJson(
@ -371,6 +381,8 @@ Map<String, dynamic> _$$VeilidStateAttachmentImplToJson(
'state': instance.state.toJson(), 'state': instance.state.toJson(),
'public_internet_ready': instance.publicInternetReady, 'public_internet_ready': instance.publicInternetReady,
'local_network_ready': instance.localNetworkReady, 'local_network_ready': instance.localNetworkReady,
'uptime': instance.uptime.toJson(),
'attached_uptime': instance.attachedUptime?.toJson(),
}; };
_$VeilidStateNetworkImpl _$$VeilidStateNetworkImplFromJson( _$VeilidStateNetworkImpl _$$VeilidStateNetworkImplFromJson(

View File

@ -2588,9 +2588,17 @@
"kind", "kind",
"local_network_ready", "local_network_ready",
"public_internet_ready", "public_internet_ready",
"state" "state",
"uptime"
], ],
"properties": { "properties": {
"attached_uptime": {
"description": "Uptime since last attach, empty if the node is currently detached",
"type": [
"string",
"null"
]
},
"kind": { "kind": {
"type": "string", "type": "string",
"enum": [ "enum": [
@ -2598,11 +2606,11 @@
] ]
}, },
"local_network_ready": { "local_network_ready": {
"description": "If attached and there are enough eachable nodes in the routing table to perform all the actions of the LocalNetwork RoutingDomain.", "description": "If attached and there are enough reachable nodes in the routing table to perform all the actions of the LocalNetwork RoutingDomain.",
"type": "boolean" "type": "boolean"
}, },
"public_internet_ready": { "public_internet_ready": {
"description": "If attached and there are enough eachable nodes in the routing table to perform all the actions of the PublicInternet RoutingDomain, including things like private/safety route allocation and DHT operations.", "description": "If attached and there are enough reachable nodes in the routing table to perform all the actions of the PublicInternet RoutingDomain, including things like private/safety route allocation and DHT operations.",
"type": "boolean" "type": "boolean"
}, },
"state": { "state": {
@ -2612,6 +2620,10 @@
"$ref": "#/definitions/AttachmentState" "$ref": "#/definitions/AttachmentState"
} }
] ]
},
"uptime": {
"description": "Node uptime",
"type": "string"
} }
} }
}, },
@ -4618,15 +4630,23 @@
"required": [ "required": [
"local_network_ready", "local_network_ready",
"public_internet_ready", "public_internet_ready",
"state" "state",
"uptime"
], ],
"properties": { "properties": {
"attached_uptime": {
"description": "Uptime since last attach, empty if the node is currently detached",
"type": [
"string",
"null"
]
},
"local_network_ready": { "local_network_ready": {
"description": "If attached and there are enough eachable nodes in the routing table to perform all the actions of the LocalNetwork RoutingDomain.", "description": "If attached and there are enough reachable nodes in the routing table to perform all the actions of the LocalNetwork RoutingDomain.",
"type": "boolean" "type": "boolean"
}, },
"public_internet_ready": { "public_internet_ready": {
"description": "If attached and there are enough eachable nodes in the routing table to perform all the actions of the PublicInternet RoutingDomain, including things like private/safety route allocation and DHT operations.", "description": "If attached and there are enough reachable nodes in the routing table to perform all the actions of the PublicInternet RoutingDomain, including things like private/safety route allocation and DHT operations.",
"type": "boolean" "type": "boolean"
}, },
"state": { "state": {
@ -4636,6 +4656,10 @@
"$ref": "#/definitions/AttachmentState" "$ref": "#/definitions/AttachmentState"
} }
] ]
},
"uptime": {
"description": "Node uptime",
"type": "string"
} }
} }
}, },

View File

@ -31,16 +31,22 @@ class VeilidStateAttachment:
state: AttachmentState state: AttachmentState
public_internet_ready: bool public_internet_ready: bool
local_network_ready: bool local_network_ready: bool
uptime: TimestampDuration
attached_uptime: Optional[TimestampDuration]
def __init__( def __init__(
self, self,
state: AttachmentState, state: AttachmentState,
public_internet_ready: bool, public_internet_ready: bool,
local_network_ready: bool, local_network_ready: bool,
uptime: TimestampDuration,
attached_uptime: Optional[TimestampDuration],
): ):
self.state = state self.state = state
self.public_internet_ready = public_internet_ready self.public_internet_ready = public_internet_ready
self.local_network_ready = local_network_ready self.local_network_ready = local_network_ready
self.uptime = uptime
self.attached_uptime = attached_uptime
@classmethod @classmethod
def from_json(cls, j: dict) -> Self: def from_json(cls, j: dict) -> Self:
@ -49,6 +55,8 @@ class VeilidStateAttachment:
AttachmentState(j["state"]), AttachmentState(j["state"]),
j["public_internet_ready"], j["public_internet_ready"],
j["local_network_ready"], j["local_network_ready"],
j["uptime"],
j["attached_uptime"],
) )