@@ -11,7 +11,7 @@ pub(crate) mod sync_status;
1111use std:: { fmt:: Debug , sync:: Arc } ;
1212
1313use anyhow:: bail;
14- use crossbeam_skiplist :: SkipMap ;
14+ use dashmap :: DashMap ;
1515use registrations:: {
1616 get_all_invalids:: GetAllInvalidRegistrationsQuery ,
1717 get_all_registrations:: GetAllRegistrationsQuery , get_from_stake_addr:: GetRegistrationQuery ,
@@ -50,7 +50,26 @@ use crate::{
5050} ;
5151
5252/// Batches of different sizes, prepared and ready for use.
53- pub ( crate ) type SizedBatch = SkipMap < u16 , Arc < Batch > > ;
53+ pub ( crate ) type SizedBatch = DashMap < u16 , Arc < Batch > > ;
54+
55+ /// Kind of result
56+ #[ derive( Clone ) ]
57+ #[ allow( dead_code) ]
58+ pub ( crate ) enum QueryKind {
59+ /// Sized-batch
60+ Batch ( SizedBatch ) ,
61+ /// Prepared statement
62+ Statement ( PreparedStatement ) ,
63+ }
64+
65+ /// A trait to prepare Index DB queries.
66+ #[ allow( dead_code) ]
67+ pub ( crate ) trait Query {
68+ /// Prepare the query
69+ async fn prepare_query (
70+ session : & Arc < Session > , cfg : & cassandra_db:: EnvVars ,
71+ ) -> anyhow:: Result < QueryKind > ;
72+ }
5473
5574/// All Prepared insert Queries that we know about.
5675#[ derive( strum_macros:: Display ) ]
@@ -296,7 +315,7 @@ impl PreparedQueries {
296315 session : Arc < Session > , query : & str , cfg : & cassandra_db:: EnvVars ,
297316 consistency : scylla:: statement:: Consistency , idempotent : bool , logged : bool ,
298317 ) -> anyhow:: Result < SizedBatch > {
299- let sized_batches: SizedBatch = SkipMap :: new ( ) ;
318+ let sized_batches: SizedBatch = DashMap :: new ( ) ;
300319
301320 // First prepare the query. Only needs to be done once, all queries on a batch are the
302321 // same.
0 commit comments