You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Stores all resources. The Key is the Subject as a `string.as_bytes()`, the value a [PropVals]. Propvals must be serialized using [bincode].
56
61
resources: sled::Tree,
57
-
/// Index for all AtomicURLs, indexed by their Value. Used to speed up TPF queries. See [key_for_reference_index]
62
+
/// Index of all Atoms, sorted by {Value}-{Property}-{Subject}.
63
+
/// See [reference_index]
58
64
reference_index: sled::Tree,
65
+
/// Index sorted by property + value.
66
+
/// Used for TPF queries where the property is known.
67
+
prop_val_sub_index: sled::Tree,
59
68
/// Stores the members of Collections, easily sortable.
60
-
/// See [collections_index]
61
-
members_index: sled::Tree,
62
-
/// A list of all the Collections currently being used. Is used to update `members_index`.
63
-
/// See [collections_index]
69
+
query_index: sled::Tree,
70
+
/// A list of all the Collections currently being used. Is used to update `query_index`.
64
71
watched_queries: sled::Tree,
65
72
/// The address where the db will be hosted, e.g. http://localhost/
66
73
server_url:String,
@@ -78,14 +85,16 @@ impl Db {
78
85
let db = sled::open(path).map_err(|e|format!("Failed opening DB at this location: {:?} . Is another instance of Atomic Server running? {}", path, e))?;
79
86
let resources = db.open_tree("resources_v1").map_err(|e|format!("Failed building resources. Your DB might be corrupt. Go back to a previous version and export your data. {}", e))?;
80
87
let reference_index = db.open_tree("reference_index")?;
81
-
let members_index = db.open_tree("members_index")?;
88
+
let query_index = db.open_tree("members_index")?;
89
+
let prop_val_sub_index = db.open_tree("prop_val_sub_index")?;
82
90
let watched_queries = db.open_tree("watched_queries")?;
/// Parses a Value index key string, converts it into an atom. Note that the Value of the atom will allways be a single AtomicURL here.
722
-
fnkey_to_atom(key:&str) -> AtomicResult<Atom>{
723
-
letmut parts = key.split('\n');
724
-
let val = parts.next().ok_or("Invalid key for value index")?;
725
-
let prop = parts.next().ok_or("Invalid key for value index")?;
726
-
let subj = parts.next().ok_or("Invalid key for value index")?;
727
-
Ok(Atom::new(
728
-
subj.into(),
729
-
prop.into(),
730
-
Value::AtomicUrl(val.into()),
731
-
))
732
-
}
733
-
734
709
fncorrupt_db_message(subject:&str) -> String{
735
-
format!("Could not deserialize item {} from database. DB is possibly corrupt, could be due to an update or a lack of migrations. Restore to a previous version, export / serialize your data and import your data again.", subject)
710
+
format!("Could not deserialize item {} from database. DB is possibly corrupt, could be due to an update or a lack of migrations. Restore to a previous version, export your data and import your data again.", subject)
736
711
}
737
712
738
-
constDB_CORRUPT_MSG:&str = "Could not deserialize item from database. DB is possibly corrupt, could be due to an update or a lack of migrations. Restore to a previous version, export / serialize your data and import your data again.";
713
+
constDB_CORRUPT_MSG:&str = "Could not deserialize item from database. DB is possibly corrupt, could be due to an update or a lack of migrations. Restore to a previous version, export your data and import your data again.";
0 commit comments