-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPUTALL.cs
54 lines (47 loc) · 1.84 KB
/
PUTALL.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Text;
using BeetleX.Buffers;
namespace Infinispan.Hotrod.Core.Commands
{
public class PUTALL<K, V> : Command, ICommandWithExpiration
{
public PUTALL(Marshaller<K> km, Marshaller<V> vm, IDictionary<K, V> map)
{
Map = map;
KeyMarshaller = km;
ValueMarshaller = vm;
NetworkReceive = OnReceive;
}
public Marshaller<K> KeyMarshaller;
public Marshaller<V> ValueMarshaller;
public int Segment = -1;
public int TimeOut { get; set; }
public ExpirationTime Lifespan { get; set; } = new ExpirationTime { Unit = TimeUnit.DEFAULT, Value = 0 };
public ExpirationTime MaxIdle { get; set; } = new ExpirationTime { Unit = TimeUnit.DEFAULT, Value = 0 };
public override string Name => "PUTALL";
public override Byte Code => 0x2D;
public IDictionary<K, V> Map { get; set; }
public V PrevValue { get; set; }
internal override void OnExecute(CommandContext ctx)
{
base.OnExecute(ctx);
}
internal override void Execute(CommandContext ctx, InfinispanClient client, PipeStream stream)
{
base.Execute(ctx, client, stream);
Codec.writeExpirations(Lifespan, MaxIdle, stream);
Codec.writeVInt(Map.Count, stream);
foreach (var entry in Map)
{
Codec.writeArray(KeyMarshaller.marshall(entry.Key), stream);
Codec.writeArray(ValueMarshaller.marshall(entry.Value), stream);
}
stream.Flush();
}
public override Result OnReceive(InfinispanRequest request, ResponseStream stream)
{
return new Result { Status = ResultStatus.Completed, ResultType = ResultType.Null };
}
}
}