2020-11-17 14:28:04 +01:00
|
|
|
use std::sync::Arc;
|
2020-11-17 14:15:29 +01:00
|
|
|
|
2020-11-19 14:53:14 +01:00
|
|
|
use slog::Logger;
|
|
|
|
|
2020-11-17 14:15:29 +01:00
|
|
|
use capnp::capability::Promise;
|
|
|
|
use capnp::Error;
|
|
|
|
|
2020-11-17 14:28:04 +01:00
|
|
|
use crate::schema::api_capnp::machines;
|
|
|
|
use crate::connection::Session;
|
|
|
|
|
|
|
|
/// An implementation of the `Machines` API
|
2020-11-17 14:35:16 +01:00
|
|
|
pub struct Machines {
|
2020-11-17 14:28:04 +01:00
|
|
|
/// A reference to the connection — as long as at least one API endpoint is
|
|
|
|
/// still alive the session has to be as well.
|
|
|
|
session: Arc<Session>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Machines {
|
|
|
|
pub fn new(session: Arc<Session>) -> Self {
|
2020-11-19 14:53:14 +01:00
|
|
|
info!(session.log, "Machines created");
|
2020-11-17 14:28:04 +01:00
|
|
|
Self { session }
|
|
|
|
}
|
|
|
|
}
|
2020-11-17 14:15:29 +01:00
|
|
|
|
|
|
|
impl machines::Server for Machines {
|
|
|
|
fn list_machines(&mut self,
|
|
|
|
_params: machines::ListMachinesParams,
|
|
|
|
mut results: machines::ListMachinesResults)
|
|
|
|
-> Promise<(), Error>
|
|
|
|
{
|
|
|
|
Promise::ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_machine(&mut self,
|
|
|
|
_params: machines::GetMachineParams,
|
|
|
|
mut results: machines::GetMachineResults)
|
|
|
|
-> Promise<(), Error>
|
|
|
|
{
|
|
|
|
Promise::ok(())
|
|
|
|
}
|
|
|
|
}
|