![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@peerbit/riblt
Advanced tools
Rust port of RIBLT library by yang1996.
Implementation of Rateless Invertible Bloom Lookup Tables (Rateless IBLTs), as proposed in paper Practical Rateless Set Reconciliation by Lei Yang, Yossi Gilad, and Mohammad Alizadeh. Preprint available at arxiv.org/abs/2402.02668.
To use this library, implement a Symbol
trait, and create Encoder
or Decoder
objects to encode and decode symbols.
Symbol
traitfn zero() -> Self
- Create a zero symbol.fn xor(&self, other: &Self) -> Self
- XOR of this symbol and another symbol.fn hash(&self) -> u64
- Calculate a hash of the symbol.Example implementation for 64-bit integer symbols:
use riblt::*;
use std::hash::{SipHasher, Hasher};
pub type MyU64 = u64;
impl Symbol for MyU64 {
fn zero() -> MyU64 {
return 0;
}
fn xor(&self, other: &MyU64) -> MyU64 {
return self ^ other;
}
fn hash(&self) -> u64 {
let mut hasher = SipHasher::new_with_keys(123, 456);
hasher.write_u64(*self);
return hasher.finish();
}
}
Encoder
methodsEncoder::<T>::new()
- Create a new Encoder for symbols of type T
.enc.reset()
- Reset the Encoder state.enc.add_symbol(symbol: &T)
- Add a new symbol to the Encoder.enc.produce_next_coded_symbol() -> CodedSymbol<T>
- Produce the next coded symbol that can be decoded by the Decoder.use riblt::*;
fn foo() {
let mut enc = Encoder::<MyU64>::new();
let symbols : [MyU64; 5] = [ 1, 2, 3, 4, 5 ];
for x in symbols {
enc.add_symbol(&x);
}
let coded = enc.produce_next_coded_symbol();
// send symbol to the decoder...
}
Decoder
methodsDecoder::<T>::new()
- Create a new Decoder for symbols of type T
.dec.reset()
- Reset the Decoder state.dec.add_symbol(symbol: &T)
- Add a new symbol to the Decoder.dec.add_coded_symbol(symbol: &CodedSymbol<T>)
- Add a new coded symbol to the Decoder.dec.try_decode()
- Try to decode added symbols. May returns Err(InvalidDegree)
.dec.decoded()
- Returns true
if all added coded symbols where decoded.dec.get_remote_symbols() -> Vec<HashedSymbol<T>>
- Returns an array of decoded remote symbols.dec.get_local_symbols() -> Vec<HashedSymbol<T>>
- Returns an array of local symbols.Remote and local symbols can be accessed directly via Decoder properties:
dec.remote.symbols
,dec.local.symbols
.use riblt::*;
fn foo() {
let symbols : [CodedSymbol<MyU64>; 5] = ...;
let mut dec = Decoder::<MyU64>::new();
for i in 0..symbols.len() {
dec.add_coded_symbol(&symbols[i]);
}
if dec.try_decode().is_err() {
// Decoding error...
}
if dec.decoded() {
// Success...
}
}
For the complete example see test example
in src/tests.rs
.
FAQs
Riblt
We found that @peerbit/riblt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.