File tree 2 files changed +24
-2
lines changed
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,11 @@ pub const BLOOM_USE_RANDOM_SEED_DEFAULT: bool = true;
30
30
31
31
pub const BLOOM_DEFRAG_DEAFULT : bool = true ;
32
32
33
+ /// Minimal Valkey version that supports Bloom Module
34
+ pub const BLOOM_MIN_MAJOR_VERSION : i64 = 8 ;
35
+ pub const BLOOM_MIN_MINOR_VERSION : i64 = 0 ;
36
+ pub const BLOOM_MIN_PATCH_VERSION : i64 = 0 ;
37
+
33
38
// Max Memory usage allowed overall within a bloom object (128MB).
34
39
// Beyond this threshold, a bloom object is classified as large.
35
40
// Write operations that result in bloom object allocation larger than this size will be rejected.
Original file line number Diff line number Diff line change @@ -9,12 +9,29 @@ pub mod metrics;
9
9
pub mod wrapper;
10
10
use crate :: bloom:: command_handler;
11
11
use crate :: bloom:: data_type:: BLOOM_TYPE ;
12
+ use configs:: { BLOOM_MIN_MAJOR_VERSION , BLOOM_MIN_MINOR_VERSION , BLOOM_MIN_PATCH_VERSION } ;
12
13
use valkey_module_macros:: info_command_handler;
13
14
14
15
pub const MODULE_NAME : & str = "bf" ;
15
16
16
- fn initialize ( _ctx : & Context , _args : & [ ValkeyString ] ) -> Status {
17
- Status :: Ok
17
+ fn initialize ( ctx : & Context , _args : & [ ValkeyString ] ) -> Status {
18
+ let ver = ctx
19
+ . get_redis_version ( )
20
+ . expect ( "Unable to get server version!" ) ;
21
+ let server_version: Vec < i64 > = vec ! [ ver. major. into( ) , ver. minor. into( ) , ver. patch. into( ) ] ;
22
+ let min_support_version: Vec < i64 > = vec ! [
23
+ BLOOM_MIN_MAJOR_VERSION ,
24
+ BLOOM_MIN_MINOR_VERSION ,
25
+ BLOOM_MIN_PATCH_VERSION ,
26
+ ] ;
27
+ if server_version < min_support_version {
28
+ ctx. log_warning (
29
+ "Current server version doesn't satisfy minimal required version for bloom module!" ,
30
+ ) ;
31
+ Status :: Err
32
+ } else {
33
+ Status :: Ok
34
+ }
18
35
}
19
36
20
37
fn deinitialize ( _ctx : & Context ) -> Status {
You can’t perform that action at this time.
0 commit comments