Skip to content

Commit 5642817

Browse files
committed
more removals
1 parent 850ccfd commit 5642817

2 files changed

Lines changed: 0 additions & 92 deletions

File tree

src/StackExchange.Redis/ResultProcessor.Lease.cs

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,8 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
6363
// especially useful for VLINKS
6464
private abstract class FlattenedLeaseProcessor<T> : ResultProcessor<Lease<T>?>
6565
{
66-
protected virtual long GetArrayLength(in RawResult array) => array.GetItems().Length;
67-
6866
protected virtual long GetArrayLength(in RespReader reader) => reader.AggregateLength();
6967

70-
protected virtual bool TryReadOne(ref Sequence<RawResult>.Enumerator reader, out T value)
71-
{
72-
if (reader.MoveNext())
73-
{
74-
return TryReadOne(in reader.Current, out value);
75-
}
76-
value = default!;
77-
return false;
78-
}
79-
80-
protected virtual bool TryReadOne(in RawResult result, out T value)
81-
{
82-
value = default!;
83-
return false;
84-
}
85-
8668
protected virtual bool TryReadOne(ref RespReader reader, out T value)
8769
{
8870
value = default!;
@@ -159,56 +141,6 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
159141
throw;
160142
}
161143
}
162-
163-
protected override bool SetResultCore(PhysicalConnection connection, Message message, RawResult result)
164-
{
165-
if (result.Resp2TypeArray != ResultType.Array)
166-
{
167-
return false; // not an array
168-
}
169-
if (result.IsNull)
170-
{
171-
SetResult(message, Lease<T>.Empty);
172-
return true;
173-
}
174-
var items = result.GetItems();
175-
long length = 0;
176-
foreach (ref RawResult item in items)
177-
{
178-
if (item.Resp2TypeArray == ResultType.Array && !item.IsNull)
179-
{
180-
length += GetArrayLength(in item);
181-
}
182-
}
183-
184-
if (length == 0)
185-
{
186-
SetResult(message, Lease<T>.Empty);
187-
return true;
188-
}
189-
var lease = Lease<T>.Create(checked((int)length), clear: false);
190-
int index = 0;
191-
var target = lease.Span;
192-
foreach (ref RawResult item in items)
193-
{
194-
if (item.Resp2TypeArray == ResultType.Array && !item.IsNull)
195-
{
196-
var iter = item.GetItems().GetEnumerator();
197-
while (index < target.Length && TryReadOne(ref iter, out target[index]))
198-
{
199-
index++;
200-
}
201-
}
202-
}
203-
204-
if (index == length)
205-
{
206-
SetResult(message, lease);
207-
return true;
208-
}
209-
lease.Dispose(); // failed to fill?
210-
return false;
211-
}
212144
}
213145

214146
private sealed class LeaseFloat32Processor : LeaseProcessor<float>

src/StackExchange.Redis/ResultProcessor.VectorSets.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ internal abstract partial class ResultProcessor
1919

2020
private sealed class VectorSetLinksWithScoresProcessor : FlattenedLeaseProcessor<VectorSetLink>
2121
{
22-
protected override long GetArrayLength(in RawResult array) => array.GetItems().Length / 2;
23-
2422
protected override long GetArrayLength(in RespReader reader) => reader.AggregateLength() / 2;
2523

2624
protected override bool TryReadOne(ref RespReader reader, out VectorSetLink value)
@@ -41,22 +39,6 @@ protected override bool TryReadOne(ref RespReader reader, out VectorSetLink valu
4139
value = new VectorSetLink(member, score);
4240
return true;
4341
}
44-
45-
protected override bool TryReadOne(ref Sequence<RawResult>.Enumerator reader, out VectorSetLink value)
46-
{
47-
if (reader.MoveNext())
48-
{
49-
ref readonly RawResult first = ref reader.Current;
50-
if (reader.MoveNext() && reader.Current.TryGetDouble(out var score))
51-
{
52-
value = new VectorSetLink(first.AsRedisValue(), score);
53-
return true;
54-
}
55-
}
56-
57-
value = default;
58-
return false;
59-
}
6042
}
6143

6244
private sealed class VectorSetLinksProcessor : FlattenedLeaseProcessor<RedisValue>
@@ -72,12 +54,6 @@ protected override bool TryReadOne(ref RespReader reader, out RedisValue value)
7254
value = reader.ReadRedisValue();
7355
return true;
7456
}
75-
76-
protected override bool TryReadOne(in RawResult result, out RedisValue value)
77-
{
78-
value = result.AsRedisValue();
79-
return true;
80-
}
8157
}
8258

8359
private sealed partial class VectorSetInfoProcessor : ResultProcessor<VectorSetInfo?>

0 commit comments

Comments
 (0)