|
4 | 4 | using System; |
5 | 5 | using System.Text; |
6 | 6 | using Garnet.common; |
7 | | -using Tsavorite.core; |
8 | 7 |
|
9 | 8 | namespace Garnet.server |
10 | 9 | { |
@@ -95,7 +94,7 @@ private bool HashGet<TGarnetApi>(RespCommand command, ref TGarnetApi storageApi) |
95 | 94 | var input = new ObjectInput(header, ref parseState, startIdx: 1); |
96 | 95 |
|
97 | 96 | // Prepare GarnetObjectStore output |
98 | | - var output = new GarnetObjectStoreOutput { SpanByteAndMemory = new SpanByteAndMemory(dcurr, (int)(dend - dcurr)) }; |
| 97 | + var output = new GarnetObjectStoreOutput(new(dcurr, (int)(dend - dcurr))); |
99 | 98 |
|
100 | 99 | var status = storageApi.HashGet(keyBytes, ref input, ref output); |
101 | 100 |
|
@@ -138,7 +137,7 @@ private bool HashGetAll<TGarnetApi>(RespCommand command, ref TGarnetApi storageA |
138 | 137 | var input = new ObjectInput(header, respProtocolVersion); |
139 | 138 |
|
140 | 139 | // Prepare GarnetObjectStore output |
141 | | - var output = new GarnetObjectStoreOutput { SpanByteAndMemory = new SpanByteAndMemory(dcurr, (int)(dend - dcurr)) }; |
| 140 | + var output = new GarnetObjectStoreOutput(new(dcurr, (int)(dend - dcurr))); |
142 | 141 |
|
143 | 142 | var status = storageApi.HashGetAll(keyBytes, ref input, ref output); |
144 | 143 |
|
@@ -182,7 +181,7 @@ private bool HashGetMultiple<TGarnetApi>(RespCommand command, ref TGarnetApi sto |
182 | 181 | var input = new ObjectInput(header, ref parseState, startIdx: 1); |
183 | 182 |
|
184 | 183 | // Prepare GarnetObjectStore output |
185 | | - var output = new GarnetObjectStoreOutput { SpanByteAndMemory = new SpanByteAndMemory(dcurr, (int)(dend - dcurr)) }; |
| 184 | + var output = new GarnetObjectStoreOutput(new(dcurr, (int)(dend - dcurr))); |
186 | 185 |
|
187 | 186 | var status = storageApi.HashGetMultiple(keyBytes, ref input, ref output); |
188 | 187 |
|
@@ -265,15 +264,15 @@ private bool HashRandomField<TGarnetApi>(RespCommand command, ref TGarnetApi sto |
265 | 264 | var input = new ObjectInput(header, countWithMetadata, seed); |
266 | 265 |
|
267 | 266 | // Prepare GarnetObjectStore output |
268 | | - var output = new GarnetObjectStoreOutput { SpanByteAndMemory = new SpanByteAndMemory(dcurr, (int)(dend - dcurr)) }; |
| 267 | + var output = new GarnetObjectStoreOutput(new(dcurr, (int)(dend - dcurr))); |
269 | 268 |
|
270 | 269 | var status = GarnetStatus.NOTFOUND; |
271 | 270 |
|
272 | 271 | // This prevents going to the backend if HRANDFIELD is called with a count of 0 |
273 | 272 | if (paramCount != 0) |
274 | 273 | { |
275 | 274 | // Prepare GarnetObjectStore output |
276 | | - output = new GarnetObjectStoreOutput { SpanByteAndMemory = new SpanByteAndMemory(dcurr, (int)(dend - dcurr)) }; |
| 275 | + output = new GarnetObjectStoreOutput(new(dcurr, (int)(dend - dcurr))); |
277 | 276 | status = storageApi.HashRandomField(keyBytes, ref input, ref output); |
278 | 277 | } |
279 | 278 |
|
@@ -504,7 +503,7 @@ private unsafe bool HashKeys<TGarnetApi>(RespCommand command, ref TGarnetApi sto |
504 | 503 | var input = new ObjectInput(header); |
505 | 504 |
|
506 | 505 | // Prepare GarnetObjectStore output |
507 | | - var output = new GarnetObjectStoreOutput { SpanByteAndMemory = new SpanByteAndMemory(dcurr, (int)(dend - dcurr)) }; |
| 506 | + var output = new GarnetObjectStoreOutput(new(dcurr, (int)(dend - dcurr))); |
508 | 507 |
|
509 | 508 | var status = command == RespCommand.HKEYS |
510 | 509 | ? storageApi.HashKeys(keyBytes, ref input, ref output) |
@@ -562,7 +561,7 @@ private unsafe bool HashIncrement<TGarnetApi>(RespCommand command, ref TGarnetAp |
562 | 561 | var input = new ObjectInput(header, ref parseState, startIdx: 1); |
563 | 562 |
|
564 | 563 | // Prepare GarnetObjectStore output |
565 | | - var output = new GarnetObjectStoreOutput { SpanByteAndMemory = new SpanByteAndMemory(dcurr, (int)(dend - dcurr)) }; |
| 564 | + var output = new GarnetObjectStoreOutput(new(dcurr, (int)(dend - dcurr))); |
566 | 565 |
|
567 | 566 | var status = storageApi.HashIncrement(keyBytes, ref input, ref output); |
568 | 567 |
|
@@ -656,7 +655,7 @@ private unsafe bool HashExpire<TGarnetApi>(RespCommand command, ref TGarnetApi s |
656 | 655 | var header = new RespInputHeader(GarnetObjectType.Hash) { HashOp = HashOperation.HEXPIRE }; |
657 | 656 | var input = new ObjectInput(header, ref fieldsParseState); |
658 | 657 |
|
659 | | - var output = new GarnetObjectStoreOutput { SpanByteAndMemory = new SpanByteAndMemory(dcurr, (int)(dend - dcurr)) }; |
| 658 | + var output = new GarnetObjectStoreOutput(new(dcurr, (int)(dend - dcurr))); |
660 | 659 |
|
661 | 660 | var status = storageApi.HashExpire(key, expireAt, isMilliseconds, expireOption, ref input, ref output); |
662 | 661 |
|
@@ -746,7 +745,7 @@ private unsafe bool HashTimeToLive<TGarnetApi>(RespCommand command, ref TGarnetA |
746 | 745 | var header = new RespInputHeader(GarnetObjectType.Hash) { HashOp = HashOperation.HTTL }; |
747 | 746 | var input = new ObjectInput(header, ref fieldsParseState); |
748 | 747 |
|
749 | | - var output = new GarnetObjectStoreOutput { SpanByteAndMemory = new SpanByteAndMemory(dcurr, (int)(dend - dcurr)) }; |
| 748 | + var output = new GarnetObjectStoreOutput(new(dcurr, (int)(dend - dcurr))); |
750 | 749 |
|
751 | 750 | var status = storageApi.HashTimeToLive(key, isMilliseconds, isTimestamp, ref input, ref output); |
752 | 751 |
|
@@ -808,7 +807,7 @@ private unsafe bool HashPersist<TGarnetApi>(ref TGarnetApi storageApi) |
808 | 807 | var header = new RespInputHeader(GarnetObjectType.Hash) { HashOp = HashOperation.HPERSIST }; |
809 | 808 | var input = new ObjectInput(header, ref fieldsParseState); |
810 | 809 |
|
811 | | - var output = new GarnetObjectStoreOutput { SpanByteAndMemory = new SpanByteAndMemory(dcurr, (int)(dend - dcurr)) }; |
| 810 | + var output = new GarnetObjectStoreOutput(new(dcurr, (int)(dend - dcurr))); |
812 | 811 |
|
813 | 812 | var status = storageApi.HashPersist(key, ref input, ref output); |
814 | 813 |
|
|
0 commit comments