コード例 #1
0
        private void Poll(RiakResult<RiakStreamedMapReduceResult> result)
        {
            if (result.IsSuccess)
            {
                foreach (var phase in result.Value.PhaseResults)
                {
                    // make sure we get hold of the phase result which has data
                    if (phase.Value != null)
                    {
                        // deserialize into an array of messages
                        var messages = phase.GetObject<YakMessage[]>();

                        // throw them on screen
                        foreach (var m in messages)
                        {
                            DisplayMessage(m);
                            _since = m.timestamp + 1;
                        }
                    }
                }
            }

            // create the next map reduce job
            var pollQuery = new RiakMapReduceQuery()
                .Inputs("messages")
                .MapJs(m => m.BucketKey("yakmr", "mapMessageSince").Argument(_since))
                .ReduceJs(r => r.BucketKey("yakmr", "reduceSortTimestamp").Keep(true));

            // do the usual wait
            WaitRandom();

            // and off we go again.
            _riakClient.Async.StreamMapReduce(pollQuery, Poll);
        }
コード例 #2
0
 public RiakHeadPointerPersistenceException(string message, RiakResult<RiakObject> result)
     : base(message, result)
 {
 }
コード例 #3
0
        static void HandleStreamingMapReduce(RiakResult<RiakStreamedMapReduceResult> streamingMRResult, EventWaitHandle handle)
        {
            System.Diagnostics.Debug.Assert(streamingMRResult.IsSuccess);
            foreach (var result in streamingMRResult.Value.PhaseResults)
            {
                Console.WriteLine("Handling async result ...");
                if (result.Phase == 1)
                {
                    System.Diagnostics.Debug.Assert(result.GetObjects<int[]>().First()[0] == 12);
                }
            }

            handle.Set();
        }
コード例 #4
0
 public RiakPointerPersistenceException(string message, RiakResult<RiakObject> result)
     : base(message)
 {
     Result = result;
 }