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.tokens.auth.AuthHeader;
import java.lang.Override;
import java.lang.String;
import javax.annotation.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, String namespace, ConjureStartTransactionsRequest request);

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

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

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

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

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

    /**
     * @apiNote {@code POST /tl/ul/{namespace}}
     */
    @ClientEndpoint(method = "POST", path = "/tl/ul/{namespace}")
    ConjureUnlockResponse unlock(AuthHeader authHeader, String namespace, ConjureUnlockRequest 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, String namespace, GetCommitTimestampsRequest 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 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 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 getCommitTimestampsSerializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

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

            private final Deserializer getCommitTimestampsDeserializer =
                    _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 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 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 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 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