public Dictionary<byte[], byte[]> ExecuteOperation(ITransport transport) { HeaderParams param = WriteHeader(transport, BULK_GET_REQUEST); transport.WriteVInt(entryCount); transport.Flush(); ReadHeaderAndValidate(transport, param); Dictionary<byte[], byte[]> result = new Dictionary<byte[], byte[]>(); while (transport.ReadByte() == 1) { result.Add(transport.ReadArray(), transport.ReadArray()); } return result; }
public HeaderParams WriteHeader(ITransport trans, HeaderParams param, byte ver) { trans.WriteByte(HotRodConstants.REQUEST_MAGIC); //TODO: Implement a proper way to increment message ID Random r = new Random(); StringBuilder sb = new StringBuilder(); param.MessageId(r.Next(0, 255)); trans.WriteVLong(param.Messageid); //message id trans.WriteByte(HotRodConstants.VERSION_11);//version trans.WriteByte(param.OperCode);//opcode if (param.Cachename.Length != 0) { trans.WriteArray(param.Cachename); // Cache name is not used for default cache } else { trans.WriteVInt(param.Cachename.Length);//default cache name. therefore cache name length is 0 } int flagInt = 0x00; //0x00 Used here since intention is to use no flags if (param.Flag != null) { foreach (Flag f in param.Flag) { flagInt = f.GetFlagInt() | flagInt; } } trans.WriteVInt(flagInt);//flag is 0 for base clients trans.WriteByte(param.Clientintel); trans.WriteVInt(cacheManager.GetTopologyId());//for basic clients topology ID = 0 if (logger.IsTraceEnabled) logger.Trace("topologyID Sent = " + param.Topologyid); trans.WriteByte(param.Txmarker); return param; }