mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-21 02:16:37 +00:00
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:
+10
-2
@@ -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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user