···27 if op.did == "did:plc:hdhoaan3xa3jiuq4fg4mefid" {
28 println!(
29 "Update found for {}! cid={}\n -> operation: {}",
30- op.did, op.cid, op.operation.get()
0031 );
32 }
33 }
···27 if op.did == "did:plc:hdhoaan3xa3jiuq4fg4mefid" {
28 println!(
29 "Update found for {}! cid={}\n -> operation: {}",
30+ op.did,
31+ op.cid,
32+ op.operation.get()
33 );
34 }
35 }
-9
src/poll.rs
···175/// # async fn main() {
176/// use allegedly::{ExportPage, Op, poll_upstream};
177///
178-/// // set to `None` to replay from the beginning of the PLC history
179/// let after = Some(chrono::Utc::now());
180-///
181-/// // the PLC server to poll for new ops
182/// let upstream = "https://plc.wtf/export".parse().unwrap();
183-///
184-/// // self-rate-limit (plc.directory's limit interval is 600ms)
185/// let throttle = std::time::Duration::from_millis(300);
186///
187-/// // pages are sent out of the poller via a tokio mpsc channel
188/// let (tx, mut rx) = tokio::sync::mpsc::channel(1);
189-///
190-/// // spawn a tokio task to run the poller
191/// tokio::task::spawn(poll_upstream(after, upstream, throttle, tx));
192///
193-/// // receive pages of plc ops from the poller
194/// while let Some(ExportPage { ops }) = rx.recv().await {
195/// println!("received {} plc ops", ops.len());
196///
···175/// # async fn main() {
176/// use allegedly::{ExportPage, Op, poll_upstream};
177///
0178/// let after = Some(chrono::Utc::now());
00179/// let upstream = "https://plc.wtf/export".parse().unwrap();
00180/// let throttle = std::time::Duration::from_millis(300);
181///
0182/// let (tx, mut rx) = tokio::sync::mpsc::channel(1);
00183/// tokio::task::spawn(poll_upstream(after, upstream, throttle, tx));
184///
0185/// while let Some(ExportPage { ops }) = rx.recv().await {
186/// println!("received {} plc ops", ops.len());
187///