Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/prepare findex server v7 #93

Closed
wants to merge 26 commits into from
Closed

Conversation

HatemMn
Copy link
Contributor

@HatemMn HatemMn commented Nov 27, 2024

Previous related PR : #92 , closed for convenience

What's new :

  • generic tests
  • redis store
    • New feature : storing the script in the db cache
  • exporting necessary primitives for findex-server

test:add generic memory ADT tests

test:add ccr test (fails)
fix:fix import of test

fix:re-order tests

fix:notyes

feat: fix the bugs lol

fix: fix the code

fix: fix clippy ci

fix: vscode folder

fix: rip first test

test: change async tests

fix: ci
fix: review fixes monday2

fix: review fixes monday3

fix: clippy

fix: clippy2

fix: clippy3
@HatemMn HatemMn mentioned this pull request Nov 27, 2024
fix: last fixes

test:change concurrency test

fix:newline issues

chore:Update src/in_memory_store.rs

Co-authored-by: Théophile BRÉZOT <[email protected]>
fix:review fixes

fix:review fixes2

fix:review fixes3

fix:review fixes4

fix:review fixes5
feat:clean deps and adapt word typing to byte sequence

test:change concurrent test signatures
@HatemMn HatemMn force-pushed the feat/prepare_findex_server_v7 branch from 0f589c4 to 33506ee Compare November 27, 2024 17:54
@HatemMn HatemMn self-assigned this Nov 27, 2024
@HatemMn HatemMn requested review from tbrezot and Manuthor November 29, 2024 16:22
Copy link
Contributor

@tbrezot tbrezot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional modifications should not include formatting modifications, this makes proofreading tedious and even less bulletproof.

Overall okay, but many details to improve: please read your diffs before publishing a MR.

Try removing the clones in your guarded_write. I would be surprise they are necessary.

.rustfmt.toml Outdated
version = "Two"
style_edition = "2024"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change that ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Deprecated.

Also I suggest we simply commit a rust-toolchain file like done in findex server. I committed one, make me notice if you disagree with the idea to delete it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update after discussion with @Manuthor

We thought of setting the rust toolchain to a stable release, notably :

[toolchain]
channel = "1.83.0"
components = ["rustfmt"]

And to format, we use cargo +nightly fmt --all
what do you think ?

Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Outdated
@@ -14,12 +16,26 @@ rand_core = "0.6.4"
tiny-keccak = { version = "2.0.2", features = ["sha3"] }
xts-mode = "0.5.1"
zeroize = { version = "1.8.1", features = ["derive"] }
redis = { version = "0.27.5", features = [
"aio",
"ahash",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"aio", : for async operations involving connection manager

ahash : for hashing that write script and keeping it on cache

src/findex.rs Outdated

#[tokio::test]
#[cfg(feature = "redis-store")]
async fn test_redis_insert_search_delete_search() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If correctly implemented, changing the memory should not influence the correctness of Findex. I agree though that this is in theory and testing is better than trusting. However, this test re-implements the exact same logic as the previous one : why not making the test generic instead?

Moreover, this is findex.rs, I would rather like not seeing any memory related code there. Move this test to src/tests/findex-redis.rs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with your first paragraph. Findex should work all ways so instead of moving this I will generize it later after we fix what we already have. I delete it for now

src/findex.rs Outdated Show resolved Hide resolved
@@ -31,6 +31,7 @@ impl<Address: Hash + Eq + Debug, Value: Clone + Eq + Debug> Default for InMemory
}
}

#[cfg(any(test, feature = "bench"))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compiler keeps nagging if taken off

method `clear` is never used
`#[warn(dead_code)]` on by defaultrustc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't delete test, it's needed in ovec.rs

src/test/memory.rs Show resolved Hide resolved
#[cfg(feature = "test-utils")]
use crate::MemoryADT;

// TODO: should return a result type and proper errors
Copy link
Contributor

@tbrezot tbrezot Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be solved ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept that for this review to ask a question : are the tests good as they are or shall I create some " tesResult " type with proper error type ? I just want to make sure it's good this way

src/test/memory.rs Outdated Show resolved Hide resolved
src/test/memory.rs Outdated Show resolved Hide resolved
@tbrezot
Copy link
Contributor

tbrezot commented Nov 30, 2024

Tests do not pass on my machine (cargo test --all-features):

