admin api: base infrastructure for local endpoints

admin api: rename EndpointHandler into RequestHandler to avoid confusion with RPC

wip: infrastructure for local api calls

admin api: fix things

admin api: first local endpoint to work with new scheme

admin api: implement SetWorkerVariable
This commit is contained in:
Alex Auvolat
2025-01-30 19:08:48 +01:00
parent bdaf55ab3f
commit 89ff9f5576
17 changed files with 619 additions and 236 deletions
+10 -2
View File
@@ -15,12 +15,16 @@ mod cluster;
mod key;
mod special;
mod worker;
use std::sync::Arc;
use async_trait::async_trait;
use garage_model::garage::Garage;
pub use api_server::AdminApiServer as Admin;
pub enum Authorization {
None,
MetricsToken,
@@ -28,8 +32,12 @@ pub enum Authorization {
}
#[async_trait]
pub trait EndpointHandler {
pub trait RequestHandler {
type Response;
async fn handle(self, garage: &Arc<Garage>) -> Result<Self::Response, error::Error>;
async fn handle(
self,
garage: &Arc<Garage>,
admin: &Admin,
) -> Result<Self::Response, error::Error>;
}