mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 22:08:30 +00:00
Add lighthouse db command (#3129)
## Proposed Changes Add a `lighthouse db` command with three initial subcommands: - `lighthouse db version`: print the database schema version. - `lighthouse db migrate --to N`: manually upgrade (or downgrade!) the database to a different version. - `lighthouse db inspect --column C`: log the key and size in bytes of every value in a given `DBColumn`. This PR lays the groundwork for other changes, namely: - Mark's fast-deposit sync (https://github.com/sigp/lighthouse/pull/2915), for which I think we should implement a database downgrade (from v9 to v8). - My `tree-states` work, which already implements a downgrade (v10 to v8). - Standalone purge commands like `lighthouse db purge-dht` per https://github.com/sigp/lighthouse/issues/2824. ## Additional Info I updated the `strum` crate to 0.24.0, which necessitated some changes in the network code to remove calls to deprecated methods. Thanks to @winksaville for the motivation, and implementation work that I used as a source of inspiration (https://github.com/sigp/lighthouse/pull/2685).
This commit is contained in:
@@ -9,7 +9,6 @@ use lighthouse_network::{
|
||||
Gossipsub, NetworkGlobals,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use strum::AsStaticRef;
|
||||
use strum::IntoEnumIterator;
|
||||
use types::EthSpec;
|
||||
|
||||
@@ -357,12 +356,12 @@ pub fn update_gossip_metrics<T: EthSpec>(
|
||||
for client_kind in ClientKind::iter() {
|
||||
set_gauge_vec(
|
||||
&BEACON_BLOCK_MESH_PEERS_PER_CLIENT,
|
||||
&[&client_kind.to_string()],
|
||||
&[client_kind.as_ref()],
|
||||
0_i64,
|
||||
);
|
||||
set_gauge_vec(
|
||||
&BEACON_AGGREGATE_AND_PROOF_MESH_PEERS_PER_CLIENT,
|
||||
&[&client_kind.to_string()],
|
||||
&[client_kind.as_ref()],
|
||||
0_i64,
|
||||
);
|
||||
}
|
||||
@@ -377,7 +376,7 @@ pub fn update_gossip_metrics<T: EthSpec>(
|
||||
.peers
|
||||
.read()
|
||||
.peer_info(peer_id)
|
||||
.map(|peer_info| peer_info.client().kind.as_static())
|
||||
.map(|peer_info| peer_info.client().kind.into())
|
||||
.unwrap_or_else(|| "Unknown");
|
||||
if let Some(v) =
|
||||
get_int_gauge(&BEACON_BLOCK_MESH_PEERS_PER_CLIENT, &[client])
|
||||
@@ -392,7 +391,7 @@ pub fn update_gossip_metrics<T: EthSpec>(
|
||||
.peers
|
||||
.read()
|
||||
.peer_info(peer_id)
|
||||
.map(|peer_info| peer_info.client().kind.as_static())
|
||||
.map(|peer_info| peer_info.client().kind.into())
|
||||
.unwrap_or_else(|| "Unknown");
|
||||
if let Some(v) = get_int_gauge(
|
||||
&BEACON_AGGREGATE_AND_PROOF_MESH_PEERS_PER_CLIENT,
|
||||
|
||||
Reference in New Issue
Block a user