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)); }
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); })); }
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)); } }