chore: fmt

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-08-27 19:57:22 +02:00
parent 86cfc18076
commit d3beab5006
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
6 changed files with 670 additions and 521 deletions

View File

@ -1,16 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use axum::async_trait;
use churn_domain::ServerEnrollReq;
use axum::{async_trait};
use churn_domain::{ServerEnrollReq};
use tokio::sync::Mutex; use tokio::sync::Mutex;
@ -37,8 +28,6 @@ struct DefaultAgentService {
leases: Arc<Mutex<Vec<String>>>, leases: Arc<Mutex<Vec<String>>>,
} }
#[async_trait] #[async_trait]
pub trait AgentServiceTrait { pub trait AgentServiceTrait {
async fn enroll(&self, agent_name: &str, server: &str, lease: &str) -> anyhow::Result<()>; async fn enroll(&self, agent_name: &str, server: &str, lease: &str) -> anyhow::Result<()>;

View File

@ -42,14 +42,11 @@ enum Commands {
}, },
} }
#[derive(Clone)] #[derive(Clone, Default)]
#[derive(Default)]
struct AppState { struct AppState {
agent: AgentService, agent: AgentService,
} }
#[tokio::main] #[tokio::main]
async fn main() -> anyhow::Result<()> { async fn main() -> anyhow::Result<()> {
dotenv::dotenv().ok(); dotenv::dotenv().ok();

View File

@ -2,7 +2,7 @@ use capnp::message::{Builder, HeapAllocator};
use capnp::message::{ReaderOptions, TypedReader}; use capnp::message::{ReaderOptions, TypedReader};
use capnp::serialize::{self, SliceSegments}; use capnp::serialize::{self, SliceSegments};
use capnp::traits::{Owned}; use capnp::traits::Owned;
use churn_domain::{Agent, LogEvent}; use churn_domain::{Agent, LogEvent};
mod models_capnp; mod models_capnp;
@ -14,7 +14,6 @@ pub trait CapnpPackExt {
fn deserialize_capnp(content: &Vec<u8>) -> anyhow::Result<Self::Return>; fn deserialize_capnp(content: &Vec<u8>) -> anyhow::Result<Self::Return>;
fn capnp_to_string(builder: &Builder<HeapAllocator>) -> Vec<u8> { fn capnp_to_string(builder: &Builder<HeapAllocator>) -> Vec<u8> {
serialize::write_message_to_words(builder) serialize::write_message_to_words(builder)
} }
@ -26,8 +25,6 @@ pub trait CapnpPackExt {
serialize::read_message_from_flat_slice(&mut content.as_slice(), ReaderOptions::new()) serialize::read_message_from_flat_slice(&mut content.as_slice(), ReaderOptions::new())
.unwrap(); .unwrap();
log_event.into_typed::<S>() log_event.into_typed::<S>()
} }
} }

View File

