aboutsummaryrefslogtreecommitdiff
path: root/src/api/admin/lib.rs
blob: dd9b7ffd7be0e8c0ffe9fa2e3d850b7e8be24050 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#[macro_use]
extern crate tracing;

pub mod api_server;
mod error;
mod macros;

pub mod api;
mod router_v0;
mod router_v1;
mod router_v2;

mod bucket;
mod cluster;
mod key;
mod special;

mod block;
mod node;
mod repair;
mod worker;

use std::sync::Arc;

use garage_model::garage::Garage;

pub use api_server::AdminApiServer as Admin;

pub enum Authorization {
	None,
	MetricsToken,
	AdminToken,
}

pub trait RequestHandler {
	type Response;

	fn handle(
		self,
		garage: &Arc<Garage>,
		admin: &Admin,
	) -> impl std::future::Future<Output = Result<Self::Response, error::Error>> + Send;
}