Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #37

Merged
merged 7 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
272 changes: 154 additions & 118 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ default-members = [
resolver = "2"

[workspace.package]
version = "0.0.5"
version = "0.0.6"
edition = "2021"
authors = ["Yann Prono <yann.prono@maif.fr>"]
readme = "README.md"
Expand All @@ -32,12 +32,12 @@ license = "Apache-2.0"


[workspace.dependencies]
lib = { package = "yozefu-lib", path = "crates/lib/", version = "0.0.5" }
app = { package = "yozefu-app", path = "crates/app/", version = "0.0.5" }
command = { package = "yozefu-command", path = "crates/command/", version = "0.0.5" }
yozefu = { package = "yozefu", path = "crates/bin/", version = "0.0.5" }
tui = { package = "yozefu-tui", path = "crates/tui/", version = "0.0.5" }
wasm-types = { package = "wasm-types", path = "crates/wasm-types/", version = "0.0.5" }
lib = { package = "yozefu-lib", path = "crates/lib/", version = "0.0.6" }
app = { package = "yozefu-app", path = "crates/app/", version = "0.0.6" }
command = { package = "yozefu-command", path = "crates/command/", version = "0.0.6" }
yozefu = { package = "yozefu", path = "crates/bin/", version = "0.0.6" }
tui = { package = "yozefu-tui", path = "crates/tui/", version = "0.0.6" }
wasm-types = { package = "wasm-types", path = "crates/wasm-types/", version = "0.0.6" }

[profile.release]
opt-level = 3
Expand Down
4 changes: 2 additions & 2 deletions crates/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ repository.workspace = true

[dependencies]
serde = { version = "1.0.217", features = ["derive"] }
serde_json = { version = "1.0.137", features = ["preserve_order"] }
serde_json = { version = "1.0.138", features = ["preserve_order"] }
log = "0.4.25"
lib = { workspace = true, features = ["native"] }
itertools = "0.14.0"
thousands = "0.2.0"
indexmap = "2.7.1"
rdkafka = { version = "0.37.0", features = ["cmake-build"] }
async-trait = "0.1.85"
async-trait = "0.1.86"
extism = "1.9.1"
url = { version = "2.5.4", features = ["serde"] }
resolve-path = "0.1.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/app/src/configuration/cluster_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use url::Url;
use super::Configuration;

/// List of kafka properties that are a file location.
const KAFKA_PROPERTIES_WITH_LOCATIONS: [&str; 6] = [
pub const KAFKA_PROPERTIES_WITH_LOCATIONS: [&str; 6] = [
"ssl.ca.location",
"ssl.certificate.location",
"ssl.key.location",
Expand Down
1 change: 1 addition & 0 deletions crates/app/src/configuration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mod yozefu_config;

pub use cluster_config::ClusterConfig;
pub use cluster_config::SchemaRegistryConfig;
pub use cluster_config::KAFKA_PROPERTIES_WITH_LOCATIONS;
pub use global_config::GlobalConfig;
pub use internal_config::InternalConfig;
pub use yozefu_config::YozefuConfig;
Expand Down
8 changes: 4 additions & 4 deletions crates/command/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ repository.workspace = true


[dependencies]
clap = { version = "4.5.27", features = [
clap = { version = "4.5.28", features = [
"derive",
"env",
"color",
"suggestions",
] }
serde_json = { version = "1.0.137", features = ["preserve_order"] }
serde_json = { version = "1.0.138", features = ["preserve_order"] }
log = "0.4.25"
env_logger = "0.11.6"
chrono = "0.4.39"
strum = { version = "0.26.3", features = ["derive", "strum_macros"] }
indicatif = { version = "0.17.9", features = ["tokio"] }
tempfile = "3.15.0"
indicatif = { version = "0.17.11", features = ["tokio"] }
tempfile = "3.16.0"
tokio-util = "0.7.13"
futures = "0.3.31"
itertools = "0.14.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ repository.workspace = true

[dependencies]
serde = { version = "1.0.217", features = ["derive"] }
serde_json = { version = "1.0.137", features = ["preserve_order"] }
serde_json = { version = "1.0.138", features = ["preserve_order"] }
chrono = { version = "0.4.39", features = ["serde"], optional = true }
itertools = "0.14.0"
strum = { version = "0.26.3", features = ["derive", "strum_macros"], optional = true }
fuzzydate = {version = "0.2.2", optional = true }
nom = "8.0.0-beta.1"
nom = "8.0.0"
rdkafka = { version = "0.37.0", features = [], optional = true}
url = "2.5.4"
apache-avro = "0.17.0"
Expand Down
6 changes: 3 additions & 3 deletions crates/tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repository.workspace = true
[dependencies]
tokio = { version = "1", features = ["full", "tracing"] }
serde = { version = "1.0.217", features = ["derive"] }
serde_json = { version = "1.0.137", features = ["preserve_order"] }
serde_json = { version = "1.0.138", features = ["preserve_order"] }
log = "0.4.25"
tui-input = "0.11.1"
chrono = "0.4.39"
Expand All @@ -28,13 +28,13 @@ ratatui = { version = "0.29.0", features = ["serde", "unstable-rendered-line-inf
crossterm = { version = "0.28.1", features = ["event-stream"] }
itertools = "0.14.0"
bytesize = { version = "1.3.0" }
nom = "8.0.0-beta.1"
nom = "8.0.0"
throbber-widgets-tui = "0.8.0"
futures = "0.3.31"
open = "5.3.2"
tokio-util = "0.7.13"
thousands = "0.2.0"
circular-buffer = "0.1.9"
circular-buffer = "1.0.0"
copypasta = "0.10.1"
rayon = "1.10.0"
lib = { workspace = true }
Expand Down
23 changes: 20 additions & 3 deletions crates/tui/src/component/root_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
//! and renders components based on the current context.
use app::configuration::GlobalConfig;
use copypasta::{ClipboardContext, ClipboardProvider};
use log::warn;
use std::{
collections::HashMap,
sync::{Arc, Mutex},
};

use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use ratatui::{
layout::{Constraint, Direction, Layout, Margin, Rect},
widgets::Clear,
layout::{Constraint, Direction, Flex, Layout, Margin, Rect},
widgets::{Clear, Paragraph},
Frame,
};
use tokio::sync::{mpsc::UnboundedSender, watch::Receiver};
Expand Down Expand Up @@ -243,7 +244,7 @@ impl Component for RootComponent {
match self.views.first().unwrap() {
ComponentName::Records => self.views[0] = ComponentName::TopicsAndRecords,
ComponentName::TopicsAndRecords => self.views[0] = ComponentName::Records,
_ => unreachable!("nope nope"),
_ => warn!("View '{}' does not support toggling. This instruction should not be unreachable", self.views.first().unwrap()),
}
self.notify_footer()?;
if self.views.len() == 1 {
Expand Down Expand Up @@ -342,6 +343,22 @@ impl Component for RootComponent {
}

fn draw(&mut self, f: &mut Frame<'_>, rect: Rect, _: &State) -> Result<(), TuiError> {
if rect.width < 20 && rect.height < 4 {
let [area] = Layout::horizontal([Constraint::Length(4)])
.flex(Flex::Center)
.areas(rect);
let [area] = Layout::vertical([Constraint::Length(1)])
.flex(Flex::Center)
.areas(area);

f.render_widget(
Paragraph::new(
String::from_utf8(vec![74, 32, 226, 157, 164, 239, 184, 143]).unwrap(),
),
area,
);
return Ok(());
}
let mut a = self.buffer_rx.clone();
let BufferAction::Count(count) = *a.borrow_and_update();
self.progress_bar.set_progress(count.1);
Expand Down
4 changes: 0 additions & 4 deletions crates/tui/src/component/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,6 @@ impl Ui {
self.load_topics(action_tx.clone())?;
let mut tui = tui::Tui::new()?;
tui.enter()?;
self.records
.lock()
.unwrap()
.register_action_handler(action_tx.clone());
self.root.register_action_handler(action_tx.clone())?;
self.root.init()?;
if !topics.is_empty() {
Expand Down
13 changes: 1 addition & 12 deletions crates/tui/src/records_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ use lib::{
KafkaRecord,
};
use rayon::prelude::*;
use tokio::sync::{
mpsc::UnboundedSender,
watch::{self, Receiver, Sender},
};

use crate::action::Action;
use tokio::sync::watch::{self, Receiver, Sender};

/// Size of the ring buffer
#[cfg(not(target_family = "windows"))]
Expand All @@ -28,7 +23,6 @@ const BUFFER_SIZE: usize = 120;
/// Wrapper around [CircularBuffer]
pub struct RecordsBuffer {
buffer: CircularBuffer<BUFFER_SIZE, KafkaRecord>,
tx_action: Option<UnboundedSender<Action>>,
read: usize,
pub channels: (Sender<BufferAction>, Receiver<BufferAction>),
last_time_sorted: usize,
Expand Down Expand Up @@ -61,14 +55,9 @@ impl RecordsBuffer {
channels: watch::channel(BufferAction::Count((0, 0, 0))),
matched: 0,
last_time_sorted: 0,
tx_action: None,
}
}

pub fn register_action_handler(&mut self, tx: UnboundedSender<Action>) {
self.tx_action = Some(tx);
}

pub fn is_empty(&self) -> bool {
self.buffer.is_empty()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/wasm-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ repository.workspace = true

[dependencies]
serde = { version = "1.0.217", features = ["derive"] }
serde_json = { version = "1.0.137", features = ["preserve_order"] }
serde_json = { version = "1.0.138", features = ["preserve_order"] }
lib = { workspace = true }
3 changes: 3 additions & 0 deletions docs/name/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# What does the name Yōzefu mean?

It's a reference to the main character of **The Trial**, the novel of Franz Kafka.
2 changes: 1 addition & 1 deletion docs/query-language/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ value contains "release"
```


5. Records where the `md5(key)` is equals to the user-provided parameter. A [search filter](./search-filter/README.md) must be implemented for this example.
5. Records where the `md5(key)` is equals to the user-provided parameter. A [search filter](../search-filter/README.md) must be implemented for this example.
```sql
from begin md5-key-equals-to("d131dd02c5e6eec4693d9a0698aff95c2fcab58712467eab4004583eb8fb7f89")
```
6 changes: 3 additions & 3 deletions docs/try-it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ then
echo -e " It looks like you haven't installed \033[1myozefu\033[0m yet:"
echo " 1. Go to https://github.com/MAIF/yozefu/releases/latest"
echo " 2. Download the binary that matches your operating system"
echo " 3. curl -L 'https://github.com/MAIF/yozefu/releases/download/<version>/yozefu-<target>-<version>.tar.gz' | tar xvz"
echo " 4. mv yozefu-* yozf"
echo " 5. Run './yozf -c localhost'"
echo " curl -L 'https://github.com/MAIF/yozefu/releases/download/<version>/yozefu-<target>-<version>.tar.gz' | tar xvz"
echo " 3. mv yozf-* yozf"
echo " 4. Run './yozf -c localhost'"
fi
else
echo " 🎉 Finally, start the tool"
Expand Down
Loading