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

com.palantir.atlasdb.timelock.api.MultiClientConjureTimelockServiceAsync 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.tokens.auth.AuthHeader;
import java.lang.Deprecated;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Map;
import java.util.Set;
import javax.annotation.processing.Generated;

@Generated("com.palantir.conjure.java.services.dialogue.DialogueInterfaceGenerator")
@DialogueService(MultiClientConjureTimelockServiceAsync.Factory.class)
public interface MultiClientConjureTimelockServiceAsync {
    /**
     * Version of ConjureTimelockService#leaderTime endpoint for acquiring leaderTimes for a set of namespaces.
     *
     * @apiNote {@code POST /tl/multi/lts}
     */
    @ClientEndpoint(method = "POST", path = "/tl/multi/lts")
    ListenableFuture leaderTimes(AuthHeader authHeader, Set namespaces);

    /**
     * Version of ConjureTimelockService#startTransactions that starts transactions for multiple namespaces.
     *
     * @apiNote {@code POST /tl/multi/sts}
     * @deprecated This endpoint is deprecated. Please use {@link #startTransactionsForClients} to start transactions
     *     for multiple clients.
     */
    @ClientEndpoint(method = "POST", path = "/tl/multi/sts")
    @Deprecated
    ListenableFuture> startTransactions(
            AuthHeader authHeader, Map requests);

    /**
     * Version of ConjureTimelockService#getCommitTimestamps for acquiring commit timestamps for multiple namespaces.
     *
     * @apiNote {@code POST /tl/multi/gcts}
     * @deprecated This endpoint is deprecated. Please use {@link #getCommitTimestampsForClients} to get commit
     *     timestamps for multiple clients.
     */
    @ClientEndpoint(method = "POST", path = "/tl/multi/gcts")
    @Deprecated
    ListenableFuture> getCommitTimestamps(
            AuthHeader authHeader, Map requests);

    /**
     * Version of ConjureTimelockService#startTransactions that starts transactions for multiple namespaces.
     *
     * @apiNote {@code POST /tl/multi/stsfc}
     */
    @ClientEndpoint(method = "POST", path = "/tl/multi/stsfc")
    ListenableFuture> startTransactionsForClients(
            AuthHeader authHeader, Map requests);

    /**
     * Version of ConjureTimelockService#getCommitTimestamps for acquiring commit timestamps for multiple namespaces.
     *
     * @apiNote {@code POST /tl/multi/gctsfc}
     */
    @ClientEndpoint(method = "POST", path = "/tl/multi/gctsfc")
    ListenableFuture> getCommitTimestampsForClients(
            AuthHeader authHeader, Map requests);

    /**
     * Version of unlockV2 to unlock locks across multiple namespaces.
     *
     * @apiNote {@code POST /tl/multi/ul}
     */
    @ClientEndpoint(method = "POST", path = "/tl/multi/ul")
    ListenableFuture> unlock(
            AuthHeader authHeader, Map requests);

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

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

            private final EndpointChannel leaderTimesChannel =
                    _endpointChannelFactory.endpoint(DialogueMultiClientConjureTimelockEndpoints.leaderTimes);

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

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

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

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

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

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

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

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

            private final EndpointChannel startTransactionsForClientsChannel = _endpointChannelFactory.endpoint(
                    DialogueMultiClientConjureTimelockEndpoints.startTransactionsForClients);

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

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

            private final EndpointChannel getCommitTimestampsForClientsChannel = _endpointChannelFactory.endpoint(
                    DialogueMultiClientConjureTimelockEndpoints.getCommitTimestampsForClients);

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

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

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

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

            @Override
            public ListenableFuture leaderTimes(AuthHeader authHeader, Set namespaces) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.body(leaderTimesSerializer.serialize(namespaces));
                return _runtime.clients().call(leaderTimesChannel, _request.build(), leaderTimesDeserializer);
            }

            @Override
            @SuppressWarnings("deprecation")
            public ListenableFuture> startTransactions(
                    AuthHeader authHeader, Map requests) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.body(startTransactionsSerializer.serialize(requests));
                return _runtime.clients()
                        .call(startTransactionsChannel, _request.build(), startTransactionsDeserializer);
            }

            @Override
            @SuppressWarnings("deprecation")
            public ListenableFuture> getCommitTimestamps(
                    AuthHeader authHeader, Map requests) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.body(getCommitTimestampsSerializer.serialize(requests));
                return _runtime.clients()
                        .call(getCommitTimestampsChannel, _request.build(), getCommitTimestampsDeserializer);
            }

            @Override
            public ListenableFuture> startTransactionsForClients(
                    AuthHeader authHeader, Map requests) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.body(startTransactionsForClientsSerializer.serialize(requests));
                return _runtime.clients()
                        .call(
                                startTransactionsForClientsChannel,
                                _request.build(),
                                startTransactionsForClientsDeserializer);
            }

            @Override
            public ListenableFuture> getCommitTimestampsForClients(
                    AuthHeader authHeader, Map requests) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.body(getCommitTimestampsForClientsSerializer.serialize(requests));
                return _runtime.clients()
                        .call(
                                getCommitTimestampsForClientsChannel,
                                _request.build(),
                                getCommitTimestampsForClientsDeserializer);
            }

            @Override
            public ListenableFuture> unlock(
                    AuthHeader authHeader, Map requests) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.body(unlockSerializer.serialize(requests));
                return _runtime.clients().call(unlockChannel, _request.build(), unlockDeserializer);
            }

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

    /** Creates an asynchronous/non-blocking client for a MultiClientConjureTimelockService service. */
    static MultiClientConjureTimelockServiceAsync 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 MultiClientConjureTimelockServiceAsync create(
                EndpointChannelFactory endpointChannelFactory, ConjureRuntime runtime) {
            return MultiClientConjureTimelockServiceAsync.of(endpointChannelFactory, runtime);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy