Skip to content

Commit

Permalink
[python] - Implement RaftNode.store
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Jan 2, 2024
1 parent e97ae48 commit b637c86
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions binding/python/raftify.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class RaftNode:
""" """
async def get_cluster_size(self) -> None:
""" """
async def store(self) -> AbstractStateMachine:
""" """

class ClusterJoinTicket:
""" """
Expand Down Expand Up @@ -199,6 +201,7 @@ class Config:

raft_config: RaftConfig
log_dir: str
save_compacted_logs: bool
compacted_log_dir: str
compacted_log_size_threshold: int
snapshot_interval: float
Expand All @@ -210,6 +213,7 @@ class Config:

class RaftServiceClient:
""" """

@staticmethod
async def build(self, addr: str) -> "RaftServiceClient":
""" """
Expand Down
2 changes: 1 addition & 1 deletion binding/python/src/bindings/peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl PyPeers {
.inner
.iter()
.map(|(id, peer)| (id, peer.addr.to_string()))
.collect::<Vec<(u64, String)>>();
.collect::<Vec<_>>();

Ok(new_py_list::<(u64, String), _>(py, peer_items)?.to_object(py))
}
Expand Down
4 changes: 4 additions & 0 deletions binding/python/src/bindings/raft_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,8 @@ impl PyRaftNode {
pub async fn get_cluster_size(&mut self) -> PyResult<usize> {
Ok(self.inner.get_cluster_size().await)
}

pub async fn store(&self) -> PyResult<PyFSM> {
Ok(self.inner.store().await)
}
}

0 comments on commit b637c86

Please sign in to comment.