public async Task <Either <RiakException, RiakObject> > Get(string bucket, string key, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); if (!IsValidBucketOrKey(bucket)) { return(new Either <RiakException, RiakObject>(new RiakException((uint)ResultCode.InvalidRequest, InvalidBucketErrorMessage, false))); } if (!IsValidBucketOrKey(key)) { return(new Either <RiakException, RiakObject>(new RiakException((uint)ResultCode.InvalidRequest, InvalidKeyErrorMessage, false))); } var request = new RpbGetReq { bucket = bucket.ToRiakString(), key = key.ToRiakString() }; options = options ?? new RiakGetOptions(); options.Populate(request); try { var result = await _connection.PbcWriteRead <RpbGetReq, RpbGetResp>(_endPoint, request).ConfigureAwait(false); if (result.vclock == null) { return(new Either <RiakException, RiakObject>(new RiakException((uint)ResultCode.NotFound, "Unable to find value in Riak", false))); } var riakObject = new RiakObject(bucket, key, result.content, result.vclock); return(new Either <RiakException, RiakObject>(riakObject)); } catch (RiakException riakException) { return(new Either <RiakException, RiakObject>(riakException)); } }
public void Get(IEnumerable <RiakObjectId> bucketKeyPairs, Action <IEnumerable <RiakResult <RiakObject> > > callback, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); ExecAsync(() => callback(_client.Get(bucketKeyPairs, options))); }
public void Get(RiakObjectId objectId, Action <RiakResult <RiakObject> > callback, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); ExecAsync(() => callback(_client.Get(objectId.Bucket, objectId.Key, options))); }
public void Get(string bucket, string key, Action <RiakResult <RiakObject> > callback, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); ExecAsync(() => callback(_client.Get(bucket, key, options))); }
public Task <IEnumerable <RiakResult <RiakObject> > > Get(IEnumerable <RiakObjectId> bucketKeyPairs, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); return(Task.Factory.StartNew(() => _client.Get(bucketKeyPairs, options))); }
public Task <RiakResult <RiakObject> > Get(RiakObjectId objectId, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); return(Task.Factory.StartNew(() => _client.Get(objectId.Bucket, objectId.Key, options))); }
public Task <RiakResult <RiakObject> > Get(string bucket, string key, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); return(Task.Factory.StartNew(() => _client.Get(bucket, key, options))); }