1use crate::io::format::{self, AcceptedSinkAdapter, InputAdapter, RejectedSinkAdapter};
2use crate::io::storage::CloudClient;
3use crate::FloeResult;
4
5pub trait Runtime {
6 fn input_adapter(&self, format: &str) -> FloeResult<&'static dyn InputAdapter>;
7 fn accepted_sink_adapter(&self, format: &str) -> FloeResult<&'static dyn AcceptedSinkAdapter>;
8 fn rejected_sink_adapter(&self, format: &str) -> FloeResult<&'static dyn RejectedSinkAdapter>;
9 fn storage(&mut self) -> &mut CloudClient;
10}
11
12pub struct DefaultRuntime {
13 cloud: CloudClient,
14}
15
16impl DefaultRuntime {
17 pub fn new() -> Self {
18 Self {
19 cloud: CloudClient::new(),
20 }
21 }
22}
23
24impl Default for DefaultRuntime {
25 fn default() -> Self {
26 Self::new()
27 }
28}
29
30impl Runtime for DefaultRuntime {
31 fn input_adapter(&self, format: &str) -> FloeResult<&'static dyn InputAdapter> {
32 format::input_adapter(format)
33 }
34
35 fn accepted_sink_adapter(&self, format: &str) -> FloeResult<&'static dyn AcceptedSinkAdapter> {
36 format::accepted_sink_adapter(format)
37 }
38
39 fn rejected_sink_adapter(&self, format: &str) -> FloeResult<&'static dyn RejectedSinkAdapter> {
40 format::rejected_sink_adapter(format)
41 }
42
43 fn storage(&mut self) -> &mut CloudClient {
44 &mut self.cloud
45 }
46}