thread 'findex::tests::test_redis_insert_search_delete_search' panicked at src/findex.rs:299:65:
called `Result::unwrap()` on an `Err` value: MissingValue(Address([214, 22, 96, 125, 62, 75, 169, 106, 116, 243, 35, 207, 252, 95, 32, 163]), 0)

@tbrezot
Copy link
Contributor

tbrezot commented Nov 30, 2024

Does not compile on my machine (cargo clippy --all-targets --no-default-features --features bench):

error[E0432]: unresolved imports `findex::dummy_decode`, `findex::dummy_encode`
  --> benches/benches.rs:5:69
   |
5  |     Findex, InMemory, IndexADT, MemoryADT, Op, Secret, WORD_LENGTH, dummy_decode, dummy_encode,
   |                                                                     ^^^^^^^^^^^^  ^^^^^^^^^^^^ no `dummy_encode` in the root
   |                                                                     |
   |                                                                     no `dummy_decode` in the root

@tbrezot tbrezot force-pushed the feat/prepare_findex_server_v7 branch from 049dd01 to c2a24e2 Compare November 30, 2024 16:42
@HatemMn HatemMn force-pushed the feat/prepare_findex_server_v7 branch from b5621d8 to 5a83afc Compare December 2, 2024 16:17
Copy link
Contributor Author

@HatemMn HatemMn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests do pass now, please notify me if they still flacky

Cargo.toml Outdated
@@ -14,12 +16,26 @@ rand_core = "0.6.4"
tiny-keccak = { version = "2.0.2", features = ["sha3"] }
xts-mode = "0.5.1"
zeroize = { version = "1.8.1", features = ["derive"] }
redis = { version = "0.27.5", features = [
"aio",
"ahash",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"aio", : for async operations involving connection manager

ahash : for hashing that write script and keeping it on cache

src/findex.rs Outdated

#[tokio::test]
#[cfg(feature = "redis-store")]
async fn test_redis_insert_search_delete_search() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with your first paragraph. Findex should work all ways so instead of moving this I will generize it later after we fix what we already have. I delete it for now

.rustfmt.toml Outdated
version = "Two"
style_edition = "2024"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update after discussion with @Manuthor

We thought of setting the rust toolchain to a stable release, notably :

[toolchain]
channel = "1.83.0"
components = ["rustfmt"]

And to format, we use cargo +nightly fmt --all
what do you think ?

src/lib.rs Outdated
pub use findex::Findex;
#[cfg(feature = "redis-store")]
pub use memory::db_stores::redis_store::RedisStore;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, I fixed the error enum type

src/memory/db_stores/error.rs Outdated Show resolved Hide resolved
src/memory/db_stores/redis_store.rs Outdated Show resolved Hide resolved
@@ -31,6 +31,7 @@ impl<Address: Hash + Eq + Debug, Value: Clone + Eq + Debug> Default for InMemory
}
}

#[cfg(any(test, feature = "bench"))]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compiler keeps nagging if taken off

method `clear` is never used
`#[warn(dead_code)]` on by defaultrustc

@@ -31,6 +31,7 @@ impl<Address: Hash + Eq + Debug, Value: Clone + Eq + Debug> Default for InMemory
}
}

#[cfg(any(test, feature = "bench"))]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't delete test, it's needed in ovec.rs

#[cfg(feature = "test-utils")]
use crate::MemoryADT;

// TODO: should return a result type and proper errors
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept that for this review to ask a question : are the tests good as they are or shall I create some " tesResult " type with proper error type ? I just want to make sure it's good this way


#[tokio::test]
#[serial]
async fn test_db_flush() -> Result<(), RedisStoreError> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

performed a coverage report ;

with this functions :

image

Without it :

image

The gain is indeed negligible, proceeding to delete it

@HatemMn HatemMn assigned Manuthor and tbrezot and unassigned HatemMn Dec 2, 2024
Base automatically changed from eprint to develop January 15, 2025 09:29
@tbrezot tbrezot closed this Jan 15, 2025
@tbrezot tbrezot deleted the feat/prepare_findex_server_v7 branch January 15, 2025 09:35
@tbrezot tbrezot restored the feat/prepare_findex_server_v7 branch January 15, 2025 09:49
@HatemMn HatemMn mentioned this pull request Jan 15, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants