All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.palantir.atlasdb.timelock.api.ConjureTimelockServiceAsync Maven / Gradle / Ivy

There is a newer version: 0.1152.0
Show newest version
package com.palantir.atlasdb.timelock.api;

import com.google.common.util.concurrent.ListenableFuture;
import com.palantir.conjure.java.lib.internal.ClientEndpoint;
import com.palantir.dialogue.Channel;
import com.palantir.dialogue.ConjureRuntime;
import com.palantir.dialogue.Deserializer;
import com.palantir.dialogue.DialogueService;
import com.palantir.dialogue.DialogueServiceFactory;
import com.palantir.dialogue.Endpoint;
import com.palantir.dialogue.EndpointChannel;
import com.palantir.dialogue.EndpointChannelFactory;
import com.palantir.dialogue.PlainSerDe;
import com.palantir.dialogue.Request;
import com.palantir.dialogue.Serializer;
import com.palantir.dialogue.TypeMarker;
import com.palantir.lock.v2.LeaderTime;
import com.palantir.logsafe.Safe;
import com.palantir.tokens.auth.AuthHeader;
import java.lang.Override;
import java.lang.String;
import javax.annotation.processing.Generated;

@Generated("com.palantir.conjure.java.services.dialogue.DialogueInterfaceGenerator")
@DialogueService(ConjureTimelockServiceAsync.Factory.class)
public interface ConjureTimelockServiceAsync {
    /** @apiNote {@code POST /tl/st/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/st/{namespace}")
    ListenableFuture startTransactions(
            AuthHeader authHeader, @Safe String namespace, ConjureStartTransactionsRequest request);

    /** @apiNote {@code POST /tl/ts/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/ts/{namespace}")
    ListenableFuture getFreshTimestamps(
            AuthHeader authHeader, @Safe String namespace, ConjureGetFreshTimestampsRequest request);

    /** @apiNote {@code POST /tl/t2/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/t2/{namespace}")
    ListenableFuture getFreshTimestampsV2(
            AuthHeader authHeader, @Safe String namespace, ConjureGetFreshTimestampsRequestV2 request);

    /** @apiNote {@code POST /tl/ts1/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/ts1/{namespace}")
    ListenableFuture getFreshTimestamp(AuthHeader authHeader, @Safe String namespace);

    /** @apiNote {@code POST /tl/lt/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/lt/{namespace}")
    ListenableFuture leaderTime(AuthHeader authHeader, @Safe String namespace);

    /** @apiNote {@code POST /tl/l/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/l/{namespace}")
    ListenableFuture lock(
            AuthHeader authHeader, @Safe String namespace, ConjureLockRequest request);

    /** @apiNote {@code POST /tl/wl/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/wl/{namespace}")
    ListenableFuture waitForLocks(
            AuthHeader authHeader, @Safe String namespace, ConjureLockRequest request);

    /** @apiNote {@code POST /tl/rl/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/rl/{namespace}")
    ListenableFuture refreshLocks(
            AuthHeader authHeader, @Safe String namespace, ConjureRefreshLocksRequest request);

    /** @apiNote {@code POST /tl/rl2/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/rl2/{namespace}")
    ListenableFuture refreshLocksV2(
            AuthHeader authHeader, @Safe String namespace, ConjureRefreshLocksRequestV2 request);

    /** @apiNote {@code POST /tl/ul/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/ul/{namespace}")
    ListenableFuture unlock(
            AuthHeader authHeader, @Safe String namespace, ConjureUnlockRequest request);

    /** @apiNote {@code POST /tl/ul2/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/ul2/{namespace}")
    ListenableFuture unlockV2(
            AuthHeader authHeader, @Safe String namespace, ConjureUnlockRequestV2 request);

    /**
     * Batched endpoint for acquiring commit timestamps (a list of fresh timestamps) and the list of all lock watch
     * events since the last known version up to after the commit timestamps have been issued.
     *
     * @apiNote {@code POST /tl/gct/{namespace}}
     */
    @ClientEndpoint(method = "POST", path = "/tl/gct/{namespace}")
    ListenableFuture getCommitTimestamps(
            AuthHeader authHeader, @Safe String namespace, GetCommitTimestampsRequest request);

