tangled
alpha
login
or
join now
microcosm.blue
/
microcosm-rs
65
fork
atom
Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
65
fork
atom
overview
issues
8
pulls
2
pipelines
fix mod imports for bin folder
bad-example.com
1 year ago
6f8a812b
be266fa0
+21
-15
7 changed files
expand all
collapse all
unified
split
constellation
src
bin
main.rs
consumer
mod.rs
lib.rs
server
mod.rs
storage
mem_store.rs
mod.rs
rocks_store.rs
+1
-1
constellation/src/consumer/mod.rs
···
2
2
mod jsonl_file;
3
3
4
4
use crate::storage::LinkStorage;
5
5
+
use crate::{ActionableEvent, RecordId};
5
6
use anyhow::Result;
6
6
-
use constellation::{ActionableEvent, RecordId};
7
7
use jetstream::consume_jetstream;
8
8
use jsonl_file::consume_jsonl_file;
9
9
use links::collect_links;
+4
constellation/src/lib.rs
···
1
1
+
pub mod consumer;
2
2
+
pub mod server;
3
3
+
pub mod storage;
4
4
+
1
5
use links::CollectedLink;
2
6
use serde::{Deserialize, Serialize};
3
7
use std::convert::From;
+6
-10
constellation/src/main.rs
constellation/src/bin/main.rs
···
1
1
-
mod consumer;
2
2
-
mod server;
3
3
-
mod storage;
4
4
-
5
1
use anyhow::Result;
6
2
use clap::{Parser, ValueEnum};
7
3
use metrics_exporter_prometheus::PrometheusBuilder;
···
15
11
use tokio::runtime;
16
12
use tokio_util::sync::CancellationToken;
17
13
18
18
-
use consumer::consume;
19
19
-
use server::serve;
14
14
+
use constellation::consumer::consume;
15
15
+
use constellation::server::serve;
20
16
#[cfg(feature = "rocks")]
21
21
-
use storage::RocksStorage;
22
22
-
use storage::{LinkReader, LinkStorage, MemStorage, StorageStats};
17
17
+
use constellation::storage::RocksStorage;
18
18
+
use constellation::storage::{LinkReader, LinkStorage, MemStorage, StorageStats};
23
19
24
20
const MONITOR_INTERVAL: time::Duration = time::Duration::from_secs(2);
25
21
···
222
218
223
219
#[cfg(test)]
224
220
mod tests {
225
225
-
use crate::consumer::get_actionable;
226
226
-
use crate::storage::{LinkReader, LinkStorage, MemStorage};
221
221
+
use constellation::consumer::get_actionable;
222
222
+
use constellation::storage::{LinkReader, LinkStorage, MemStorage};
227
223
228
224
#[test]
229
225
fn test_create_like_integrated() {
+1
-1
constellation/src/server/mod.rs
···
10
10
use tokio_util::sync::CancellationToken;
11
11
12
12
use crate::storage::{LinkReader, StorageStats};
13
13
-
use constellation::{CountsByCount, Did, RecordId};
13
13
+
use crate::{CountsByCount, Did, RecordId};
14
14
15
15
mod acceptable;
16
16
mod filters;
+7
-1
constellation/src/storage/mem_store.rs
···
1
1
use super::{LinkReader, LinkStorage, PagedAppendingCollection, StorageStats};
2
2
+
use crate::{ActionableEvent, CountsByCount, Did, RecordId};
2
3
use anyhow::Result;
3
3
-
use constellation::{ActionableEvent, CountsByCount, Did, RecordId};
4
4
use links::CollectedLink;
5
5
use std::collections::{HashMap, HashSet};
6
6
use std::sync::{Arc, Mutex};
···
101
101
}
102
102
data.links.remove(did); // nb: this is removing by a whole prefix in kv context
103
103
data.dids.remove(did);
104
104
+
}
105
105
+
}
106
106
+
107
107
+
impl Default for MemStorage {
108
108
+
fn default() -> Self {
109
109
+
Self::new()
104
110
}
105
111
}
106
112
+1
-1
constellation/src/storage/mod.rs
···
1
1
+
use crate::{ActionableEvent, CountsByCount, Did, RecordId};
1
2
use anyhow::Result;
2
2
-
use constellation::{ActionableEvent, CountsByCount, Did, RecordId};
3
3
use serde::{Deserialize, Serialize};
4
4
use std::collections::HashMap;
5
5
+1
-1
constellation/src/storage/rocks_store.rs
···
1
1
use super::{ActionableEvent, LinkReader, LinkStorage, PagedAppendingCollection, StorageStats};
2
2
+
use crate::{CountsByCount, Did, RecordId};
2
3
use anyhow::{bail, Result};
3
4
use bincode::Options as BincodeOptions;
4
4
-
use constellation::{CountsByCount, Did, RecordId};
5
5
use links::CollectedLink;
6
6
use rocksdb::{
7
7
AsColumnFamilyRef, ColumnFamilyDescriptor, DBWithThreadMode, IteratorMode, MergeOperands,