Package com.basho.riak.client.raw

Examples of com.basho.riak.client.raw.FetchMeta$Builder


        if(fetchBeforeDelete) {
            Callable<VClock> fetch = new Callable<VClock>() {
                public VClock call() throws Exception {
                    // TODO this should be a head only operation for efficiency,
                    // change when implemented
                    RiakResponse response = client.fetch(bucket, key, new FetchMeta(r, pr, null, null, null, null,
                                                                                    null, null));
                    return response.getVclock();
                }
            };
View Full Code Here


        return rm;
    }

    static RequestMeta convert(DeleteMeta deleteMeta) {
        RequestMeta rm = convert(new FetchMeta(deleteMeta.getR(), deleteMeta.getPr(), null, null, null, null, null,
                                               null));

        if (deleteMeta.hasW()) {
            rm.setQueryParam(Constants.QP_W, deleteMeta.getW().toString());
        }
View Full Code Here

     *             if the supplied {@link Converter} throws trying to convert
     *             the retrieved value.
     */
    public T execute() throws UnresolvedConflictException, RiakRetryFailedException, ConversionException {
        // fetch, resolve
        final FetchMeta fetchMeta = builder.build();
        Callable<RiakResponse> command = new Callable<RiakResponse>() {
            public RiakResponse call() throws Exception {
                return client.fetch(bucket, key, fetchMeta);
            }
        };

        rawResponse = retrier.attempt(command);
        final Collection<T> siblings = new ArrayList<T>(rawResponse.numberOfValues());
       
        // When talking about tombstones, our two protocols have
        // different behaviors.
        //
        // When using Protocol Buffers Riak will not return a deleted vclock
        // object unless explicitly told to do so in the request. If only
        //
        // HTTP has no such request header/parameter and will always return
        // the vclock of a deleted item or sibling.
        //
        // Unfortunately due to how the orig. HTTP client is designed it would
        // take significant effot to rewrite it not to return the vclock from a 404
        // back up to here based on the request meta,
        // so we simply explicitly check it here now that we have an object(s)

        for (IRiakObject o : rawResponse) {
            if (o.isDeleted() && (fetchMeta.getReturnDeletedVClock() == null ||
                !fetchMeta.getReturnDeletedVClock()) ) {
                continue;
            }
            siblings.add(converter.toDomain(o));
        }

View Full Code Here

        FetchResponse fr = client.fetch(bucket, key, convert(fetchMeta));

        if (fr.hasSiblings()) {
            // do a full fetch to get the sibling values
            FetchMeta fm = FetchMeta.Builder.from(fetchMeta).headOnly(false).build();
            fr = client.fetch(bucket, key, convert(fm));
        }

        return convert(fr);
    }
View Full Code Here

        return rm;
    }

    static RequestMeta convert(DeleteMeta deleteMeta) {
        RequestMeta rm = convert(new FetchMeta(deleteMeta.getR(), deleteMeta.getPr(), null, null, null, null, null,
                                               null));

        if (deleteMeta.hasW()) {
            rm.setQueryParam(Constants.QP_W, deleteMeta.getW().toString());
        }
View Full Code Here

        }

        if (fetchMeta == null) {
            fetchMeta = FetchMeta.head();
        } else {
            fetchMeta = new FetchMeta(fetchMeta.getR(), fetchMeta.getPr(), fetchMeta.getNotFoundOK(),
                                      fetchMeta.getBasicQuorum(), true, fetchMeta.getReturnDeletedVClock(),
                                      fetchMeta.getIfModifiedSince(), fetchMeta.getIfModifiedVClock());
        }

        RequestMeta rm = convert(fetchMeta);
View Full Code Here

     * @return a List of {@link MultiFetchFuture} objects.
     */
    public List<MultiFetchFuture<T>> execute()
    {
        List<MultiFetchFuture<T>> futureList = new ArrayList<MultiFetchFuture<T>>(keys.size());
        FetchMeta fetchMeta = builder.build();
        for (String key : keys)
        {
            FetchObject<T> fetchObject = new FetchObject<T>(client, bucket, key, retrier, fetchMeta)
                                                .withConverter(converter)
                                                .withResolver(resolver);
View Full Code Here

     *             if the supplied {@link Converter} throws trying to convert
     *             the retrieved value.
     */
    public T execute() throws UnresolvedConflictException, RiakRetryFailedException, ConversionException {
        // fetch, resolve
        final FetchMeta fetchMeta = builder.build();
        Callable<RiakResponse> command = new Callable<RiakResponse>() {
            public RiakResponse call() throws Exception {
                return client.fetch(bucket, key, fetchMeta);
            }
        };

        rawResponse = retrier.attempt(command);
        final Collection<T> siblings = new ArrayList<T>(rawResponse.numberOfValues());
       
        // When talking about tombstones, our two protocols have
        // different behaviors.
        //
        // When using Protocol Buffers Riak will not return a deleted vclock
        // object unless explicitly told to do so in the request. If only
        //
        // HTTP has no such request header/parameter and will always return
        // the vclock of a deleted item or sibling.
        //
        // Unfortunately due to how the orig. HTTP client is designed it would
        // take significant effot to rewrite it not to return the vclock from a 404
        // back up to here based on the request meta,
        // so we simply explicitly check it here now that we have an object(s)

        for (IRiakObject o : rawResponse) {
            if (o.isDeleted() && (fetchMeta.getReturnDeletedVClock() == null ||
                !fetchMeta.getReturnDeletedVClock()) ) {
                continue;
            }
            siblings.add(converter.toDomain(o));
        }

View Full Code Here

        }

        if (fetchMeta == null) {
            fetchMeta = FetchMeta.head();
        } else {
            fetchMeta = new FetchMeta(fetchMeta.getR(), fetchMeta.getPr(), fetchMeta.getNotFoundOK(),
                                      fetchMeta.getBasicQuorum(), true, fetchMeta.getReturnDeletedVClock(),
                                      fetchMeta.getIfModifiedSince(), fetchMeta.getIfModifiedVClock());
        }

        RequestMeta rm = convert(fetchMeta);
View Full Code Here

    static RequestMeta convert(DeleteMeta deleteMeta) {
        if(deleteMeta == null) {
            return null;
        }
        RequestMeta rm = convert(new FetchMeta(deleteMeta.getR(), deleteMeta.getPr(), null, null, null, null, null,
                                               null));

        if (deleteMeta.hasW()) {
            if (deleteMeta.getW().isSymbolic())
                rm.setQueryParam(Constants.QP_W, deleteMeta.getW().getName());
View Full Code Here

TOP

Related Classes of com.basho.riak.client.raw.FetchMeta$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.