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

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

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

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(ConjureTimelockServiceBlocking.Factory.class)
public interface ConjureTimelockServiceBlocking {
    /** @apiNote {@code POST /tl/st/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/st/{namespace}")
    ConjureStartTransactionsResponse startTransactions(
            AuthHeader authHeader, @Safe String namespace, ConjureStartTransactionsRequest request);

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

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

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

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

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

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

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

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

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

    /** @apiNote {@code POST /tl/ul2/{namespace}} */
    @ClientEndpoint(method = "POST", path = "/tl/ul2/{namespace}")
    ConjureUnlockResponseV2 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}")
    GetCommitTimestampsResponse getCommitTimestamps(
            AuthHeader authHeader, @Safe String namespace, GetCommitTimestampsRequest request);

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

    /** Creates a synchronous/blocking client for a ConjureTimelockService service. */
    static ConjureTimelockServiceBlocking of(EndpointChannelFactory _endpointChannelFactory, ConjureRuntime _runtime) {
        return new ConjureTimelockServiceBlocking() {
            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 ConjureStartTransactionsResponse 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()
                        .callBlocking(startTransactionsChannel, _request.build(), startTransactionsDeserializer);
            }

            @Override
            public ConjureGetFreshTimestampsResponse 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()
                        .callBlocking(getFreshTimestampsChannel, _request.build(), getFreshTimestampsDeserializer);
            }

            @Override
            public ConjureGetFreshTimestampsResponseV2 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()
                        .callBlocking(getFreshTimestampsV2Channel, _request.build(), getFreshTimestampsV2Deserializer);
            }

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

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

            @Override
            public ConjureLockResponse 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().callBlocking(lockChannel, _request.build(), lockDeserializer);
            }

            @Override
            public ConjureWaitForLocksResponse 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().callBlocking(waitForLocksChannel, _request.build(), waitForLocksDeserializer);
            }

            @Override
            public ConjureRefreshLocksResponse 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().callBlocking(refreshLocksChannel, _request.build(), refreshLocksDeserializer);
            }

            @Override
            public ConjureRefreshLocksResponseV2 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()
                        .callBlocking(refreshLocksV2Channel, _request.build(), refreshLocksV2Deserializer);
            }

            @Override
            public ConjureUnlockResponse 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().callBlocking(unlockChannel, _request.build(), unlockDeserializer);
            }

            @Override
            public ConjureUnlockResponseV2 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().callBlocking(unlockV2Channel, _request.build(), unlockV2Deserializer);
            }

            @Override
            public GetCommitTimestampsResponse 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()
                        .callBlocking(getCommitTimestampsChannel, _request.build(), getCommitTimestampsDeserializer);
            }

            @Override
            public GetCommitTimestampResponse 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()
                        .callBlocking(getCommitTimestampChannel, _request.build(), getCommitTimestampDeserializer);
            }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy