/// <summary> /// Lists all buckets available on the Riak cluster. /// </summary> /// <returns> /// An <see cref="System.Collections.Generic.IEnumerable<T>"/> of <see cref="string"/> bucket names. /// </returns> /// <remarks>Buckets provide a logical namespace for keys. Listing buckets requires folding over all keys in a cluster and /// reading a list of buckets from disk. This operation, while non-blocking in Riak 1.0 and newer, still produces considerable /// physical I/O and can take a long time.</remarks> public RiakResult <IEnumerable <string> > ListBuckets() { var lbReq = new RpbListBucketsReq(); var result = UseConnection(conn => conn.PbcWriteRead <RpbListBucketsReq, RpbListBucketsResp>(lbReq)); if (result.IsSuccess) { var buckets = result.Value.Buckets.Select(b => b.FromRiakString()); return(RiakResult <IEnumerable <string> > .Success(buckets.ToList())); } return(RiakResult <IEnumerable <string> > .Error(result.ResultCode, result.ErrorMessage)); }
public IObservable <Either <RiakException, string> > StreamListBuckets() { var lbReq = new RpbListBucketsReq { stream = true }; var buckets = _connection .PbcWriteStreamRead <RpbListBucketsReq, RpbListBucketsResp>(_endPoint, lbReq, lbr => !lbr.done) .SelectMany(r => r.buckets) .Select(k => new Either <RiakException, string>(k.FromRiakString())) .Catch <Either <RiakException, string>, RiakException>(exception => Observable.Return(new Either <RiakException, string>(exception))); return(buckets); }