Created
July 5, 2013 23:27
-
-
Save peschkaj/5937828 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public RiakResult<IEnumerable<string>> StreamListBuckets() | |
{ | |
var lbReq = new RpbListBucketsReq { stream = true }; | |
var result = UseDelayedConnection((conn, onFinish) => | |
conn.PbcWriteStreamRead<RpbListBucketsReq, RpbListBucketsResp>(lbReq, lbr => lbr.IsSuccess && !lbr.Value.done, onFinish)); | |
if(result.IsSuccess) | |
{ | |
var buckets = result.Value.Where(r => r.IsSuccess).SelectMany(r => r.Value.buckets).Select(k => k.FromRiakString()); | |
return RiakResult<IEnumerable<string>>.Success(buckets); | |
} | |
return RiakResult<IEnumerable<string>>.Error(result.ResultCode, result.ErrorMessage, result.NodeOffline); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes this might suffice. Though I do think we need to think more about it. The reason is because I think we're currently relying on the caller to enumerate the collection fully before we put the connection back in the pool. We should have a chat about how we should handle this because if they bomb out early (ie. don't enumerate the lot) then we could leak connections.