Пример #1
0
        public RiakResult <RiakSearchResult> Search(RiakSearchRequest search)
        {
            var request  = search.ToMessage();
            var response = UseConnection(conn => conn.PbcWriteRead <RpbSearchQueryReq, RpbSearchQueryResp>(request));

            if (response.IsSuccess)
            {
                return(RiakResult <RiakSearchResult> .Success(new RiakSearchResult(response.Value)));
            }

            return(RiakResult <RiakSearchResult> .Error(response.ResultCode, response.ErrorMessage, response.NodeOffline));
        }
Пример #2
0
        public Task <RiakResult <RiakSearchResult> > Search(RiakSearchRequest search)
        {
            var request = search.ToMessage();

            return(UseConnection(conn => conn.PbcWriteRead <RpbSearchQueryReq, RpbSearchQueryResp>(request))
                   .ContinueWith((Task <RiakResult <RpbSearchQueryResp> > finishedTask) => {
                var result = finishedTask.Result;
                if (result.IsSuccess)
                {
                    return RiakResult <RiakSearchResult> .Success(new RiakSearchResult(result.Value));
                }

                return RiakResult <RiakSearchResult> .Error(result.ResultCode, result.ErrorMessage, result.NodeOffline);
            }));
        }
Пример #3
0
        public async Task <Either <RiakException, RiakSearchResult> > Search(RiakSearchRequest search)
        {
            var request = search.ToMessage();

            try
            {
                var response = await _connection.PbcWriteRead <RpbSearchQueryReq, RpbSearchQueryResp>(_endPoint, request)
                               .ConfigureAwait(false);

                return(new Either <RiakException, RiakSearchResult>(new RiakSearchResult(response)));
            }
            catch (RiakException riakException)
            {
                return(new Either <RiakException, RiakSearchResult>(riakException));
            }
        }