Skip to content

Commit

Permalink
private all details module
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuk committed Jun 10, 2022
1 parent 62f6fef commit 1047c96
Show file tree
Hide file tree
Showing 110 changed files with 329 additions and 409 deletions.
6 changes: 3 additions & 3 deletions foreign-service/src/source.rs
@@ -1,6 +1,8 @@
// This file is part of https://github.com/SpringQL/SpringQL which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details.

pub mod source_input;
mod source_input;

pub use source_input::ForeignSourceInput;

use std::{
io::Write,
Expand All @@ -11,8 +13,6 @@ use std::{
use anyhow::Result;
use chrono::Duration;

use crate::source::source_input::ForeignSourceInput;

/// Runs as a TCP server and write(2)s foreign rows to socket.
pub struct ForeignSource {
listener: TcpListener,
Expand Down
2 changes: 1 addition & 1 deletion springql-core/src/api.rs
Expand Up @@ -9,7 +9,7 @@ pub use crate::{
SpringConfig,
},
stream_engine::{
time::{duration::event_duration::SpringEventDuration, timestamp::SpringTimestamp},
time::{SpringEventDuration, SpringTimestamp},
SpringValue,
},
};
Expand Down
6 changes: 3 additions & 3 deletions springql-core/src/expr_resolver.rs
@@ -1,6 +1,6 @@
// This file is part of https://github.com/SpringQL/SpringQL which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details.

pub mod expr_label;
mod expr_label;
pub use expr_label::{AggrExprLabel, ExprLabel, ExprLabelGenerator, ValueExprLabel};

use std::collections::HashMap;
Expand All @@ -11,7 +11,7 @@ use crate::{
api::error::{Result, SpringError},
expression::{AggrExpr, ValueExpr},
pipeline::{AggrAlias, ValueAlias},
sql_processor::sql_parser::SelectFieldSyntax,
sql_processor::SelectFieldSyntax,
stream_engine::{SqlValue, Tuple},
};

Expand Down Expand Up @@ -183,7 +183,7 @@ impl ExprResolver {

#[cfg(test)]
mod tests {
use crate::{expression::ValueExpr, stream_engine::time::timestamp::SpringTimestamp};
use crate::{expression::ValueExpr, stream_engine::time::SpringTimestamp};

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion springql-core/src/expression.rs
Expand Up @@ -16,7 +16,7 @@ use crate::{
api::error::{Result, SpringError},
pipeline::{AggregateFunctionParameter, ColumnReference},
stream_engine::{
time::duration::{event_duration::SpringEventDuration, SpringDuration},
time::{SpringDuration, SpringEventDuration},
NnSqlValue, SqlCompareResult, SqlValue, Tuple,
},
};
Expand Down
2 changes: 1 addition & 1 deletion springql-core/src/pipeline/pump_model.rs
Expand Up @@ -13,7 +13,7 @@ pub use window_parameter::WindowParameter;

use crate::{
pipeline::name::{PumpName, StreamName},
stream_engine::command::{insert_plan::InsertPlan, query_plan::QueryPlan},
stream_engine::command::{InsertPlan, QueryPlan},
};

#[derive(Clone, PartialEq, Debug, new)]
Expand Down
@@ -1,6 +1,6 @@
// This file is part of https://github.com/SpringQL/SpringQL which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details.

use crate::expr_resolver::expr_label::{AggrExprLabel, ValueExprLabel};
use crate::expr_resolver::{AggrExprLabel, ValueExprLabel};

/// [GROUP BY c1, c2, c3...]
#[derive(Clone, PartialEq, Debug, Default, new)]
Expand Down
@@ -1,6 +1,6 @@
// This file is part of https://github.com/SpringQL/SpringQL which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details.

use crate::{expr_resolver::expr_label::ValueExprLabel, pipeline::field::ColumnReference};
use crate::{expr_resolver::ValueExprLabel, pipeline::field::ColumnReference};

/// TODO `support complex expression with aggregations`
///
Expand Down
2 changes: 1 addition & 1 deletion springql-core/src/pipeline/pump_model/window_parameter.rs
@@ -1,6 +1,6 @@
// This file is part of https://github.com/SpringQL/SpringQL which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details.

use crate::stream_engine::time::duration::event_duration::SpringEventDuration;
use crate::stream_engine::time::SpringEventDuration;

/// Window parameters
#[derive(Clone, Eq, PartialEq, Debug)]
Expand Down
20 changes: 10 additions & 10 deletions springql-core/src/sql_processor.rs
@@ -1,19 +1,19 @@
// This file is part of https://github.com/SpringQL/SpringQL which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details.

pub mod sql_parser;

mod query_planner;
mod sql_parser;

pub use sql_parser::{
ColumnConstraintSyntax, CreatePump, DurationFunction, FromItemSyntax, GroupingElementSyntax,
OptionSyntax, ParseSuccess, PestParserImpl, SelectFieldSyntax, SelectStreamSyntax, SqlParser,
SubFromItemSyntax,
};

use crate::{
api::error::Result,
pipeline::{Pipeline, PumpModel, SinkWriterModel, SourceReaderModel, StreamModel},
sql_processor::{
query_planner::QueryPlanner,
sql_parser::{CreatePump, ParseSuccess, SelectStreamSyntax, SqlParser},
},
stream_engine::command::{
alter_pipeline_command::AlterPipelineCommand, query_plan::QueryPlan, Command,
},
sql_processor::query_planner::QueryPlanner,
stream_engine::command::{AlterPipelineCommand, Command, QueryPlan},
};

#[derive(Debug, Default)]
Expand Down Expand Up @@ -129,7 +129,7 @@ mod tests {
SourceReaderModel, SourceReaderName, SourceReaderType, StreamModel, StreamName,
StreamShape,
},
stream_engine::command::alter_pipeline_command::AlterPipelineCommand,
stream_engine::command::AlterPipelineCommand,
};
use pretty_assertions::assert_eq;

Expand Down
7 changes: 3 additions & 4 deletions springql-core/src/sql_processor/query_planner.rs
Expand Up @@ -59,17 +59,16 @@ mod select_syntax_analyzer;

use crate::{
api::error::Result,
expr_resolver::{expr_label::ExprLabel, ExprResolver},
expr_resolver::{ExprLabel, ExprResolver},
pipeline::{
AggregateParameter, GroupByLabels, Pipeline, WindowOperationParameter, WindowParameter,
},
sql_processor::{
query_planner::select_syntax_analyzer::SelectSyntaxAnalyzer,
sql_parser::{GroupingElementSyntax, SelectStreamSyntax},
},
stream_engine::command::query_plan::{
query_plan_operation::{GroupAggregateWindowOp, JoinOp, LowerOps, ProjectionOp, UpperOps},
QueryPlan,
stream_engine::command::{
GroupAggregateWindowOp, JoinOp, LowerOps, ProjectionOp, QueryPlan, UpperOps,
},
};

Expand Down
Expand Up @@ -8,7 +8,7 @@ use crate::{
query_planner::SelectSyntaxAnalyzer,
sql_parser::{FromItemSyntax, SubFromItemSyntax},
},
stream_engine::command::query_plan::query_plan_operation::{CollectOp, JoinOp, JoinWindowOp},
stream_engine::command::{CollectOp, JoinOp, JoinWindowOp},
};

impl SelectSyntaxAnalyzer {
Expand Down
Expand Up @@ -3,7 +3,7 @@
use crate::{
pipeline::{PumpName, SinkWriterModel, SourceReaderModel, StreamModel},
sql_processor::sql_parser::syntax::SelectStreamSyntax,
stream_engine::command::insert_plan::InsertPlan,
stream_engine::command::InsertPlan,
};

#[allow(clippy::enum_variant_names)]
Expand Down
Expand Up @@ -34,8 +34,8 @@ use crate::{
},
},
stream_engine::{
command::insert_plan::InsertPlan,
time::duration::{event_duration::SpringEventDuration, SpringDuration},
command::InsertPlan,
time::{SpringDuration, SpringEventDuration},
NnSqlValue, SqlValue,
},
};
Expand Down
13 changes: 3 additions & 10 deletions springql-core/src/stream_engine.rs
Expand Up @@ -2,7 +2,7 @@

#![doc = include_str!("stream_engine.md")]

mod autonomous_executor;
pub mod autonomous_executor;
pub mod command;
mod in_memory_queue_repository;
mod sql_executor;
Expand All @@ -13,20 +13,13 @@ use std::sync::{Arc, Mutex, MutexGuard};
use anyhow::anyhow;

pub use crate::stream_engine::autonomous_executor::SpringValue;
pub use autonomous_executor::{
row::{
value::{NnSqlValue, SqlCompareResult, SqlValue},
Row,
},
task::Tuple,
};
pub use autonomous_executor::{NnSqlValue, Row, SqlCompareResult, SqlValue, Tuple};

use crate::{
api::{error::Result, SpringConfig, SpringError},
pipeline::{Pipeline, QueueName},
stream_engine::{
autonomous_executor::AutonomousExecutor,
command::alter_pipeline_command::AlterPipelineCommand,
autonomous_executor::AutonomousExecutor, command::AlterPipelineCommand,
in_memory_queue_repository::InMemoryQueueRepository, sql_executor::SqlExecutor,
},
};
Expand Down
44 changes: 23 additions & 21 deletions springql-core/src/stream_engine/autonomous_executor.rs
@@ -1,16 +1,8 @@
// This file is part of https://github.com/SpringQL/SpringQL which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details.

pub use row::SpringValue;

pub mod row;
pub mod task;

pub mod event_queue;

pub mod args;
pub mod main_job_lock;
pub mod worker;

mod args;
mod event_queue;
mod main_job_lock;
mod memory_state_machine;
mod memory_state_machine_worker;
mod performance_metrics;
Expand All @@ -19,8 +11,24 @@ mod pipeline_derivatives;
mod purger_worker;
mod queue;
mod repositories;
mod row;
mod task;
mod task_executor;
mod task_graph;
mod worker;

#[cfg(test)]
pub mod test_support;

pub use row::SpringValue;
pub use row::{
ColumnValues, JsonObject, NnSqlValue, Row, SourceRow, SqlCompareResult, SqlValue,
SqlValueHashKey, StreamColumns,
};
pub use task::{
NetClientSourceReader, NetServerSourceReader, SinkWriterRepository, SourceReader,
SourceReaderRepository, SourceTask, Task, TaskContext, Tuple, Window,
};

use std::sync::Arc;

Expand All @@ -32,24 +40,18 @@ use crate::{
pipeline::Pipeline,
stream_engine::autonomous_executor::{
args::{Coordinators, EventQueues, Locks},
event_queue::{
blocking_event_queue::BlockingEventQueue, event::Event,
non_blocking_event_queue::NonBlockingEventQueue,
},
event_queue::{BlockingEventQueue, Event, NonBlockingEventQueue},
main_job_lock::MainJobLock,
memory_state_machine_worker::MemoryStateMachineWorker,
performance_monitor_worker::PerformanceMonitorWorker,
pipeline_derivatives::PipelineDerivatives,
purger_worker::{purger_worker_thread::PurgerWorkerThreadArg, PurgerWorker},
purger_worker::{PurgerWorker, PurgerWorkerThreadArg},
repositories::Repositories,
task_executor::{task_executor_lock::TaskExecutorLock, TaskExecutor},
worker::worker_handle::{WorkerSetupCoordinator, WorkerStopCoordinator},
task_executor::{TaskExecutor, TaskExecutorLock},
worker::{WorkerSetupCoordinator, WorkerStopCoordinator},
},
};

#[cfg(test)]
pub mod test_support;

/// Automatically executes the latest task graph (uniquely deduced from the latest pipeline).
///
/// This also has PerformanceMonitorWorker and MemoryStateMachineWorker to dynamically switch task execution policies.
Expand Down
10 changes: 4 additions & 6 deletions springql-core/src/stream_engine/autonomous_executor/args.rs
Expand Up @@ -2,13 +2,11 @@

use std::sync::Arc;

use super::{
event_queue::{
blocking_event_queue::BlockingEventQueue, non_blocking_event_queue::NonBlockingEventQueue,
},
use crate::stream_engine::autonomous_executor::{
event_queue::{BlockingEventQueue, NonBlockingEventQueue},
main_job_lock::MainJobLock,
task_executor::task_executor_lock::TaskExecutorLock,
worker::worker_handle::{WorkerSetupCoordinator, WorkerStopCoordinator},
task_executor::TaskExecutorLock,
worker::{WorkerSetupCoordinator, WorkerStopCoordinator},
};

#[derive(Clone, Debug, new)]
Expand Down
Expand Up @@ -4,13 +4,15 @@
//!
//! To add/del events, modify `self::event` module.

pub mod blocking_event_queue;
pub mod event;
pub mod non_blocking_event_queue;
mod blocking_event_queue;
mod event;
mod non_blocking_event_queue;

use std::sync::mpsc;
pub use blocking_event_queue::BlockingEventQueue;
pub use event::{BlockingEventTag, Event, EventTag, NonBlockingEventTag};
pub use non_blocking_event_queue::NonBlockingEventQueue;

use crate::stream_engine::autonomous_executor::event_queue::event::Event;
use std::sync::mpsc;

#[derive(Debug, new)]
pub struct EventPoll {
Expand Down
Expand Up @@ -9,8 +9,7 @@ use std::sync::Arc;
use crate::stream_engine::autonomous_executor::{
memory_state_machine::MemoryStateTransition,
performance_metrics::{
metrics_update_command::MetricsUpdateByTaskExecutionOrPurge,
performance_metrics_summary::PerformanceMetricsSummary, PerformanceMetrics,
MetricsUpdateByTaskExecutionOrPurge, PerformanceMetrics, PerformanceMetricsSummary,
},
pipeline_derivatives::PipelineDerivatives,
};
Expand Down
Expand Up @@ -10,7 +10,7 @@
//! change their scheduler on Moderate and Severe state.
//! On Critical state, generic workers are stopped and purger worker cleans all rows and windows.

pub mod memory_state_machine_worker_thread;
mod memory_state_machine_worker_thread;

use std::sync::Arc;

Expand All @@ -23,7 +23,7 @@ use crate::{
memory_state_machine_worker::memory_state_machine_worker_thread::{
MemoryStateMachineWorkerThread, MemoryStateMachineWorkerThreadArg,
},
worker::worker_handle::WorkerHandle,
worker::WorkerHandle,
},
};

Expand Down
Expand Up @@ -3,22 +3,15 @@
use std::{sync::Arc, thread, time::Duration};

use crate::stream_engine::autonomous_executor::{
event_queue::{
event::{Event, EventTag, NonBlockingEventTag},
non_blocking_event_queue::NonBlockingEventQueue,
},
event_queue::{Event, EventTag, NonBlockingEventQueue, NonBlockingEventTag},
memory_state_machine::{
MemoryStateMachine, MemoryStateMachineThreshold, MemoryStateTransition,
},
performance_metrics::{
metrics_update_command::MetricsUpdateByTaskExecutionOrPurge,
performance_metrics_summary::PerformanceMetricsSummary, PerformanceMetrics,
MetricsUpdateByTaskExecutionOrPurge, PerformanceMetrics, PerformanceMetricsSummary,
},
pipeline_derivatives::PipelineDerivatives,
worker::{
worker_handle::WorkerSetupCoordinator,
worker_thread::{WorkerThread, WorkerThreadLoopState},
},
worker::{WorkerSetupCoordinator, WorkerThread, WorkerThreadLoopState},
};

/// Runs a worker thread.
Expand Down

0 comments on commit 1047c96

Please sign in to comment.