@ -2,62 +2,99 @@
// DO NOT EDIT. // DO NOT EDIT.
// source: models.capnp // source: models.capnp
pub mod log_event { pub mod log_event {
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct Owned(()); pub struct Owned(());
impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } impl ::capnp::introspect::Introspect for Owned {
impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } fn introspect() -> ::capnp::introspect::Type {
impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema {
impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } generic: &_private::RAW_SCHEMA,
field_types: _private::get_field_types,
pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } annotation_types: _private::get_annotation_types,
impl <'a,> ::core::marker::Copy for Reader<'a,> {} })
impl <'a,> ::core::clone::Clone for Reader<'a,> { .into()
fn clone(&self) -> Self { *self } }
}
impl ::capnp::traits::Owned for Owned {
type Reader<'a> = Reader<'a>;
type Builder<'a> = Builder<'a>;
}
impl ::capnp::traits::OwnedStruct for Owned {
type Reader<'a> = Reader<'a>;
type Builder<'a> = Builder<'a>;
}
impl ::capnp::traits::Pipelined for Owned {
type Pipeline = Pipeline;
} }
impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { pub struct Reader<'a> {
reader: ::capnp::private::layout::StructReader<'a>,
}
impl<'a> ::core::marker::Copy for Reader<'a> {}
impl<'a> ::core::clone::Clone for Reader<'a> {
fn clone(&self) -> Self {
*self
}
}
impl<'a> ::capnp::traits::HasTypeId for Reader<'a> {
const TYPE_ID: u64 = _private::TYPE_ID; const TYPE_ID: u64 = _private::TYPE_ID;
} }
impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> {
fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self {
Self { reader, } Self { reader }
} }
} }
impl <'a,> ::core::convert::From<Reader<'a,>> for ::capnp::dynamic_value::Reader<'a> { impl<'a> ::core::convert::From<Reader<'a>> for ::capnp::dynamic_value::Reader<'a> {
fn from(reader: Reader<'a,>) -> Self { fn from(reader: Reader<'a>) -> Self {
Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) Self::Struct(::capnp::dynamic_struct::Reader::new(
reader.reader,
::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema {
generic: &_private::RAW_SCHEMA,
field_types: _private::get_field_types,
annotation_types: _private::get_annotation_types,
}),
))
} }
} }
impl <'a,> ::core::fmt::Debug for Reader<'a,> { impl<'a> ::core::fmt::Debug for Reader<'a> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { fn fmt(
core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) &self,
f: &mut ::core::fmt::Formatter<'_>,
) -> ::core::result::Result<(), ::core::fmt::Error> {
core::fmt::Debug::fmt(
&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self),
f,
)
} }
} }
impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> {
fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result<Self> { fn get_from_pointer(
reader: &::capnp::private::layout::PointerReader<'a>,
default: ::core::option::Option<&'a [::capnp::Word]>,
) -> ::capnp::Result<Self> {
::core::result::Result::Ok(reader.get_struct(default)?.into()) ::core::result::Result::Ok(reader.get_struct(default)?.into())
} }
} }
impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> {
fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> {
self.reader self.reader
} }
} }
impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> {
fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) {
self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) self.reader
.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table))
} }
} }
impl <'a,> Reader<'a,> { impl<'a> Reader<'a> {
pub fn reborrow(&self) -> Reader<'_,> { pub fn reborrow(&self) -> Reader<'_> {
Self { ..*self } Self { ..*self }
} }
@ -66,7 +103,10 @@ pub mod log_event {
} }
#[inline] #[inline]
pub fn get_id(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { pub fn get_id(self) -> ::capnp::Result<::capnp::text::Reader<'a>> {
::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) ::capnp::traits::FromPointerReader::get_from_pointer(
&self.reader.get_pointer_field(0),
::core::option::Option::None,
)
} }
#[inline] #[inline]
pub fn has_id(&self) -> bool { pub fn has_id(&self) -> bool {
@ -74,7 +114,10 @@ pub mod log_event {
} }
#[inline] #[inline]
pub fn get_author(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { pub fn get_author(self) -> ::capnp::Result<::capnp::text::Reader<'a>> {
::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) ::capnp::traits::FromPointerReader::get_from_pointer(
&self.reader.get_pointer_field(1),
::core::option::Option::None,
)
} }
#[inline] #[inline]
pub fn has_author(&self) -> bool { pub fn has_author(&self) -> bool {
@ -82,7 +125,10 @@ pub mod log_event {
} }
#[inline] #[inline]
pub fn get_content(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { pub fn get_content(self) -> ::capnp::Result<::capnp::text::Reader<'a>> {
::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(2), ::core::option::Option::None) ::capnp::traits::FromPointerReader::get_from_pointer(
&self.reader.get_pointer_field(2),
::core::option::Option::None,
)
} }
#[inline] #[inline]
pub fn has_content(&self) -> bool { pub fn has_content(&self) -> bool {
@ -94,52 +140,86 @@ pub mod log_event {
} }
} }
pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } pub struct Builder<'a> {
impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { builder: ::capnp::private::layout::StructBuilder<'a>,
const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 3 };
} }
impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { impl<'a> ::capnp::traits::HasStructSize for Builder<'a> {
const STRUCT_SIZE: ::capnp::private::layout::StructSize =
::capnp::private::layout::StructSize {
data: 1,
pointers: 3,
};
}
impl<'a> ::capnp::traits::HasTypeId for Builder<'a> {
const TYPE_ID: u64 = _private::TYPE_ID; const TYPE_ID: u64 = _private::TYPE_ID;
} }
impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> {
fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self {
Self { builder, } Self { builder }
} }
} }
impl <'a,> ::core::convert::From<Builder<'a,>> for ::capnp::dynamic_value::Builder<'a> { impl<'a> ::core::convert::From<Builder<'a>> for ::capnp::dynamic_value::Builder<'a> {
fn from(builder: Builder<'a,>) -> Self { fn from(builder: Builder<'a>) -> Self {
Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) Self::Struct(::capnp::dynamic_struct::Builder::new(
builder.builder,
::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema {
generic: &_private::RAW_SCHEMA,
field_types: _private::get_field_types,
annotation_types: _private::get_annotation_types,
}),
))
} }
} }
impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> {
fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) {
self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) self.builder
.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table))
} }
} }
impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> {
fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self {
builder.init_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE).into() builder
.init_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE)
.into()
} }
fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result<Self> { fn get_from_pointer(
::core::result::Result::Ok(builder.get_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE, default)?.into()) builder: ::capnp::private::layout::PointerBuilder<'a>,
default: ::core::option::Option<&'a [::capnp::Word]>,
) -> ::capnp::Result<Self> {
::core::result::Result::Ok(
builder
.get_struct(
<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE,
default,
)?
.into(),
)
} }
} }
impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { impl<'a> ::capnp::traits::SetPointerBuilder for Reader<'a> {
fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } fn set_pointer_builder(
mut pointer: ::capnp::private::layout::PointerBuilder<'_>,
value: Self,
canonicalize: bool,
) -> ::capnp::Result<()> {
pointer.set_struct(&value.reader, canonicalize)
}
} }
impl <'a,> Builder<'a,> { impl<'a> Builder<'a> {
pub fn into_reader(self) -> Reader<'a,> { pub fn into_reader(self) -> Reader<'a> {
self.builder.into_reader().into() self.builder.into_reader().into()
} }
pub fn reborrow(&mut self) -> Builder<'_,> { pub fn reborrow(&mut self) -> Builder<'_> {
Builder { builder: self.builder.reborrow() } Builder {
builder: self.builder.reborrow(),
} }
pub fn reborrow_as_reader(&self) -> Reader<'_,> { }
pub fn reborrow_as_reader(&self) -> Reader<'_> {
self.builder.as_reader().into() self.builder.as_reader().into()
} }
@ -148,7 +228,10 @@ pub mod log_event {
} }
#[inline] #[inline]
pub fn get_id(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { pub fn get_id(self) -> ::capnp::Result<::capnp::text::Builder<'a>> {
::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) ::capnp::traits::FromPointerBuilder::get_from_pointer(
self.builder.get_pointer_field(0),
::core::option::Option::None,
)
} }
#[inline] #[inline]
pub fn set_id(&mut self, value: ::capnp::text::Reader<'_>) { pub fn set_id(&mut self, value: ::capnp::text::Reader<'_>) {
@ -164,7 +247,10 @@ pub mod log_event {
} }
#[inline] #[inline]
pub fn get_author(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { pub fn get_author(self) -> ::capnp::Result<::capnp::text::Builder<'a>> {
::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None) ::capnp::traits::FromPointerBuilder::get_from_pointer(
self.builder.get_pointer_field(1),
::core::option::Option::None,
)
} }
#[inline] #[inline]
pub fn set_author(&mut self, value: ::capnp::text::Reader<'_>) { pub fn set_author(&mut self, value: ::capnp::text::Reader<'_>) {
@ -180,7 +266,10 @@ pub mod log_event {
} }
#[inline] #[inline]
pub fn get_content(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { pub fn get_content(self) -> ::capnp::Result<::capnp::text::Builder<'a>> {
::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(2), ::core::option::Option::None) ::capnp::traits::FromPointerBuilder::get_from_pointer(
self.builder.get_pointer_field(2),
::core::option::Option::None,
)
} }
#[inline] #[inline]
pub fn set_content(&mut self, value: ::capnp::text::Reader<'_>) { pub fn set_content(&mut self, value: ::capnp::text::Reader<'_>) {
@ -204,14 +293,17 @@ pub mod log_event {
} }
} }
pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } pub struct Pipeline {
_typeless: ::capnp::any_pointer::Pipeline,
}
impl ::capnp::capability::FromTypelessPipeline for Pipeline { impl ::capnp::capability::FromTypelessPipeline for Pipeline {
fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self {
Self { _typeless: typeless, } Self {
_typeless: typeless,
} }
} }
impl Pipeline {
} }
impl Pipeline {}
mod _private { mod _private {
pub static ENCODED_NODE: [::capnp::Word; 78] = [ pub static ENCODED_NODE: [::capnp::Word; 78] = [
::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0),
@ -302,10 +394,14 @@ pub mod log_event {
_ => panic!("invalid field index {}", index), _ => panic!("invalid field index {}", index),
} }
} }
pub fn get_annotation_types(child_index: Option<u16>, index: u32) -> ::capnp::introspect::Type { pub fn get_annotation_types(
child_index: Option<u16>,
index: u32,
) -> ::capnp::introspect::Type {
panic!("invalid annotation indices ({:?}, {}) ", child_index, index) panic!("invalid annotation indices ({:?}, {}) ", child_index, index)
} }
pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema =
::capnp::introspect::RawStructSchema {
encoded_node: &ENCODED_NODE, encoded_node: &ENCODED_NODE,
nonunion_members: NONUNION_MEMBERS, nonunion_members: NONUNION_MEMBERS,
members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_discriminant: MEMBERS_BY_DISCRIMINANT,
@ -319,58 +415,96 @@ pub mod log_event {
pub mod agent { pub mod agent {
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct Owned(()); pub struct Owned(());
impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } impl ::capnp::introspect::Introspect for Owned {
impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } fn introspect() -> ::capnp::introspect::Type {
impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema {
impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } generic: &_private::RAW_SCHEMA,
field_types: _private::get_field_types,
pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } annotation_types: _private::get_annotation_types,
impl <'a,> ::core::marker::Copy for Reader<'a,> {} })
impl <'a,> ::core::clone::Clone for Reader<'a,> { .into()
fn clone(&self) -> Self { *self } }
}
impl ::capnp::traits::Owned for Owned {
type Reader<'a> = Reader<'a>;
type Builder<'a> = Builder<'a>;
}
impl ::capnp::traits::OwnedStruct for Owned {
type Reader<'a> = Reader<'a>;
type Builder<'a> = Builder<'a>;
}
impl ::capnp::traits::Pipelined for Owned {
type Pipeline = Pipeline;
} }
impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { pub struct Reader<'a> {
reader: ::capnp::private::layout::StructReader<'a>,
}
impl<'a> ::core::marker::Copy for Reader<'a> {}
impl<'a> ::core::clone::Clone for Reader<'a> {
fn clone(&self) -> Self {
*self
}
}
impl<'a> ::capnp::traits::HasTypeId for Reader<'a> {
const TYPE_ID: u64 = _private::TYPE_ID; const TYPE_ID: u64 = _private::TYPE_ID;
} }
impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> {
fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self {
Self { reader, } Self { reader }
} }
} }
impl <'a,> ::core::convert::From<Reader<'a,>> for ::capnp::dynamic_value::Reader<'a> { impl<'a> ::core::convert::From<Reader<'a>> for ::capnp::dynamic_value::Reader<'a> {
fn from(reader: Reader<'a,>) -> Self { fn from(reader: Reader<'a>) -> Self {
Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) Self::Struct(::capnp::dynamic_struct::Reader::new(
reader.reader,
::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema {
generic: &_private::RAW_SCHEMA,
field_types: _private::get_field_types,
annotation_types: _private::get_annotation_types,
}),
))
} }
} }
impl <'a,> ::core::fmt::Debug for Reader<'a,> { impl<'a> ::core::fmt::Debug for Reader<'a> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { fn fmt(
core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) &self,
f: &mut ::core::fmt::Formatter<'_>,
) -> ::core::result::Result<(), ::core::fmt::Error> {
core::fmt::Debug::fmt(
&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self),
f,
)
} }
} }
impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> {
fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result<Self> { fn get_from_pointer(
reader: &::capnp::private::layout::PointerReader<'a>,
default: ::core::option::Option<&'a [::capnp::Word]>,
) -> ::capnp::Result<Self> {
::core::result::Result::Ok(reader.get_struct(default)?.into()) ::core::result::Result::Ok(reader.get_struct(default)?.into())
} }
} }
impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> {
fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> {
self.reader self.reader
} }
} }
impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> {
fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) {
self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) self.reader
.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table))
} }
} }
impl <'a,> Reader<'a,> { impl<'a> Reader<'a> {
pub fn reborrow(&self) -> Reader<'_,> { pub fn reborrow(&self) -> Reader<'_> {
Self { ..*self } Self { ..*self }
} }
@ -379,7 +513,10 @@ pub mod agent {
} }
#[inline] #[inline]
pub fn get_name(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { pub fn get_name(self) -> ::capnp::Result<::capnp::text::Reader<'a>> {
::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) ::capnp::traits::FromPointerReader::get_from_pointer(
&self.reader.get_pointer_field(0),
::core::option::Option::None,
)
} }
#[inline] #[inline]
pub fn has_name(&self) -> bool { pub fn has_name(&self) -> bool {
@ -387,52 +524,86 @@ pub mod agent {
} }
} }
pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } pub struct Builder<'a> {
impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { builder: ::capnp::private::layout::StructBuilder<'a>,
const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 0, pointers: 1 };
} }
impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { impl<'a> ::capnp::traits::HasStructSize for Builder<'a> {
const STRUCT_SIZE: ::capnp::private::layout::StructSize =
::capnp::private::layout::StructSize {
data: 0,
pointers: 1,
};
}
impl<'a> ::capnp::traits::HasTypeId for Builder<'a> {
const TYPE_ID: u64 = _private::TYPE_ID; const TYPE_ID: u64 = _private::TYPE_ID;
} }
impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> {
fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self {
Self { builder, } Self { builder }
} }
} }
impl <'a,> ::core::convert::From<Builder<'a,>> for ::capnp::dynamic_value::Builder<'a> { impl<'a> ::core::convert::From<Builder<'a>> for ::capnp::dynamic_value::Builder<'a> {
fn from(builder: Builder<'a,>) -> Self { fn from(builder: Builder<'a>) -> Self {
Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) Self::Struct(::capnp::dynamic_struct::Builder::new(
builder.builder,
::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema {
generic: &_private::RAW_SCHEMA,
field_types: _private::get_field_types,
annotation_types: _private::get_annotation_types,
}),
))
} }
} }
impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> {
fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) {
self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) self.builder
.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table))
} }
} }
impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> {
fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self {
builder.init_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE).into() builder
.init_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE)
.into()
} }
fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result<Self> { fn get_from_pointer(
::core::result::Result::Ok(builder.get_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE, default)?.into()) builder: ::capnp::private::layout::PointerBuilder<'a>,
default: ::core::option::Option<&'a [::capnp::Word]>,
) -> ::capnp::Result<Self> {
::core::result::Result::Ok(
builder
.get_struct(
<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE,
default,
)?
.into(),
)
} }
} }
impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { impl<'a> ::capnp::traits::SetPointerBuilder for Reader<'a> {
fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } fn set_pointer_builder(
mut pointer: ::capnp::private::layout::PointerBuilder<'_>,
value: Self,
canonicalize: bool,
) -> ::capnp::Result<()> {
pointer.set_struct(&value.reader, canonicalize)
}
} }
impl <'a,> Builder<'a,> { impl<'a> Builder<'a> {
pub fn into_reader(self) -> Reader<'a,> { pub fn into_reader(self) -> Reader<'a> {
self.builder.into_reader().into() self.builder.into_reader().into()
} }
pub fn reborrow(&mut self) -> Builder<'_,> { pub fn reborrow(&mut self) -> Builder<'_> {
Builder { builder: self.builder.reborrow() } Builder {
builder: self.builder.reborrow(),
} }
pub fn reborrow_as_reader(&self) -> Reader<'_,> { }
pub fn reborrow_as_reader(&self) -> Reader<'_> {
self.builder.as_reader().into() self.builder.as_reader().into()
} }
@ -441,7 +612,10 @@ pub mod agent {
} }
#[inline] #[inline]
pub fn get_name(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { pub fn get_name(self) -> ::capnp::Result<::capnp::text::Builder<'a>> {
::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) ::capnp::traits::FromPointerBuilder::get_from_pointer(
self.builder.get_pointer_field(0),
::core::option::Option::None,
)
} }
#[inline] #[inline]
pub fn set_name(&mut self, value: ::capnp::text::Reader<'_>) { pub fn set_name(&mut self, value: ::capnp::text::Reader<'_>) {
@ -457,14 +631,17 @@ pub mod agent {
} }
} }
pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } pub struct Pipeline {
_typeless: ::capnp::any_pointer::Pipeline,
}
impl ::capnp::capability::FromTypelessPipeline for Pipeline { impl ::capnp::capability::FromTypelessPipeline for Pipeline {
fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self {
Self { _typeless: typeless, } Self {
_typeless: typeless,
} }
} }
impl Pipeline {
} }
impl Pipeline {}
mod _private { mod _private {
pub static ENCODED_NODE: [::capnp::Word; 32] = [ pub static ENCODED_NODE: [::capnp::Word; 32] = [
::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0),
@ -506,10 +683,14 @@ pub mod agent {
_ => panic!("invalid field index {}", index), _ => panic!("invalid field index {}", index),
} }
} }
pub fn get_annotation_types(child_index: Option<u16>, index: u32) -> ::capnp::introspect::Type { pub fn get_annotation_types(
child_index: Option<u16>,
index: u32,
) -> ::capnp::introspect::Type {
panic!("invalid annotation indices ({:?}, {}) ", child_index, index) panic!("invalid annotation indices ({:?}, {}) ", child_index, index)
} }
pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema =
::capnp::introspect::RawStructSchema {
encoded_node: &ENCODED_NODE, encoded_node: &ENCODED_NODE,
nonunion_members: NONUNION_MEMBERS, nonunion_members: NONUNION_MEMBERS,
members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_discriminant: MEMBERS_BY_DISCRIMINANT,

View File

@ -1,13 +1,10 @@
use core::slice::SlicePattern; use core::slice::SlicePattern;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::Arc; use std::sync::Arc;
use async_trait::async_trait; use async_trait::async_trait;
#[derive(Clone)] #[derive(Clone)]
pub struct Db(Arc<dyn DbTrait + Send + Sync + 'static>); pub struct Db(Arc<dyn DbTrait + Send + Sync + 'static>);

View File

@ -1,16 +1,6 @@
use std::sync::Arc; use std::sync::Arc;
use axum::async_trait;
use axum::{async_trait};
use tokio::sync::Mutex; use tokio::sync::Mutex;
@ -36,8 +26,6 @@ struct DefaultLeaseService {
leases: Arc<Mutex<Vec<String>>>, leases: Arc<Mutex<Vec<String>>>,
} }
#[async_trait] #[async_trait]
pub trait LeaseServiceTrait { pub trait LeaseServiceTrait {
async fn create_lease(&self) -> anyhow::Result<String>; async fn create_lease(&self) -> anyhow::Result<String>;