Skip to content

Commit bd06333

Browse files
committed
instroduce admin shell and client
1 parent 417c8bf commit bd06333

5 files changed

Lines changed: 36 additions & 2 deletions

File tree

Cargo.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libsql-server/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ tar = "0.4.41"
9595
aws-config = "1"
9696
aws-sdk-s3 = "1"
9797
aws-smithy-runtime = "1.6.2"
98+
dialoguer = { version = "0.11.0", features = ["history"] }
9899

99100
[dev-dependencies]
100101
arbitrary = { version = "1.3.0", features = ["derive_arbitrary"] }

libsql-server/src/admin_shell.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
use std::fmt::Display;
2+
use std::pin::Pin;
3+
4+
use bytes::Bytes;

libsql-server/src/http/admin/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use crate::net::Connector;
3131
use crate::LIBSQL_PAGE_SIZE;
3232

3333
pub mod stats;
34-
mod admin_shell;
3534

3635
#[derive(Clone)]
3736
struct Metrics {
@@ -169,7 +168,7 @@ where
169168
.route("/profile/heap/disable/:id", post(disable_profile_heap))
170169
.route("/profile/heap/:id", delete(delete_profile_heap))
171170
.with_state(Arc::new(AppState {
172-
namespaces,
171+
namespaces: namespaces.clone(),
173172
connector,
174173
user_http_server,
175174
metrics,
@@ -185,6 +184,14 @@ where
185184
)
186185
.layer(axum::middleware::from_fn_with_state(auth, auth_middleware));
187186

187+
let admin_shell = crate::admin_shell::make_svc(namespaces.clone());
188+
let grpc_router = tonic::transport::Server::builder()
189+
.accept_http1(true)
190+
.add_service(tonic_web::enable(admin_shell))
191+
.into_router();
192+
193+
let router = router.merge(grpc_router);
194+
188195
hyper::server::Server::builder(acceptor)
189196
.serve(router.into_make_service())
190197
.with_graceful_shutdown(shutdown.notified())

libsql-server/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ use self::net::AddrIncoming;
8484
use self::replication::script_backup_manager::{CommandHandler, ScriptBackupManager};
8585
use self::schema::SchedulerHandle;
8686

87+
pub mod admin_shell;
8788
pub mod auth;
8889
mod broadcaster;
8990
pub mod config;

0 commit comments

Comments
 (0)