mirror of
https://github.com/logos-messaging/logos-messaging-rust-bindings.git
synced 2026-01-02 14:03:12 +00:00
Expose local archive query
Update to beta4
This commit is contained in:
parent
47566528d0
commit
a29899752e
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -87,9 +87,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.63.0"
|
||||
version = "0.64.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885"
|
||||
checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cexpr",
|
||||
@ -1246,9 +1246,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.24.2"
|
||||
version = "1.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb"
|
||||
checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"pin-project-lite",
|
||||
@ -1403,7 +1403,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "waku-sys"
|
||||
version = "0.1.0-beta3"
|
||||
version = "0.1.0-beta4"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
]
|
||||
|
||||
4
examples/Cargo.lock
generated
4
examples/Cargo.lock
generated
@ -1203,7 +1203,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "waku-bindings"
|
||||
version = "0.1.0-beta1"
|
||||
version = "0.1.0-beta3"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"base64",
|
||||
@ -1222,7 +1222,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "waku-sys"
|
||||
version = "0.1.0-beta1"
|
||||
version = "0.1.0-beta4"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
]
|
||||
|
||||
@ -102,6 +102,7 @@ fn retrieve_history(
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn setup_node_handle() -> std::result::Result<WakuNodeHandle<Running>, Box<dyn Error>> {
|
||||
let node_handle = waku_new(None)?;
|
||||
let node_handle = node_handle.start()?;
|
||||
|
||||
@ -25,7 +25,7 @@ serde_json = "1.0"
|
||||
sscanf = "0.3"
|
||||
smart-default = "0.6"
|
||||
url = "2.3"
|
||||
waku-sys = { version = "0.1.0-beta3", path = "../waku-sys" }
|
||||
waku-sys = { version = "0.1.0-beta4", path = "../waku-sys" }
|
||||
|
||||
[dev-dependencies]
|
||||
futures = "0.3.25"
|
||||
|
||||
@ -225,6 +225,14 @@ impl WakuNodeHandle<Running> {
|
||||
store::waku_store_query(query, peer_id, timeout)
|
||||
}
|
||||
|
||||
/// Retrieves locally stored historical messages on specific content topics. This method may be called with [`PagingOptions`](`crate::general::PagingOptions`),
|
||||
/// to retrieve historical messages on a per-page basis. If the request included [`PagingOptions`](`crate::general::PagingOptions`),
|
||||
/// the node must return messages on a per-page basis and include [`PagingOptions`](`crate::general::PagingOptions`) in the response.
|
||||
/// These [`PagingOptions`](`crate::general::PagingOptions`) must contain a cursor pointing to the Index from which a new page can be requested
|
||||
pub fn local_store_query(&self, query: &StoreQuery) -> Result<StoreResponse> {
|
||||
store::waku_local_store_query(query)
|
||||
}
|
||||
|
||||
/// Publish a message using Waku Lightpush
|
||||
/// As per the [specification](https://rfc.vac.dev/spec/36/#extern-char-waku_lightpush_publishchar-messagejson-char-topic-char-peerid-int-timeoutms)
|
||||
pub fn lightpush_publish(
|
||||
|
||||
@ -46,3 +46,26 @@ pub fn waku_store_query(
|
||||
|
||||
decode_and_free_response(result_ptr)
|
||||
}
|
||||
|
||||
/// Retrieves locally stored historical messages on specific content topics from the local archive system. This method may be called with [`PagingOptions`](`crate::general::PagingOptions`),
|
||||
/// to retrieve historical messages on a per-page basis. If the request included [`PagingOptions`](`crate::general::PagingOptions`),
|
||||
/// the node must return messages on a per-page basis and include [`PagingOptions`](`crate::general::PagingOptions`) in the response.
|
||||
/// These [`PagingOptions`](`crate::general::PagingOptions`) must contain a cursor pointing to the Index from which a new page can be requested
|
||||
pub fn waku_local_store_query(query: &StoreQuery) -> Result<StoreResponse> {
|
||||
let result = unsafe {
|
||||
CStr::from_ptr(waku_sys::waku_store_local_query(
|
||||
CString::new(
|
||||
serde_json::to_string(query)
|
||||
.expect("StoreQuery should always be able to be serialized"),
|
||||
)
|
||||
.expect("CString should build properly from the serialized filter subscription")
|
||||
.into_raw(),
|
||||
))
|
||||
}
|
||||
.to_str()
|
||||
.expect("Response should always succeed to load to a &str");
|
||||
|
||||
let response: JsonResponse<StoreResponse> =
|
||||
serde_json::from_str(result).expect("JsonResponse should always succeed to deserialize");
|
||||
response.into()
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "waku-sys"
|
||||
version = "0.1.0-beta3"
|
||||
version = "0.1.0-beta4"
|
||||
edition = "2021"
|
||||
authors = [
|
||||
"Daniel Sanchez Quiros <danielsq@status.im>"
|
||||
@ -19,4 +19,4 @@ crate-type = ["rlib"]
|
||||
[dependencies]
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.63"
|
||||
bindgen = "0.64"
|
||||
Loading…
x
Reference in New Issue
Block a user