chore: remove extra logs
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
5548d8e36e
commit
874045dca8
@ -1,5 +1,6 @@
|
|||||||
use hyperlog_core::log::{GraphItem, ItemState};
|
use hyperlog_core::log::{GraphItem, ItemState};
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
CreateRoot {
|
CreateRoot {
|
||||||
root: String,
|
root: String,
|
||||||
@ -33,8 +34,10 @@ pub enum Command {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub struct Commander {}
|
pub struct Commander {}
|
||||||
|
|
||||||
|
#[allow(dead_code, unused_variables)]
|
||||||
impl Commander {
|
impl Commander {
|
||||||
pub fn execute(&self, cmd: Command) -> anyhow::Result<()> {
|
pub fn execute(&self, cmd: Command) -> anyhow::Result<()> {
|
||||||
match cmd {
|
match cmd {
|
||||||
@ -57,8 +60,6 @@ impl Commander {
|
|||||||
Command::ToggleItem { root, path } => todo!(),
|
Command::ToggleItem { root, path } => todo!(),
|
||||||
Command::Move { root, src, dest } => todo!(),
|
Command::Move { root, src, dest } => todo!(),
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create_root(&self, root: &str) -> anyhow::Result<()> {
|
pub async fn create_root(&self, root: &str) -> anyhow::Result<()> {
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
use std::{collections::HashMap, net::SocketAddr};
|
|
||||||
|
|
||||||
use hyperlog_protos::hyperlog::{
|
use hyperlog_protos::hyperlog::{
|
||||||
graph_server::{Graph, GraphServer},
|
graph_server::{Graph, GraphServer},
|
||||||
*,
|
*,
|
||||||
};
|
};
|
||||||
|
use std::net::SocketAddr;
|
||||||
use tonic::{transport, Response};
|
use tonic::{transport, Response};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -11,6 +10,7 @@ use crate::{
|
|||||||
state::SharedState,
|
state::SharedState,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub struct Server {
|
pub struct Server {
|
||||||
querier: Querier,
|
querier: Querier,
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::{net::SocketAddr, sync::Arc};
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
use axum::{extract::MatchedPath, http::Request, routing::get, Router};
|
use axum::{extract::MatchedPath, http::Request, routing::get, Router};
|
||||||
use tower_http::trace::TraceLayer;
|
use tower_http::trace::TraceLayer;
|
||||||
|
@ -31,7 +31,6 @@ impl IntoCommand for BatchCommand {
|
|||||||
for command in self.commands {
|
for command in self.commands {
|
||||||
let msg = command.execute(dispatch.clone());
|
let msg = command.execute(dispatch.clone());
|
||||||
if let Some(msg) = msg {
|
if let Some(msg) = msg {
|
||||||
tracing::info!("executing batch command for msg: {:?}", msg);
|
|
||||||
dispatch.send(msg);
|
dispatch.send(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,6 @@ use crate::{
|
|||||||
state::SharedState,
|
state::SharedState,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::IntoCommand;
|
|
||||||
|
|
||||||
pub struct UpdateGraphCommand {
|
pub struct UpdateGraphCommand {
|
||||||
querier: Querier,
|
querier: Querier,
|
||||||
}
|
}
|
||||||
@ -26,11 +24,6 @@ impl UpdateGraphCommand {
|
|||||||
let now = std::time::SystemTime::now();
|
let now = std::time::SystemTime::now();
|
||||||
dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Initiated));
|
dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Initiated));
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
{
|
|
||||||
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
|
|
||||||
}
|
|
||||||
|
|
||||||
match self
|
match self
|
||||||
.querier
|
.querier
|
||||||
.get_async(&root, path)
|
.get_async(&root, path)
|
||||||
@ -38,6 +31,15 @@ impl UpdateGraphCommand {
|
|||||||
.ok_or(anyhow::anyhow!("failed to find path"))
|
.ok_or(anyhow::anyhow!("failed to find path"))
|
||||||
{
|
{
|
||||||
Ok(graph) => {
|
Ok(graph) => {
|
||||||
|
dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Optimistic(
|
||||||
|
graph.clone(),
|
||||||
|
)));
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
{
|
||||||
|
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Success(graph)))
|
dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Success(graph)))
|
||||||
}
|
}
|
||||||
Err(e) => dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Failure(
|
Err(e) => dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Failure(
|
||||||
|
@ -65,6 +65,10 @@ impl<'a> GraphExplorerState<'a> {
|
|||||||
GraphUpdatedEvent::Failure(e) => {
|
GraphUpdatedEvent::Failure(e) => {
|
||||||
tracing::error!("graph update failed: {}", e);
|
tracing::error!("graph update failed: {}", e);
|
||||||
}
|
}
|
||||||
|
GraphUpdatedEvent::Optimistic(graph) => {
|
||||||
|
tracing::trace!("graph updated optimistically");
|
||||||
|
self.graph = Some(graph.clone());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ pub enum Msg {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum GraphUpdatedEvent {
|
pub enum GraphUpdatedEvent {
|
||||||
Initiated,
|
Initiated,
|
||||||
|
Optimistic(GraphItem),
|
||||||
Success(GraphItem),
|
Success(GraphItem),
|
||||||
Failure(String),
|
Failure(String),
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use hyperlog_tui::{commander, core_state::State, state};
|
use hyperlog_tui::{commander, core_state::State};
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(author, version, about, long_about = None)]
|
#[command(author, version, about, long_about = None)]
|
||||||
|
Loading…
Reference in New Issue
Block a user