コード例 #1
0
        private void Read(FasterKV <MyKey, MyValue, MyInput, MyOutput, MyContext, MyFunctions> h, MyContext context, bool delete)
        {
            var key = new MyKey {
                key = 1, name = "1"
            };
            var      input  = default(MyInput);
            MyOutput g1     = new MyOutput();
            var      status = h.Read(ref key, ref input, ref g1, context, 0);

            if (status == Status.PENDING)
            {
                h.CompletePending(true);
                context.FinalizeRead(ref status, ref g1);
            }

            Assert.IsTrue(status == Status.OK);

            MyOutput g2 = new MyOutput();

            key = new MyKey {
                key = 2, name = "2"
            };
            status = h.Read(ref key, ref input, ref g2, context, 0);

            if (status == Status.PENDING)
            {
                h.CompletePending(true);
                context.FinalizeRead(ref status, ref g2);
            }

            Assert.IsTrue(status == Status.OK);

            if (delete)
            {
                var output = new MyOutput();
                h.Delete(ref key, context, 0);
                status = h.Read(ref key, ref input, ref output, context, 0);

                if (status == Status.PENDING)
                {
                    h.CompletePending(true);
                    context.FinalizeRead(ref status, ref output);
                }

                Assert.IsTrue(status == Status.NOTFOUND);
            }
        }
コード例 #2
0
        private void Read(ClientSession <MyKey, MyValue, MyInput, MyOutput, MyContext, MyFunctions> session, MyContext context, bool delete)
        {
            for (int i = 0; i < iterations; i++)
            {
                var key = new MyKey {
                    key = i, name = i.ToString()
                };
                var      input  = default(MyInput);
                MyOutput g1     = new MyOutput();
                var      status = session.Read(ref key, ref input, ref g1, context, 0);

                if (status == Status.PENDING)
                {
                    session.CompletePending(true);
                    context.FinalizeRead(ref status, ref g1);
                }

                Assert.IsTrue(status == Status.OK);
                Assert.IsTrue(g1.value.value == i.ToString());
            }

            if (delete)
            {
                var key = new MyKey {
                    key = 1, name = "1"
                };
                var input  = default(MyInput);
                var output = new MyOutput();
                session.Delete(ref key, context, 0);
                var status = session.Read(ref key, ref input, ref output, context, 0);

                if (status == Status.PENDING)
                {
                    session.CompletePending(true);
                    context.FinalizeRead(ref status, ref output);
                }

                Assert.IsTrue(status == Status.NOTFOUND);
            }
        }
コード例 #3
0
 internal void FinalizeRead(ref Status status, ref MyOutput g1)
 {
     status = _status;
     g1     = _g1;
 }
コード例 #4
0
 internal void Populate(ref Status status, ref MyOutput g1)
 {
     _status = status;
     _g1     = g1;
 }