    /** @apiNote {@code POST /tl/g1ct/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/g1ct/{namespace}")
    ListenableFuture getCommitTimestamp(
            AuthHeader authHeader, @Safe String namespace, GetCommitTimestampRequest request);

    /** Creates an asynchronous/non-blocking client for a ConjureTimelockService service. */
    static ConjureTimelockServiceAsync of(EndpointChannelFactory _endpointChannelFactory, ConjureRuntime _runtime) {
        return new ConjureTimelockServiceAsync() {
            private final PlainSerDe _plainSerDe = _runtime.plainSerDe();

            private final Serializer startTransactionsSerializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel startTransactionsChannel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.startTransactions);

            private final Deserializer startTransactionsDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final Serializer getFreshTimestampsSerializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel getFreshTimestampsChannel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.getFreshTimestamps);

            private final Deserializer getFreshTimestampsDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final Serializer getFreshTimestampsV2Serializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel getFreshTimestampsV2Channel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.getFreshTimestampsV2);

            private final Deserializer getFreshTimestampsV2Deserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final EndpointChannel getFreshTimestampChannel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.getFreshTimestamp);

            private final Deserializer getFreshTimestampDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final EndpointChannel leaderTimeChannel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.leaderTime);

            private final Deserializer leaderTimeDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final Serializer lockSerializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel lockChannel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.lock);

            private final Deserializer lockDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final Serializer waitForLocksSerializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel waitForLocksChannel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.waitForLocks);

            private final Deserializer waitForLocksDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final Serializer refreshLocksSerializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel refreshLocksChannel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.refreshLocks);

            private final Deserializer refreshLocksDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final Serializer refreshLocksV2Serializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel refreshLocksV2Channel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.refreshLocksV2);

            private final Deserializer refreshLocksV2Deserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final Serializer unlockSerializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel unlockChannel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.unlock);

            private final Deserializer unlockDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final Serializer unlockV2Serializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel unlockV2Channel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.unlockV2);

            private final Deserializer unlockV2Deserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final Serializer getCommitTimestampsSerializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel getCommitTimestampsChannel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.getCommitTimestamps);

            private final Deserializer getCommitTimestampsDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final Serializer getCommitTimestampSerializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel getCommitTimestampChannel =
                    _endpointChannelFactory.endpoint(DialogueConjureTimelockEndpoints.getCommitTimestamp);

            private final Deserializer getCommitTimestampDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            @Override
            public ListenableFuture startTransactions(
                    AuthHeader authHeader, String namespace, ConjureStartTransactionsRequest request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                _request.body(startTransactionsSerializer.serialize(request));
                return _runtime.clients()
                        .call(startTransactionsChannel, _request.build(), startTransactionsDeserializer);
            }

            @Override
            public ListenableFuture getFreshTimestamps(
                    AuthHeader authHeader, String namespace, ConjureGetFreshTimestampsRequest request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                _request.body(getFreshTimestampsSerializer.serialize(request));
                return _runtime.clients()
                        .call(getFreshTimestampsChannel, _request.build(), getFreshTimestampsDeserializer);
            }

            @Override
            public ListenableFuture getFreshTimestampsV2(
                    AuthHeader authHeader, String namespace, ConjureGetFreshTimestampsRequestV2 request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                _request.body(getFreshTimestampsV2Serializer.serialize(request));
                return _runtime.clients()
                        .call(getFreshTimestampsV2Channel, _request.build(), getFreshTimestampsV2Deserializer);
            }

            @Override
            public ListenableFuture getFreshTimestamp(AuthHeader authHeader, String namespace) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                return _runtime.clients()
                        .call(getFreshTimestampChannel, _request.build(), getFreshTimestampDeserializer);
            }

            @Override
            public ListenableFuture leaderTime(AuthHeader authHeader, String namespace) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                return _runtime.clients().call(leaderTimeChannel, _request.build(), leaderTimeDeserializer);
            }

            @Override
            public ListenableFuture lock(
                    AuthHeader authHeader, String namespace, ConjureLockRequest request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                _request.body(lockSerializer.serialize(request));
                return _runtime.clients().call(lockChannel, _request.build(), lockDeserializer);
            }

            @Override
            public ListenableFuture waitForLocks(
                    AuthHeader authHeader, String namespace, ConjureLockRequest request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                _request.body(waitForLocksSerializer.serialize(request));
                return _runtime.clients().call(waitForLocksChannel, _request.build(), waitForLocksDeserializer);
            }

            @Override
            public ListenableFuture refreshLocks(
                    AuthHeader authHeader, String namespace, ConjureRefreshLocksRequest request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                _request.body(refreshLocksSerializer.serialize(request));
                return _runtime.clients().call(refreshLocksChannel, _request.build(), refreshLocksDeserializer);
            }

            @Override
            public ListenableFuture refreshLocksV2(
                    AuthHeader authHeader, String namespace, ConjureRefreshLocksRequestV2 request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                _request.body(refreshLocksV2Serializer.serialize(request));
                return _runtime.clients().call(refreshLocksV2Channel, _request.build(), refreshLocksV2Deserializer);
            }

            @Override
            public ListenableFuture unlock(
                    AuthHeader authHeader, String namespace, ConjureUnlockRequest request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                _request.body(unlockSerializer.serialize(request));
                return _runtime.clients().call(unlockChannel, _request.build(), unlockDeserializer);
            }

            @Override
            public ListenableFuture unlockV2(
                    AuthHeader authHeader, String namespace, ConjureUnlockRequestV2 request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                _request.body(unlockV2Serializer.serialize(request));
                return _runtime.clients().call(unlockV2Channel, _request.build(), unlockV2Deserializer);
            }

            @Override
            public ListenableFuture getCommitTimestamps(
                    AuthHeader authHeader, String namespace, GetCommitTimestampsRequest request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                _request.body(getCommitTimestampsSerializer.serialize(request));
                return _runtime.clients()
                        .call(getCommitTimestampsChannel, _request.build(), getCommitTimestampsDeserializer);
            }

            @Override
            public ListenableFuture getCommitTimestamp(
                    AuthHeader authHeader, String namespace, GetCommitTimestampRequest request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
                _request.body(getCommitTimestampSerializer.serialize(request));
                return _runtime.clients()
                        .call(getCommitTimestampChannel, _request.build(), getCommitTimestampDeserializer);
            }

            @Override
            public String toString() {
                return "ConjureTimelockServiceAsync{_endpointChannelFactory=" + _endpointChannelFactory + ", runtime="
                        + _runtime + '}';
            }
        };
    }

    /** Creates an asynchronous/non-blocking client for a ConjureTimelockService service. */
    static ConjureTimelockServiceAsync of(Channel _channel, ConjureRuntime _runtime) {
        if (_channel instanceof EndpointChannelFactory) {
            return of((EndpointChannelFactory) _channel, _runtime);
        }
        return of(
                new EndpointChannelFactory() {
                    @Override
                    public EndpointChannel endpoint(Endpoint endpoint) {
                        return _runtime.clients().bind(_channel, endpoint);
                    }
                },
                _runtime);
    }

    final class Factory implements DialogueServiceFactory {
        @Override
        public ConjureTimelockServiceAsync create(
                EndpointChannelFactory endpointChannelFactory, ConjureRuntime runtime) {
            return ConjureTimelockServiceAsync.of(endpointChannelFactory, runtime);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy