-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement methods for getting stream and topic with base data
- Loading branch information
1 parent
19df16f
commit 69d4599
Showing
10 changed files
with
169 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
{ | ||
"name": "Iggy Python SDK devcontainer", | ||
"dockerComposeFile": "docker-compose.yml", | ||
service: "devcontainer", | ||
"service": "devcontainer", | ||
"features": { | ||
"ghcr.io/devcontainers/features/rust:1": {} | ||
} | ||
}, | ||
"workspaceFolder": "/workspace" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "iggy-py" | ||
version = "0.2.4" | ||
version = "0.2.5" | ||
edition = "2021" | ||
authors = ["Dario Lencina Talarico <[email protected]>"] | ||
|
||
|
@@ -11,7 +11,7 @@ crate-type = ["cdylib"] | |
|
||
[dependencies] | ||
pyo3 = "0.22.0" | ||
iggy = "0.6.30" | ||
iggy = "0.6.31" | ||
tokio = { version = "1", features = ["full"] } | ||
bytes = "1.7.1" | ||
openssl = { version = "0.10.*", features = ["vendored"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
mod client; | ||
mod receive_message; | ||
mod send_message; | ||
mod stream; | ||
mod topic; | ||
|
||
use client::IggyClient; | ||
use pyo3::prelude::*; | ||
use receive_message::ReceiveMessage; | ||
use send_message::SendMessage; | ||
use stream::StreamDetails; | ||
use topic::TopicDetails; | ||
|
||
/// A Python module implemented in Rust. | ||
#[pymodule] | ||
fn iggy_py(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { | ||
m.add_class::<SendMessage>()?; | ||
m.add_class::<ReceiveMessage>()?; | ||
m.add_class::<IggyClient>()?; | ||
m.add_class::<StreamDetails>()?; | ||
m.add_class::<TopicDetails>()?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use iggy::models::stream::StreamDetails as RustStreamDetails; | ||
use pyo3::prelude::*; | ||
|
||
#[pyclass] | ||
pub struct StreamDetails { | ||
pub(crate) inner: RustStreamDetails, | ||
} | ||
|
||
impl From<RustStreamDetails> for StreamDetails { | ||
fn from(stream_details: RustStreamDetails) -> Self { | ||
StreamDetails { | ||
inner: stream_details, | ||
} | ||
} | ||
} | ||
|
||
#[pymethods] | ||
impl StreamDetails { | ||
#[getter] | ||
pub fn id(&self) -> u32 { | ||
self.inner.id | ||
} | ||
|
||
#[getter] | ||
pub fn name(&self) -> String { | ||
self.inner.name.to_string() | ||
} | ||
|
||
#[getter] | ||
pub fn messages_count(&self) -> u64 { | ||
self.inner.messages_count | ||
} | ||
|
||
#[getter] | ||
pub fn topics_count(&self) -> u32 { | ||
self.inner.topics_count | ||
} | ||
} |
Oops, something went wrong.