11using Pipelines . Sockets . Unofficial . Arenas ;
2- using FH = global ::StackExchange . Redis . FastHash ;
32
43// ReSharper disable once CheckNamespace
54namespace StackExchange . Redis ;
@@ -44,7 +43,7 @@ protected override bool TryReadOne(in RawResult result, out RedisValue value)
4443 }
4544 }
4645
47- private sealed class VectorSetInfoProcessor : ResultProcessor < VectorSetInfo ? >
46+ private sealed partial class VectorSetInfoProcessor : ResultProcessor < VectorSetInfo ? >
4847 {
4948 protected override bool SetResultCore ( PhysicalConnection connection , Message message , in RawResult result )
5049 {
@@ -59,7 +58,7 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
5958 var quantType = VectorSetQuantization . Unknown ;
6059 string ? quantTypeRaw = null ;
6160 int vectorDim = 0 , maxLevel = 0 ;
62- long size = 0 , vsetUid = 0 , hnswMaxNodeUid = 0 ;
61+ long resultSize = 0 , vsetUid = 0 , hnswMaxNodeUid = 0 ;
6362 var iter = result . GetItems ( ) . GetEnumerator ( ) ;
6463 while ( iter . MoveNext ( ) )
6564 {
@@ -71,30 +70,30 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
7170 var keyHash = key . Payload . Hash64 ( ) ;
7271 switch ( key . Payload . Length )
7372 {
74- case FH . size . Length when FH . size . Is ( keyHash , key ) && value . TryGetInt64 ( out var i64 ) :
75- size = i64 ;
73+ case size . Length when size . Is ( keyHash , key ) && value . TryGetInt64 ( out var i64 ) :
74+ resultSize = i64 ;
7675 break ;
77- case FH . vset_uid . Length when FH . vset_uid . Is ( keyHash , key ) && value . TryGetInt64 ( out var i64 ) :
76+ case vset_uid . Length when vset_uid . Is ( keyHash , key ) && value . TryGetInt64 ( out var i64 ) :
7877 vsetUid = i64 ;
7978 break ;
80- case FH . max_level . Length when FH . max_level . Is ( keyHash , key ) && value . TryGetInt64 ( out var i64 ) :
79+ case max_level . Length when max_level . Is ( keyHash , key ) && value . TryGetInt64 ( out var i64 ) :
8180 maxLevel = checked ( ( int ) i64 ) ;
8281 break ;
83- case FH . vector_dim . Length
84- when FH . vector_dim . Is ( keyHash , key ) && value . TryGetInt64 ( out var i64 ) :
82+ case vector_dim . Length
83+ when vector_dim . Is ( keyHash , key ) && value . TryGetInt64 ( out var i64 ) :
8584 vectorDim = checked ( ( int ) i64 ) ;
8685 break ;
87- case FH . quant_type . Length when FH . quant_type . Is ( keyHash , key ) :
86+ case quant_type . Length when quant_type . Is ( keyHash , key ) :
8887 var qHash = value . Payload . Hash64 ( ) ;
8988 switch ( value . Payload . Length )
9089 {
91- case FH . bin . Length when FH . bin . Is ( qHash , value ) :
90+ case bin . Length when bin . Is ( qHash , value ) :
9291 quantType = VectorSetQuantization . Binary ;
9392 break ;
94- case FH . f32 . Length when FH . f32 . Is ( qHash , value ) :
93+ case f32 . Length when f32 . Is ( qHash , value ) :
9594 quantType = VectorSetQuantization . None ;
9695 break ;
97- case FH . int8 . Length when FH . int8 . Is ( qHash , value ) :
96+ case int8 . Length when int8 . Is ( qHash , value ) :
9897 quantType = VectorSetQuantization . Int8 ;
9998 break ;
10099 default :
@@ -104,20 +103,34 @@ when FH.vector_dim.Is(keyHash, key) && value.TryGetInt64(out var i64):
104103 }
105104
106105 break ;
107- case FH . hnsw_max_node_uid . Length
108- when FH . hnsw_max_node_uid . Is ( keyHash , key ) && value . TryGetInt64 ( out var i64 ) :
106+ case hnsw_max_node_uid . Length
107+ when hnsw_max_node_uid . Is ( keyHash , key ) && value . TryGetInt64 ( out var i64 ) :
109108 hnswMaxNodeUid = i64 ;
110109 break ;
111110 }
112111 }
113112
114113 SetResult (
115114 message ,
116- new VectorSetInfo ( quantType , quantTypeRaw , vectorDim , size , maxLevel , vsetUid , hnswMaxNodeUid ) ) ;
115+ new VectorSetInfo ( quantType , quantTypeRaw , vectorDim , resultSize , maxLevel , vsetUid , hnswMaxNodeUid ) ) ;
117116 return true ;
118117 }
119118
120119 return false ;
121120 }
121+
122+ #pragma warning disable CS8981 , SA1134 , SA1300 , SA1303 , SA1502
123+ // ReSharper disable InconsistentNaming - to better represent expected literals
124+ [ FastHash ] public static partial class bin { }
125+ [ FastHash ] public static partial class f32 { }
126+ [ FastHash ] public static partial class int8 { }
127+ [ FastHash ] public static partial class size { }
128+ [ FastHash ] public static partial class vset_uid { }
129+ [ FastHash ] public static partial class max_level { }
130+ [ FastHash ] public static partial class quant_type { }
131+ [ FastHash ] public static partial class vector_dim { }
132+ [ FastHash ] public static partial class hnsw_max_node_uid { }
133+ // ReSharper restore InconsistentNaming
134+ #pragma warning restore CS8981 , SA1134 , SA1300 , SA1303 , SA1502
122135 }
123136}
0 commit comments