private async Task <Either <RiakException, RiakStreamedIndexResult> > StreamIndexGetRange(string bucket, string indexName, string minValue, string maxValue, RiakIndexGetOptions options = null) { var message = new RpbIndexReq { bucket = bucket.ToRiakString(), index = indexName.ToRiakString(), qtype = RpbIndexReq.IndexQueryType.range, range_min = minValue.ToRiakString(), range_max = maxValue.ToRiakString(), stream = true }; options = options ?? new RiakIndexGetOptions(); options.Populate(message); try { var result = _connection.PbcWriteStreamRead <RpbIndexReq, RpbIndexResp>(_endPoint, message, lbr => !lbr.done); var includeTerms = ReturnTerms(options); var riakStreamedIndexResult = new RiakStreamedIndexResult(includeTerms, result); return(new Either <RiakException, RiakStreamedIndexResult>(riakStreamedIndexResult)); } catch (RiakException riakException) { return(new Either <RiakException, RiakStreamedIndexResult>(riakException)); } }
private async Task <Either <RiakException, RiakIndexResult> > IndexGetEquals(string bucket, string indexName, string value, RiakIndexGetOptions options = null) { var message = new RpbIndexReq { bucket = bucket.ToRiakString(), index = indexName.ToRiakString(), key = value.ToRiakString(), qtype = RpbIndexReq.IndexQueryType.eq }; options = options ?? new RiakIndexGetOptions(); options.Populate(message); try { var result = await _connection.PbcWriteRead <RpbIndexReq, RpbIndexResp>(_endPoint, message).ConfigureAwait(false); var includeTerms = ReturnTerms(options); var riakIndexResult = new RiakIndexResult(includeTerms, result); return(new Either <RiakException, RiakIndexResult>(riakIndexResult)); } catch (RiakException riakException) { return(new Either <RiakException, RiakIndexResult>(riakException)); } }