1- use crate :: cachestore:: QueueKey ;
1+ use crate :: cachestore:: queue_item:: QueueItemRocksIndex ;
2+ use crate :: cachestore:: { QueueItem , QueueKey } ;
23use crate :: metastore:: {
34 BaseRocksTable , IdRow , IndexId , RocksEntity , RocksSecondaryIndex , RocksTable , TableId ,
45 TableInfo ,
@@ -111,7 +112,7 @@ rocks_table_new!(QueueResult, QueueResultRocksTable, TableId::QueueResults, {
111112#[ derive( Hash , Clone , Debug ) ]
112113pub enum QueueResultIndexKey {
113114 ByPath ( String ) ,
114- ByExternalId ( String ) ,
115+ ByExternalId ( Option < String > ) ,
115116}
116117
117118base_rocks_secondary_index ! ( QueueResult , QueueResultRocksIndex ) ;
@@ -121,15 +122,17 @@ impl RocksSecondaryIndex<QueueResult, QueueResultIndexKey> for QueueResultRocksI
121122 match self {
122123 QueueResultRocksIndex :: ByPath => QueueResultIndexKey :: ByPath ( row. get_path ( ) . clone ( ) ) ,
123124 QueueResultRocksIndex :: ByExternalId => {
124- QueueResultIndexKey :: ByExternalId ( row. get_external_id ( ) . clone ( ) . unwrap_or_default ( ) )
125+ QueueResultIndexKey :: ByExternalId ( row. get_external_id ( ) . clone ( ) )
125126 }
126127 }
127128 }
128129
129130 fn key_to_bytes ( & self , key : & QueueResultIndexKey ) -> Vec < u8 > {
130131 match key {
131132 QueueResultIndexKey :: ByPath ( s) => s. as_bytes ( ) . to_vec ( ) ,
132- QueueResultIndexKey :: ByExternalId ( s) => s. as_bytes ( ) . to_vec ( ) ,
133+ QueueResultIndexKey :: ByExternalId ( s) => {
134+ s. as_deref ( ) . unwrap_or ( "__null__" ) . as_bytes ( ) . to_vec ( )
135+ }
133136 }
134137 }
135138
@@ -161,7 +164,7 @@ impl RocksSecondaryIndex<QueueResult, QueueResultIndexKey> for QueueResultRocksI
161164
162165 fn should_index_row ( & self , row : & QueueResult ) -> bool {
163166 match self {
164- QueueResultRocksIndex :: ByExternalId => row. external_id . is_some ( ) ,
167+ Self :: ByExternalId => row. external_id . is_some ( ) ,
165168 _ => true ,
166169 }
167170 }
0 commit comments