Example #1
0
        public object Execute(string scriptName, IDictionary <string, Object> dict = null)
        {
            VectorMap vm = new VectorMap();

            if (dict != null)
            {
                foreach (KeyValuePair <string, Object> p in dict)
                {
                    VectorChar vcKey   = toVectorChar(p.Key);
                    VectorChar vcValue = toVectorChar(argMarshaller.ObjectToByteBuffer(p.Value));
                    vm.Add(vcKey, vcValue);
                }
            }
            VectorByte vb = cache.execute(scriptName, vm);

            byte[] ret = new byte[vb.Count];
            vb.CopyTo(ret);
            return(argMarshaller.ObjectFromByteBuffer(ret));
        }
Example #2
0
        public QueryResponse Query(QueryRequest qr)
        {
            uint size = (uint)qr.CalculateSize();

            byte[]            bytes = new byte[size];
            CodedOutputStream cos   = new CodedOutputStream(bytes);

            qr.WriteTo(cos);
            cos.Flush();
            string     s2   = System.Text.Encoding.ASCII.GetString(bytes);
            VectorByte vb   = new VectorByte(bytes);
            VectorByte resp = cache.query(vb, size);

            byte[] respBytes = new byte[resp.Count];
            resp.CopyTo(respBytes);
            QueryResponse queryResp = new QueryResponse();

            return(QueryResponse.Parser.ParseFrom(respBytes));
        }