1#![doc(
39 html_logo_url = "https://genc-murat.github.io/DockQL/logo.svg",
40 html_favicon_url = "https://genc-murat.github.io/DockQL/logo.svg"
41)]
42#![allow(
43 clippy::cast_possible_truncation,
44 clippy::cast_precision_loss,
45 clippy::cast_sign_loss,
46 clippy::cast_possible_wrap,
47 clippy::too_many_lines,
48 clippy::future_not_send,
49 clippy::missing_errors_doc,
50 clippy::missing_panics_doc
51)]
52
53pub mod alerts;
54pub mod analyze;
55pub mod ast;
56pub mod cli;
57pub mod collector;
58pub mod config;
59pub mod dashboard;
60pub mod docker;
61pub mod eval;
62pub mod events;
63pub mod executor;
64pub mod export;
65pub mod metrics;
66pub mod parser;
67pub mod planner;
68pub mod repl;
69pub mod semantic;
70pub mod sqlite_store;
71pub mod storage;
72
73pub use cli::Cli;
74pub use cli::OutputFormat;
75pub use export::ExportFormat;
76
77pub(crate) fn json_string(value: impl Into<String>) -> serde_json::Value {
79 serde_json::Value::String(value.into())
80}
81
82pub(crate) const fn target_alias(target: ast::CollectionTarget) -> &'static str {
84 match target {
85 ast::CollectionTarget::Containers => "c",
86 ast::CollectionTarget::Images => "i",
87 ast::CollectionTarget::Networks => "n",
88 ast::CollectionTarget::Volumes => "v",
89 }
90}
91
92pub const ANSI_RESET: &str = "\x1b[0m";
98
99pub const ANSI_BOLD: &str = "\x1b[1m";
101pub const ANSI_DIM: &str = "\x1b[2m";
102pub const ANSI_ITALIC: &str = "\x1b[3m";
103pub const ANSI_UNDERLINE: &str = "\x1b[4m";
104
105pub const ANSI_FG_BLACK: &str = "\x1b[30m";
107pub const ANSI_FG_RED: &str = "\x1b[31m";
108pub const ANSI_FG_GREEN: &str = "\x1b[32m";
109pub const ANSI_FG_YELLOW: &str = "\x1b[33m";
110pub const ANSI_FG_BLUE: &str = "\x1b[34m";
111pub const ANSI_FG_MAGENTA: &str = "\x1b[35m";
112pub const ANSI_FG_CYAN: &str = "\x1b[36m";
113pub const ANSI_FG_WHITE: &str = "\x1b[37m";
114
115pub const ANSI_FG_DARK_GRAY: &str = "\x1b[90m";
117pub const ANSI_FG_LIGHT_RED: &str = "\x1b[91m";
118pub const ANSI_FG_LIGHT_GREEN: &str = "\x1b[92m";
119pub const ANSI_FG_LIGHT_YELLOW: &str = "\x1b[93m";
120pub const ANSI_FG_LIGHT_BLUE: &str = "\x1b[94m";
121pub const ANSI_FG_LIGHT_MAGENTA: &str = "\x1b[95m";
122pub const ANSI_FG_LIGHT_CYAN: &str = "\x1b[96m";
123
124pub(crate) const ANSI_BG_BLACK: &str = "\x1b[40m";
126pub(crate) const ANSI_BG_RED: &str = "\x1b[41m";
127pub(crate) const ANSI_BG_GREEN: &str = "\x1b[42m";
128pub(crate) const ANSI_BG_YELLOW: &str = "\x1b[43m";
129pub(crate) const ANSI_BG_BLUE: &str = "\x1b[44m";
130pub(crate) const ANSI_BG_MAGENTA: &str = "\x1b[45m";
131pub(crate) const ANSI_BG_CYAN: &str = "\x1b[46m";
132pub(crate) const ANSI_BG_WHITE: &str = "\x1b[47m";
133
134pub(crate) const ANSI_BG_DARK_GRAY: &str = "\x1b[100m";
136pub(crate) const ANSI_BG_LIGHT_RED: &str = "\x1b[101m";
137pub(crate) const ANSI_BG_LIGHT_GREEN: &str = "\x1b[102m";
138pub(crate) const ANSI_BG_LIGHT_YELLOW: &str = "\x1b[103m";
139pub(crate) const ANSI_BG_LIGHT_BLUE: &str = "\x1b[104m";
140pub(crate) const ANSI_BG_LIGHT_MAGENTA: &str = "\x1b[105m";
141pub(crate) const ANSI_BG_LIGHT_CYAN: &str = "\x1b[106m";
142
143pub(crate) const ANSI_BOLD_RED: &str = "\x1b[31;1m";
145
146pub(crate) const ANSI_TITLE_DARK: &str = "\x1b[1;36m";
148pub(crate) const ANSI_HEADER_DARK: &str = "\x1b[1;4;37m";
150pub(crate) const ANSI_TITLE_LIGHT: &str = "\x1b[1;34m";
152pub(crate) const ANSI_HEADER_LIGHT: &str = "\x1b[1;4;30m";
154
155pub const ONE_GB: u64 = 1_073_741_824;
161
162pub const HALF_GB: u64 = 536_870_912;
164
165pub const CPU_RED_THRESHOLD: f64 = 80.0;
167
168pub const CPU_YELLOW_THRESHOLD: f64 = 50.0;
170
171pub(crate) const ALERT_EVAL_INTERVAL: u64 = 5;
173
174pub(crate) const DEFAULT_METRICS_INTERVAL: u64 = 30;
176
177pub(crate) const DEFAULT_SNAPSHOT_INTERVAL: u64 = 300;