Skip to content

Commit

Permalink
chore: with further debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
gk-kindred committed May 29, 2024
1 parent df45d9c commit cb019ee
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 344 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ coverage
.env
#### node ####
node_modules
*.node
# *.node
.yarn/
dist/

Expand Down
2 changes: 1 addition & 1 deletion scylla_operations/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl ScyllaOperations {
}
}
#[async_trait]
pub trait Persistence
pub trait Persistence: std::fmt::Debug
where
Self::PersistenceError: From<ScyllaOperationsError>,
{
Expand Down
2 changes: 1 addition & 1 deletion scylla_pg_client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Scylla {
static async initiate(dbConfig) {
let scyllaManager = await ScyllaManager.initPgConfig(dbConfig);
console.log("[SCYLA] dbConfig...", dbConfig);
console.log("[SCYLA] Scylla manager...", await scyllaManager.getTasks({ limit: 20 }));
// console.log("[SCYLA] Scylla manager...", await scyllaManager.getTasks({ limit: 20 }))
let sc = new Scylla(scyllaManager);
return sc;
}
Expand Down
2 changes: 1 addition & 1 deletion scylla_pg_client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Scylla {
public static async initiate(dbConfig: DbConfig): Promise<Scylla> {
let scyllaManager: ScyllaManager = await ScyllaManager.initPgConfig(dbConfig as JsDbConfig)
console.log("[SCYLA] dbConfig...", dbConfig)
console.log("[SCYLA] Scylla manager...", await scyllaManager.getTasks({ limit: 20 }))
// console.log("[SCYLA] Scylla manager...", await scyllaManager.getTasks({ limit: 20 }))
let sc = new Scylla(scyllaManager);
return sc;
}
Expand Down
585 changes: 248 additions & 337 deletions scylla_pg_client/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions scylla_pg_client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"email": "asharmaanil@gmail.com",
"license": "MIT",
"dependencies": {
"scylla_pg_js": "0.1.24"
"scylla_pg_js": "file:../scylla_pg_js"
},
"devDependencies": {
"@ava/typescript": "^4.1.0",
Expand All @@ -37,4 +37,4 @@
"build": "tsc",
"test": "ava"
}
}
}
Binary file added scylla_pg_js/scylla_pg_js.darwin-arm64.node
Binary file not shown.
6 changes: 5 additions & 1 deletion scylla_pg_js/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ impl ScyllaManager {
pg_database: js_db_config.pg_database,
pg_pool_size,
};
println!(" Inside init_pg_config...... {pg_config:?}");
let pg_manager = PgManager::from_config(&pg_config);

println!("pg_manager....\n\n {pg_manager:?}",);
Ok(Self {
pg_manager: PgManager::from_config(&pg_config).map_err(map_error_to_napi_error)?,
pg_manager: pg_manager.map_err(map_error_to_napi_error)?,
})
}
/// # Errors
Expand Down
1 change: 1 addition & 0 deletions scylla_pg_lib/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const DELETE_BATCH_TASK_SQL: &str = "
DELETE from task where data ->> 'status' in ('completed', 'cancelled', 'aborted') AND data ->> 'updated' < $1
";

#[derive(Debug)]
pub struct PgAdapter {
pub pool: Pool,
}
Expand Down
4 changes: 4 additions & 0 deletions scylla_pg_lib/src/manager.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
//! PG Manager used by external crates to deal with Database operations. `PGAdapter` is not accessible without `PGManager`

use std::fmt::Debug;

use crate::adapter::PgAdapter;
use crate::error::PgAdapterError;
use scylla_models::{AddTaskModel, GetTaskModel, Task, TaskError, TaskStatus, UpdateOperation, UpdateTaskModel};
use scylla_operations::task::{Persistence, ScyllaOperations};
use scylla_pg_core::config::PGConfig;
use scylla_pg_core::connection::get_pool;

#[derive(Debug)]
pub struct PgManager {
pg_adapter: Box<dyn Persistence<PersistenceError = PgAdapterError> + Send + Sync>,
}
Expand Down
1 change: 1 addition & 0 deletions scylla_pg_lib/src/manager/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use super::PgManager;
use async_trait::async_trait;
use scylla_models::*;

#[derive(Debug)]
struct MockPgAdapter {
insert: fn(Task) -> Result<Task, PgAdapterError>,
update: fn(Task) -> Result<Task, PgAdapterError>,
Expand Down

0 comments on commit cb019ee

Please sign in to comment.