feat(db): add db cluster logic and tests#338
Conversation
Signed-off-by: Jim Ezesinachi <ezesinachijim@gmail.com>
Test Results125 tests 124 ✅ 4m 59s ⏱️ For more details on these failures, see this check. Results for commit c203746. ♻️ This comment has been updated with latest results. |
Signed-off-by: Jim Ezesinachi <ezesinachijim@gmail.com>
Benchmark Results |
| client_handler: Arc<ClientHandler>, | ||
| task_manager: Arc<TaskManager>, | ||
| config: ServerConfig, | ||
| cluster: Option<ClusterRuntime>, |
There was a problem hiding this comment.
ClusterRuntime would ideally always contain store_handler.... and we typically only ever want to access store_handler directly independent of cluster if cluster doesn't exist? Seems like we should have a cleaner
enum StoreRuntime {
Standalone(StoreHandler), // perhaps a more befitting rename to handler/ runtime to be consistent
Cluster(ClusterRuntime),
}There was a problem hiding this comment.
Actually agree with this, I went in the direction of not changing the shape of Server, but this is the better direction long term
| } | ||
|
|
||
| pub(crate) async fn list_stores_response( | ||
| cluster: Option<&ClusterRuntime>, |
There was a problem hiding this comment.
Not particularly sold on having optional cluster and a reference to store_handler when cluster always contains handler... see above comment
There was a problem hiding this comment.
A'firm, I will change the shape now
…odes Signed-off-by: Jim Ezesinachi <ezesinachijim@gmail.com>
|
|
||
| fn apply(&mut self, data: &DbCommand) -> Result<DbResponse, StorageError<u64>> { | ||
| match data { | ||
| DbCommand::CreateStore(payload) => { |
There was a problem hiding this comment.
There's probably a nice way to turn decode_payload into a macro so we dont have to manually pass that string but can extract it from the ty via stringify!
There was a problem hiding this comment.
Something like
macro_rules! decode_payload {
($ty:ty, $payload:expr) => {{
<$ty>::decode($payload).map_err(|err| StorageError::IO {
source: StorageIOError::read_state_machine(&std::io::Error::other(format!(
"failed to decode {} raft payload: {}",
stringify!($ty),
err,
))),
})
}};
}
let params: query::CreateStore =
decode_payload!(query::CreateStore, payload)?;There was a problem hiding this comment.
Makes sense, will implement this
| use std::any::{Any, TypeId}; | ||
|
|
||
| pub(crate) fn map_client_write_error( | ||
| command_name: &str, |
There was a problem hiding this comment.
Another good use of macros to enforce not needing command name alongside the actual command
| prost.workspace = true | ||
| openraft.workspace = true | ||
| ahnlich-replication = { path = "../replication", version = "*" } | ||
| bitcode = { version = "0.6", features = ["serde"] } |
There was a problem hiding this comment.
We should move to general Cargo.toml... my suspicion is we will reuse elsewhere
Signed-off-by: Jim Ezesinachi <ezesinachijim@gmail.com>
…om/deven96/ahnlich into feat/replication-m1-db-integration
Change from automatic PR event trigger to comment-based trigger. This is the documented, working pattern for Claude Code Action. Users comment '@claude' on a PR to trigger a review. Claude will read CLAUDE.md for review guidelines. Testing this simpler approach first to verify CLAUDE.md integration works.
No description provided.