Compare commits
58 Commits
Author | SHA1 | Date | |
---|---|---|---|
6a179f0881 | |||
09546907e5
|
|||
83f9816cce | |||
c261d6cb65 | |||
fb01406738 | |||
352fd86145 | |||
bea5258e8f | |||
a0a256ac7f | |||
9cd12f8636 | |||
34fba9754c
|
|||
ee0680194b | |||
38f8db78cd | |||
02b8b8cd59 | |||
09fb11f9d9 | |||
102b35e083 | |||
986d261bd7 | |||
0f70cf9f7b | |||
eb30858d9d | |||
22900ba92a | |||
44ef8a708c | |||
acc7e0cd6d | |||
e8d222f4ba | |||
3c5fb25fa3 | |||
b3b170c057 | |||
e64fc61926
|
|||
4eb1a8224a | |||
6dfe2bf0d6 | |||
0e38e23942 | |||
c35aad3cf8 | |||
10c2282c78 | |||
35c4fae36a | |||
b11d72ca05 | |||
a97ef32ffb | |||
2873ff3d7e | |||
4096790f2a | |||
0ce0e691ee | |||
40dfbcd031 | |||
4ff3261dbc | |||
53c2cdf018 | |||
c96eebf6f9 | |||
9d9d6be3b7 | |||
f106929cca | |||
d876891242 | |||
6961987a77 | |||
d3695eba50 | |||
f175c4ebcf | |||
58df153c6e | |||
2b7a05bc4e | |||
fcb0ea7393 | |||
3a1741d7dc | |||
8886af4a8f | |||
08a6f77146 | |||
c15c7f0ae2 | |||
04c6e97f30 | |||
29e0c37599 | |||
e655c57f21 | |||
28fb99e6f9 | |||
3a231cea96 |
72
CHANGELOG.md
72
CHANGELOG.md
@@ -6,6 +6,78 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.5.0] - 2024-12-15
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- allow taking a local path
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- *(deps)* update rust crate serde to v1.0.216
|
||||||
|
- *(deps)* update rust crate prost to v0.13.4
|
||||||
|
|
||||||
|
### Other
|
||||||
|
- *(deps)* update rust crate clap to v4.5.23
|
||||||
|
- *(deps)* update all dependencies
|
||||||
|
- *(deps)* update rust crate tracing-subscriber to v0.3.19
|
||||||
|
- *(deps)* update rust crate tracing to v0.1.41
|
||||||
|
|
||||||
|
## [0.4.0] - 2024-11-23
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- update hyperlog
|
||||||
|
- add hyperlog
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- *(deps)* update rust crate tower-http to v0.6.2
|
||||||
|
- *(deps)* update rust crate serde to v1.0.215
|
||||||
|
- *(deps)* update rust crate serde to v1.0.214
|
||||||
|
- *(deps)* update rust crate serde to v1.0.213
|
||||||
|
- *(deps)* update rust crate ratatui to 0.29.0
|
||||||
|
- *(deps)* update rust crate serde_json to v1.0.132
|
||||||
|
- *(deps)* update rust crate serde_json to v1.0.129
|
||||||
|
- *(deps)* update rust crate uuid to v1.11.0
|
||||||
|
- *(deps)* update rust crate human-panic to v2.0.2
|
||||||
|
- *(deps)* update rust crate tower-http to v0.6.1
|
||||||
|
- *(deps)* update rust crate prost to v0.13.3
|
||||||
|
- *(deps)* update rust crate tower-http to 0.6.0
|
||||||
|
- *(deps)* update rust crate serde to v1.0.210
|
||||||
|
- *(deps)* update rust crate sqlx to v0.8.2
|
||||||
|
- *(deps)* update rust crate prost to v0.13.2
|
||||||
|
- *(deps)* update rust crate ratatui to v0.28.1
|
||||||
|
- *(deps)* update rust crate sqlx to v0.8.1
|
||||||
|
- *(deps)* update rust crate serde to v1.0.209
|
||||||
|
- *(deps)* update rust crate serde_json to v1.0.127
|
||||||
|
- *(deps)* update rust crate serde_json to v1.0.126
|
||||||
|
- *(deps)* update rust crate prost to 0.13.0
|
||||||
|
- *(deps)* update rust crate serde to v1.0.208
|
||||||
|
|
||||||
|
### Other
|
||||||
|
- *(deps)* update all dependencies
|
||||||
|
- *(deps)* update rust crate axum to v0.7.8
|
||||||
|
- *(deps)* update rust crate clap to v4.5.21
|
||||||
|
- *(deps)* update rust crate tempfile to v3.14.0
|
||||||
|
- *(deps)* update rust crate tokio to v1.41.1
|
||||||
|
- *(deps)* update rust crate anyhow to v1.0.93
|
||||||
|
- *(deps)* update rust crate anyhow to v1.0.92
|
||||||
|
- *(deps)* update all dependencies to v1.0.91
|
||||||
|
- *(deps)* update all dependencies
|
||||||
|
- *(deps)* update rust crate clap to v4.5.20
|
||||||
|
- *(deps)* update rust crate futures to v0.3.31
|
||||||
|
- *(deps)* update rust crate clap to v4.5.19
|
||||||
|
- *(deps)* update rust crate tempfile to v3.13.0
|
||||||
|
- *(deps)* update rust crate axum to v0.7.7
|
||||||
|
- *(deps)* update tonic monorepo to v0.12.3
|
||||||
|
- *(deps)* update all dependencies
|
||||||
|
- *(deps)* update rust crate anyhow to v1.0.89
|
||||||
|
- *(deps)* update rust crate anyhow to v1.0.88
|
||||||
|
- *(deps)* update rust crate anyhow to v1.0.87
|
||||||
|
- *(deps)* update rust crate similar-asserts to v1.6.0
|
||||||
|
- *(deps)* update all dependencies
|
||||||
|
- *(deps)* update rust crate tokio to v1.40.0
|
||||||
|
- *(deps)* update tonic monorepo to v0.12.2
|
||||||
|
- *(deps)* update tonic monorepo to 0.12.0
|
||||||
|
- *(deps)* update all dependencies
|
||||||
|
|
||||||
## [0.3.0] - 2024-06-30
|
## [0.3.0] - 2024-06-30
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
787
Cargo.lock
generated
787
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -19,11 +19,11 @@ serde = { version = "1.0.202", features = ["derive"] }
|
|||||||
serde_json = "1.0.117"
|
serde_json = "1.0.117"
|
||||||
itertools = "0.13.0"
|
itertools = "0.13.0"
|
||||||
uuid = { version = "1.8.0", features = ["v4"] }
|
uuid = { version = "1.8.0", features = ["v4"] }
|
||||||
tonic = { version = "0.11.0", features = ["tls", "tls-roots"] }
|
tonic = { version = "0.12.0", features = ["tls", "tls-roots"] }
|
||||||
futures = { version = "0.3.30" }
|
futures = { version = "0.3.30" }
|
||||||
sha2 = { version = "0.10.8" }
|
sha2 = { version = "0.10.8" }
|
||||||
hex = { version = "0.4.3" }
|
hex = { version = "0.4.3" }
|
||||||
toml = { version = "0.8.14" }
|
toml = { version = "0.8.14" }
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.3.0"
|
version = "0.5.0"
|
||||||
|
4
buf.yaml
Normal file
4
buf.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
version: v2
|
||||||
|
modules:
|
||||||
|
- path: crates/hyperlog-protos/proto
|
||||||
|
name: buf.build/noschemaplz/hyperlog
|
@@ -6,7 +6,7 @@ version.workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
tonic.workspace = true
|
tonic.workspace = true
|
||||||
|
|
||||||
prost = "0.12.6"
|
prost = "0.13.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tonic-build = "0.11.0"
|
tonic-build = "0.12.0"
|
||||||
|
@@ -16,8 +16,8 @@ serde_json.workspace = true
|
|||||||
uuid.workspace = true
|
uuid.workspace = true
|
||||||
tonic.workspace = true
|
tonic.workspace = true
|
||||||
|
|
||||||
tower-http = { version = "0.5.2", features = ["cors", "trace"] }
|
tower-http = { version = "0.6.0", features = ["cors", "trace"] }
|
||||||
sqlx = { version = "0.7.4", features = [
|
sqlx = { version = "0.8.0", features = [
|
||||||
"runtime-tokio",
|
"runtime-tokio",
|
||||||
"tls-rustls",
|
"tls-rustls",
|
||||||
"postgres",
|
"postgres",
|
||||||
|
@@ -22,8 +22,8 @@ uuid.workspace = true
|
|||||||
hex.workspace = true
|
hex.workspace = true
|
||||||
toml.workspace = true
|
toml.workspace = true
|
||||||
|
|
||||||
ratatui = "0.26.2"
|
ratatui = "0.29.0"
|
||||||
crossterm = { version = "0.27.0", features = ["event-stream"] }
|
crossterm = { version = "0.28.0", features = ["event-stream"] }
|
||||||
directories = "5.0.1"
|
directories = "5.0.1"
|
||||||
human-panic = "2.0.0"
|
human-panic = "2.0.0"
|
||||||
ropey = "1.6.1"
|
ropey = "1.6.1"
|
||||||
|
@@ -221,6 +221,7 @@ impl<'a> App<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn open_editor(&self, item: &GraphItem) -> Option<Command> {
|
fn open_editor(&self, item: &GraphItem) -> Option<Command> {
|
||||||
|
tracing::info!("entering editor for session");
|
||||||
match editor::EditorSession::new(item).execute() {
|
match editor::EditorSession::new(item).execute() {
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
tracing::info!("editor returned without changes, skipping");
|
tracing::info!("editor returned without changes, skipping");
|
||||||
|
@@ -392,7 +392,6 @@ impl<'a> StatefulWidget for GraphExplorer<'a> {
|
|||||||
|
|
||||||
fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) {
|
fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) {
|
||||||
let Rect { height, .. } = area;
|
let Rect { height, .. } = area;
|
||||||
let _height = height as usize;
|
|
||||||
|
|
||||||
if let Some(graph) = &state.graph {
|
if let Some(graph) = &state.graph {
|
||||||
let movement_graph: MovementGraph =
|
let movement_graph: MovementGraph =
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use tonic::transport::{Channel, ClientTlsConfig};
|
use tonic::transport::{Channel, ClientTlsConfig};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -7,34 +9,37 @@ use crate::{
|
|||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub struct State {
|
pub struct State {
|
||||||
engine: SharedEngine,
|
|
||||||
pub storage: Storage,
|
|
||||||
events: Events,
|
|
||||||
|
|
||||||
pub commander: Commander,
|
pub commander: Commander,
|
||||||
pub querier: Querier,
|
pub querier: Querier,
|
||||||
|
|
||||||
|
backend: Backend,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Backend {
|
pub enum Backend {
|
||||||
Local,
|
Local { path_override: Option<PathBuf> },
|
||||||
Remote { url: String },
|
Remote { url: String },
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
pub async fn new(backend: Backend) -> anyhow::Result<Self> {
|
pub async fn new(backend: Backend) -> anyhow::Result<Self> {
|
||||||
let storage = Storage::new();
|
let (querier, commander) = match &backend {
|
||||||
let engine = storage.load()?;
|
Backend::Local { path_override } => {
|
||||||
let events = Events::default();
|
let mut storage = Storage::new();
|
||||||
let engine = SharedEngine::from(engine);
|
if let Some(path_override) = path_override {
|
||||||
|
storage.with_base(path_override);
|
||||||
let (querier, commander) = match backend {
|
}
|
||||||
Backend::Local => (
|
let engine = storage.load()?;
|
||||||
Querier::local(&engine),
|
let events = Events::default();
|
||||||
Commander::local(engine.clone(), storage.clone(), events.clone())?,
|
let engine = SharedEngine::from(engine);
|
||||||
),
|
(
|
||||||
|
Querier::local(&engine),
|
||||||
|
Commander::local(engine.clone(), storage.clone(), events.clone())?,
|
||||||
|
)
|
||||||
|
}
|
||||||
Backend::Remote { url } => {
|
Backend::Remote { url } => {
|
||||||
let channel = Channel::from_shared(url)?
|
let tls = ClientTlsConfig::new();
|
||||||
.tls_config(ClientTlsConfig::new())?
|
let channel = Channel::from_shared(url.clone())?
|
||||||
|
.tls_config(tls.with_native_roots())?
|
||||||
.connect()
|
.connect()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
@@ -46,12 +51,31 @@ impl State {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
engine: engine.clone(),
|
|
||||||
storage: storage.clone(),
|
|
||||||
events: events.clone(),
|
|
||||||
|
|
||||||
commander,
|
commander,
|
||||||
querier,
|
querier,
|
||||||
|
backend,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn unlock(&self) {
|
||||||
|
if let Backend::Local { path_override } = &self.backend {
|
||||||
|
let mut storage = Storage::new();
|
||||||
|
if let Some(path_override) = path_override {
|
||||||
|
storage.with_base(path_override);
|
||||||
|
}
|
||||||
|
storage.clear_lock_file();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn info(&self) -> Option<anyhow::Result<String>> {
|
||||||
|
if let Backend::Local { path_override } = &self.backend {
|
||||||
|
let mut storage = Storage::new();
|
||||||
|
if let Some(path_override) = path_override {
|
||||||
|
storage.with_base(path_override);
|
||||||
|
}
|
||||||
|
return Some(storage.info());
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,10 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
|
use crossterm::{
|
||||||
|
terminal::{disable_raw_mode, enable_raw_mode},
|
||||||
|
ExecutableCommand,
|
||||||
|
};
|
||||||
use hyperlog_core::log::{GraphItem, ItemState};
|
use hyperlog_core::log::{GraphItem, ItemState};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -127,6 +131,11 @@ impl SessionFile {
|
|||||||
|
|
||||||
impl Drop for SessionFile {
|
impl Drop for SessionFile {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
// std::io::stdout()
|
||||||
|
// .execute(crossterm::terminal::EnterAlternateScreen)
|
||||||
|
// .expect("to be able to restore alternative mode");
|
||||||
|
// enable_raw_mode().expect("to be able to restore raw mode");
|
||||||
|
|
||||||
if self.path.exists() {
|
if self.path.exists() {
|
||||||
tracing::debug!("cleaning up file: {}", self.path.display());
|
tracing::debug!("cleaning up file: {}", self.path.display());
|
||||||
|
|
||||||
@@ -180,6 +189,7 @@ impl<'a> EditorSession<'a> {
|
|||||||
.as_bytes(),
|
.as_bytes(),
|
||||||
)
|
)
|
||||||
.context("failed to write to file")?;
|
.context("failed to write to file")?;
|
||||||
|
file.flush().context("failed to flush to disk")?;
|
||||||
|
|
||||||
let modified_time = file.metadata()?.modified()?;
|
let modified_time = file.metadata()?.modified()?;
|
||||||
|
|
||||||
@@ -209,7 +219,26 @@ impl<'a> EditorSession<'a> {
|
|||||||
editor,
|
editor,
|
||||||
session_file.get_path().display()
|
session_file.get_path().display()
|
||||||
);
|
);
|
||||||
if let Err(e) = std::process::Command::new(editor)
|
|
||||||
|
std::io::stdout().flush()?;
|
||||||
|
|
||||||
|
// disable_raw_mode()?;
|
||||||
|
// std::io::stdout().execute(crossterm::terminal::LeaveAlternateScreen)?;
|
||||||
|
|
||||||
|
let path = session_file.get_path();
|
||||||
|
if let Some(parent) = path.parent() {
|
||||||
|
if let Err(e) = std::process::Command::new(editor)
|
||||||
|
.arg(
|
||||||
|
path.file_name()
|
||||||
|
.ok_or(anyhow::anyhow!("failed to find file in the given path"))?,
|
||||||
|
)
|
||||||
|
.current_dir(parent)
|
||||||
|
.status()
|
||||||
|
{
|
||||||
|
tracing::error!("failed command with: {}", e);
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
} else if let Err(e) = std::process::Command::new(editor)
|
||||||
.arg(session_file.get_path())
|
.arg(session_file.get_path())
|
||||||
.status()
|
.status()
|
||||||
{
|
{
|
||||||
@@ -238,7 +267,7 @@ trait ItemExt {
|
|||||||
fn get_digest(&self) -> Option<String>;
|
fn get_digest(&self) -> Option<String>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ItemExt for &'a GraphItem {
|
impl ItemExt for &GraphItem {
|
||||||
fn get_digest(&self) -> Option<String> {
|
fn get_digest(&self) -> Option<String> {
|
||||||
if let GraphItem::Item { title, .. } = self {
|
if let GraphItem::Item { title, .. } = self {
|
||||||
let digest = sha2::Sha256::digest(title.as_bytes());
|
let digest = sha2::Sha256::digest(title.as_bytes());
|
||||||
|
@@ -31,7 +31,7 @@ pub mod state;
|
|||||||
mod engine;
|
mod engine;
|
||||||
mod events;
|
mod events;
|
||||||
mod querier;
|
mod querier;
|
||||||
mod storage;
|
pub mod storage;
|
||||||
|
|
||||||
mod editor;
|
mod editor;
|
||||||
mod logging;
|
mod logging;
|
||||||
|
@@ -80,6 +80,13 @@ impl Storage {
|
|||||||
pub fn clear_lock_file(self) {
|
pub fn clear_lock_file(self) {
|
||||||
let mut lock_file = self.lock_file.lock().unwrap();
|
let mut lock_file = self.lock_file.lock().unwrap();
|
||||||
|
|
||||||
|
if let Ok(lock) = self.state_lock() {
|
||||||
|
if lock.exists() {
|
||||||
|
tracing::info!("clearing lock file");
|
||||||
|
std::fs::remove_file(&lock).expect("to be able to remove lockfile");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if lock_file.is_some() {
|
if lock_file.is_some() {
|
||||||
*lock_file = None;
|
*lock_file = None;
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use clap::{Parser, Subcommand, ValueEnum};
|
use clap::{Parser, Subcommand, ValueEnum};
|
||||||
use hyperlog_tui::{
|
use hyperlog_tui::{
|
||||||
commander,
|
commander,
|
||||||
@@ -15,6 +17,9 @@ struct Command {
|
|||||||
|
|
||||||
#[arg(long = "backend-url", required_if_eq("backend", "remote"))]
|
#[arg(long = "backend-url", required_if_eq("backend", "remote"))]
|
||||||
backend_url: Option<String>,
|
backend_url: Option<String>,
|
||||||
|
|
||||||
|
#[arg(long = "local-path")]
|
||||||
|
local_path: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ValueEnum, Clone)]
|
#[derive(ValueEnum, Clone)]
|
||||||
@@ -90,7 +95,9 @@ pub async fn execute() -> anyhow::Result<()> {
|
|||||||
let backend_url = cli.backend_url;
|
let backend_url = cli.backend_url;
|
||||||
|
|
||||||
let backend = match backend {
|
let backend = match backend {
|
||||||
BackendArg::Local => Backend::Local,
|
BackendArg::Local => Backend::Local {
|
||||||
|
path_override: cli.local_path.clone(),
|
||||||
|
},
|
||||||
BackendArg::Remote => Backend::Remote {
|
BackendArg::Remote => Backend::Remote {
|
||||||
url: backend_url.expect("backend-url to be set"),
|
url: backend_url.expect("backend-url to be set"),
|
||||||
},
|
},
|
||||||
@@ -164,11 +171,13 @@ pub async fn execute() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
Some(Commands::Info {}) => {
|
Some(Commands::Info {}) => {
|
||||||
let state = State::new(backend).await?;
|
let state = State::new(backend).await?;
|
||||||
println!("graph stored at: {}", state.storage.info()?)
|
if let Some(info) = state.info() {
|
||||||
|
println!("graph stored at: {}", info?);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Some(Commands::ClearLock {}) => {
|
Some(Commands::ClearLock {}) => {
|
||||||
let state = State::new(backend).await?;
|
let state = State::new(backend).await?;
|
||||||
state.storage.clear_lock_file();
|
state.unlock();
|
||||||
println!("cleared lock file");
|
println!("cleared lock file");
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
Reference in New Issue
Block a user