Skip to content

Commit

Permalink
Update to VALVE WIP commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesaoverton committed Nov 1, 2024
1 parent 76da659 commit 1bb1d23
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
12 changes: 11 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ rev = "f46fbd5450505644ed9970cef1ae14164699981f"
[dependencies.ontodev_valve]
# path = "../ontodev_demo/valve.rs"
git = "https://github.com/ontodev/valve.rs"
rev = "824fbd79cd5ff787d8863186ccda09d0a0b56eb2"
rev = "92ed973db0cf94ba849256fd62ffd29a77f0e948"

[dependencies.ontodev_sqlrest]
git = "https://github.com/ontodev/sqlrest.rs"
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,12 @@ endif
BINARY_PATH := build/$(BINARY)

# Build a Linux binary using Musl instead of GCC.
target/x86_64-unknown-linux-musl/release/nanobot: src/*.rs
target/x86_64-unknown-linux-musl/release/nanobot: Cargo.* src/*.rs
docker pull clux/muslrust:stable
docker run \
-v cargo-cache:/root/.cargo/registry \
-v $$PWD:/volume \
-v /home/knocean/valve.rs:/valve.rs \
--rm -t clux/muslrust:stable \
cargo build --release

Expand Down
9 changes: 6 additions & 3 deletions src/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ async fn get_page(
for col_config in column_configs.iter() {
let key = col_config.column.to_string();
let mut cmap_entry = json!(col_config).as_object_mut().unwrap().clone();
let sql_type = toolkit::get_sql_type_from_global_config(&valve.config, table, &key, &pool);
let sql_type =
toolkit::get_sql_type_from_global_config(&valve.config, table, &key, &valve.db_kind);

// Get table.column that use this column as a foreign key constraint
// and insert as "links".
Expand Down Expand Up @@ -766,7 +767,8 @@ pub fn get_undo_message(config: &Config) -> Option<String> {
}
Some(valve) => valve,
};
let change = block_on(valve.get_change_to_undo()).ok()??;
let changes = block_on(valve.get_changes_to_undo(1)).ok()?;
let change = changes.into_iter().nth(1)?;
Some(String::from(format!("Undo '{}'", change.message)))
}

Expand All @@ -779,7 +781,8 @@ pub fn get_redo_message(config: &Config) -> Option<String> {
}
Some(valve) => valve,
};
let change = block_on(valve.get_change_to_redo()).ok()??;
let changes = block_on(valve.get_changes_to_redo(1)).ok()?;
let change = changes.into_iter().nth(1)?;
Some(String::from(format!("Redo '{}'", change.message)))
}

Expand Down
2 changes: 1 addition & 1 deletion src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pub async fn init(config: &mut Config) -> Result<String, String> {
None => unreachable!("Valve is not initialized."),
Some(valve) => {
if config.create_only {
if let Err(e) = valve.create_all_tables().await {
if let Err(e) = valve.ensure_all_tables_created().await {
return Err(format!(
"VALVE error while creating from {}: {:?}",
valve_path, e
Expand Down
1 change: 1 addition & 0 deletions src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ async fn post_table(
tracing::info!("SAVE");
valve
.save_all_tables(&None)
.await
.map_err(|e| format!("{:?}", e))?;
request_type = RequestType::GET;
} else if form_params.contains_key("undo") {
Expand Down

0 comments on commit 1bb1d23

Please sign in to comment.