Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed Jan 24, 2024
1 parent 3b58c64 commit b4da4db
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
10 changes: 5 additions & 5 deletions api/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ where
// We must store a value for the interest otherwise Recon will try forever to
// synchronize the value.
// In the case of interests an empty value is sufficient.
.insert(interest, Some(&[]))
.insert(interest, Some(vec![]))
.await
.map_err(|err| ApiError(format!("failed to update interest: {err}")))?;

Expand Down Expand Up @@ -454,7 +454,7 @@ mod tests {
.with_not_after(0)
.build(),
),
predicate::eq(None),
predicate::eq(Some(vec![])),
)
.times(1)
.returning(|_, _| Ok(()));
Expand Down Expand Up @@ -520,7 +520,7 @@ mod tests {
.with_not_after(0)
.build(),
),
predicate::eq(None),
predicate::eq(Some(vec![])),
)
.times(1)
.returning(|_, _| Ok(()));
Expand Down Expand Up @@ -586,7 +586,7 @@ mod tests {
.with_not_after(0)
.build(),
),
predicate::eq(None),
predicate::eq(Some(vec![])),
)
.times(1)
.returning(|_, _| Ok(()));
Expand Down Expand Up @@ -652,7 +652,7 @@ mod tests {
.with_not_after(0)
.build(),
),
predicate::eq(None),
predicate::eq(Some(vec![])),
)
.times(1)
.returning(|_, _| Ok(()));
Expand Down
15 changes: 6 additions & 9 deletions recon/src/recon/sqlitestore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ where
.bind(val)
.bind(&self.sort_key)
.bind(key.as_bytes())
.bind(&self.sort_key)
.bind(key.as_bytes())
.fetch_one(&mut **conn)
.execute(&mut **conn)
.await?;

Ok(())
Expand Down Expand Up @@ -524,6 +522,9 @@ where
&mut self,
range: RangeOpen<Self::Key>,
) -> Result<Vec<Self::Key>> {
if range.start >= range.end {
return Ok(vec![]);
};
let query = sqlx::query(
"
SELECT key
Expand Down Expand Up @@ -726,8 +727,7 @@ mod tests {
async fn test_keys_with_missing_value() {
let mut store = new_store().await;
let key = AlphaNumBytes::from("hello");
let store_value = AlphaNumBytes::from("world");
store.insert(&key).await.unwrap();
store.insert(ReconItem::new(&key, None)).await.unwrap();
let missing_keys = store
.keys_with_missing_values(
(AlphaNumBytes::min_value(), AlphaNumBytes::max_value()).into(),
Expand All @@ -743,10 +743,7 @@ mod tests {
"#]]
.assert_debug_eq(&missing_keys);

store
.store_value_for_key(&key, store_value.as_slice())
.await
.unwrap();
store.insert(ReconItem::new(&key, Some(&[]))).await.unwrap();
let missing_keys = store
.keys_with_missing_values(
(AlphaNumBytes::min_value(), AlphaNumBytes::max_value()).into(),
Expand Down
16 changes: 8 additions & 8 deletions recon/src/recon/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1354,10 +1354,10 @@ async fn disjoint() {
cat: [a: A, b: B, c: C, e: ∅, f: ∅, g: ∅]
-> value_req(e)
cat: [a: A, b: B, c: C, e: ∅, f: ∅, g: ∅]
<- value_resp(e: E)
dog: [a: A, b: B, c: C, e: E, f: F, g: G]
-> value_req(f)
cat: [a: A, b: B, c: C, e: ∅, f: ∅, g: ∅]
<- value_resp(e: E)
dog: [a: A, b: B, c: C, e: E, f: F, g: G]
-> value_req(g)
cat: [a: A, b: B, c: C, e: E, f: ∅, g: ∅]
<- value_resp(f: F)
Expand Down Expand Up @@ -1855,18 +1855,18 @@ async fn alternating() {
cat: [a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, r: R, s: S, t: T, u: ∅, v: V, w: ∅, x: X, y: ∅, z: Z]
-> value_req(u)
cat: [a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, r: R, s: S, t: T, u: ∅, v: V, w: ∅, x: X, y: ∅, z: Z]
<- value_resp(u: U)
dog: [a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, r: R, s: S, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z]
-> value_req(w)
cat: [a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, r: R, s: S, t: T, u: ∅, v: V, w: ∅, x: X, y: ∅, z: Z]
<- value_resp(u: U)
<- value_resp(w: W)
dog: [a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, r: R, s: S, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z]
-> value_req(y)
cat: [a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, r: R, s: S, t: T, u: U, v: V, w: ∅, x: X, y: ∅, z: Z]
<- value_resp(w: W)
<- value_resp(y: Y)
dog: [a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, r: R, s: S, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z]
-> listen_only
cat: [a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, r: R, s: S, t: T, u: U, v: V, w: W, x: X, y: ∅, z: Z]
<- value_resp(y: Y)
dog: [a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, r: R, s: S, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z]
<- listen_only
dog: [a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, r: R, s: S, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z]
-> finished
Expand Down Expand Up @@ -2085,10 +2085,10 @@ async fn subset_interest() {
dog: [b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, r: ∅]
-> value_req(i)
cat: [b: ∅, c: C, e: ∅, f: F, g: G, i: ∅, m: ∅, n: N, r: R]
-> value_req(m)
cat: [b: ∅, c: C, d: D, e: ∅, f: F, g: G, i: ∅, m: ∅, n: N, r: R]
<- range_resp({c h(d)#1 e})
dog: [b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, r: ∅]
-> value_req(m)
cat: [b: ∅, c: C, d: D, e: ∅, f: F, g: G, i: ∅, m: ∅, n: N, r: R]
-> value_resp(r: R)
cat: [b: ∅, c: C, d: D, e: ∅, f: F, g: G, i: ∅, m: ∅, n: N, r: R]
<- range_resp({e 0 f})
Expand Down

0 comments on commit b4da4db

Please sign in to comment.