@@ -7,8 +7,6 @@ use std::time::Duration;
7
7
use tracing:: info;
8
8
use url:: Url ;
9
9
10
- #[ cfg( feature = "internal" ) ]
11
- use crate :: evalutate:: Segment ;
12
10
use crate :: evalutate:: { EvalDetail , Repository } ;
13
11
use crate :: sync:: Synchronizer ;
14
12
use crate :: user:: FPUser ;
@@ -242,33 +240,8 @@ impl FeatureProbe {
242
240
}
243
241
244
242
#[ cfg( feature = "internal" ) ]
245
- pub fn update_toggles ( & mut self , toggles : HashMap < String , Toggle > ) {
246
- let mut repo = self . repo . write ( ) ;
247
- repo. toggles . extend ( toggles)
248
- }
249
-
250
- #[ cfg( feature = "internal" ) ]
251
- pub fn update_segments ( & mut self , segments : HashMap < String , Segment > ) {
252
- let mut repo = self . repo . write ( ) ;
253
- repo. segments . extend ( segments)
254
- }
255
-
256
- #[ cfg( feature = "internal" ) ]
257
- pub fn repo_string ( & self ) -> String {
258
- let repo = self . repo . read ( ) ;
259
- serde_json:: to_string ( & * repo) . expect ( "repo valid json format" )
260
- }
261
-
262
- #[ cfg( feature = "internal" ) ]
263
- pub fn all_evaluated_string ( & self , user : & FPUser ) -> String {
264
- let repo = self . repo . read ( ) ;
265
- let map: HashMap < String , EvalDetail < Value > > = repo
266
- . toggles
267
- . iter ( )
268
- . filter ( |( _, t) | t. is_for_client ( ) )
269
- . map ( |( key, toggle) | ( key. to_owned ( ) , toggle. eval_detail ( user, & repo. segments ) ) )
270
- . collect ( ) ;
271
- serde_json:: to_string ( & map) . expect ( "valid json format" )
243
+ pub fn repo ( & self ) -> Arc < RwLock < Repository > > {
244
+ self . repo . clone ( )
272
245
}
273
246
}
274
247
@@ -380,18 +353,6 @@ mod tests {
380
353
. is_some( ) ) ;
381
354
}
382
355
383
- #[ cfg( feature = "internal" ) ]
384
- #[ test]
385
- fn test_feature_probe_evaluate_all ( ) {
386
- let json = load_local_json ( "resources/fixtures/repo.json" ) ;
387
- let fp = FeatureProbe :: new_with ( "secret key" . to_string ( ) , json. unwrap ( ) ) ;
388
- let u = FPUser :: new ( ) . with ( "name" , "bob" ) . with ( "city" , "1" ) ;
389
-
390
- let s = fp. all_evaluated_string ( & u) ;
391
- assert ! ( s. len( ) > 10 ) ;
392
- assert ! ( !s. contains( "server_toggle" ) )
393
- }
394
-
395
356
#[ test]
396
357
fn test_feature_probe_none_exist_toggle ( ) {
397
358
let json = load_local_json ( "resources/fixtures/repo.json" ) ;
0 commit comments