Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.palantir.atlasdb.timelock.api.MultiClientConjureTimelockServiceEndpoints Maven / Gradle / Ivy
package com.palantir.atlasdb.timelock.api;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.ListenableFuture;
import com.palantir.conjure.java.undertow.lib.Deserializer;
import com.palantir.conjure.java.undertow.lib.Endpoint;
import com.palantir.conjure.java.undertow.lib.ReturnValueWriter;
import com.palantir.conjure.java.undertow.lib.Serializer;
import com.palantir.conjure.java.undertow.lib.TypeMarker;
import com.palantir.conjure.java.undertow.lib.UndertowRuntime;
import com.palantir.conjure.java.undertow.lib.UndertowService;
import com.palantir.tokens.auth.AuthHeader;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.HttpString;
import io.undertow.util.Methods;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Generated;
@Generated("com.palantir.conjure.java.services.UndertowServiceHandlerGenerator")
public final class MultiClientConjureTimelockServiceEndpoints implements UndertowService {
private final UndertowMultiClientConjureTimelockService delegate;
private MultiClientConjureTimelockServiceEndpoints(UndertowMultiClientConjureTimelockService delegate) {
this.delegate = delegate;
}
public static UndertowService of(UndertowMultiClientConjureTimelockService delegate) {
return new MultiClientConjureTimelockServiceEndpoints(delegate);
}
@Override
public List endpoints(UndertowRuntime runtime) {
return ImmutableList.of(
new LeaderTimesEndpoint(runtime, delegate),
new StartTransactionsEndpoint(runtime, delegate),
new GetCommitTimestampsEndpoint(runtime, delegate),
new StartTransactionsForClientsEndpoint(runtime, delegate),
new GetCommitTimestampsForClientsEndpoint(runtime, delegate));
}
private static final class LeaderTimesEndpoint implements HttpHandler, Endpoint, ReturnValueWriter {
private final UndertowRuntime runtime;
private final UndertowMultiClientConjureTimelockService delegate;
private final Deserializer> deserializer;
private final Serializer serializer;
LeaderTimesEndpoint(UndertowRuntime runtime, UndertowMultiClientConjureTimelockService delegate) {
this.runtime = runtime;
this.delegate = delegate;
this.deserializer = runtime.bodySerDe().deserializer(new TypeMarker>() {}, this);
this.serializer = runtime.bodySerDe().serializer(new TypeMarker() {}, this);
}
@Override
public void handleRequest(HttpServerExchange exchange) throws IOException {
AuthHeader authHeader = runtime.auth().header(exchange);
Set namespaces = deserializer.deserialize(exchange);
ListenableFuture result = delegate.leaderTimes(authHeader, namespaces);
runtime.async().register(result, this, exchange);
}
@Override
public void write(LeaderTimes result, HttpServerExchange exchange) throws IOException {
serializer.serialize(result, exchange);
}
@Override
public HttpString method() {
return Methods.POST;
}
@Override
public String template() {
return "/tl/multi/lts";
}
@Override
public String serviceName() {
return "MultiClientConjureTimelockService";
}
@Override
public String name() {
return "leaderTimes";
}
@Override
public HttpHandler handler() {
return this;
}
}
private static final class StartTransactionsEndpoint
implements HttpHandler, Endpoint, ReturnValueWriter> {
private final UndertowRuntime runtime;
private final UndertowMultiClientConjureTimelockService delegate;
private final Deserializer> deserializer;
private final Serializer> serializer;
StartTransactionsEndpoint(UndertowRuntime runtime, UndertowMultiClientConjureTimelockService delegate) {
this.runtime = runtime;
this.delegate = delegate;
this.deserializer = runtime.bodySerDe()
.deserializer(new TypeMarker>() {}, this);
this.serializer = runtime.bodySerDe()
.serializer(new TypeMarker>() {}, this);
}
@Override
@SuppressWarnings("deprecation")
public void handleRequest(HttpServerExchange exchange) throws IOException {
AuthHeader authHeader = runtime.auth().header(exchange);
Map requests = deserializer.deserialize(exchange);
ListenableFuture> result =
delegate.startTransactions(authHeader, requests);
runtime.async().register(result, this, exchange);
}
@Override
public void write(Map result, HttpServerExchange exchange)
throws IOException {
serializer.serialize(result, exchange);
}
@Override
public HttpString method() {
return Methods.POST;
}
@Override
public String template() {
return "/tl/multi/sts";
}
@Override
public String serviceName() {
return "MultiClientConjureTimelockService";
}
@Override
public String name() {
return "startTransactions";
}
@Override
public HttpHandler handler() {
return this;
}
@Override
public Optional deprecated() {
return Optional.of(
"This endpoint is deprecated. Please use {@link #startTransactionsForClients} to start transactions for multiple clients.\n");
}
}
private static final class GetCommitTimestampsEndpoint
implements HttpHandler, Endpoint, ReturnValueWriter> {
private final UndertowRuntime runtime;
private final UndertowMultiClientConjureTimelockService delegate;
private final Deserializer> deserializer;
private final Serializer> serializer;
GetCommitTimestampsEndpoint(UndertowRuntime runtime, UndertowMultiClientConjureTimelockService delegate) {
this.runtime = runtime;
this.delegate = delegate;
this.deserializer = runtime.bodySerDe()
.deserializer(new TypeMarker>() {}, this);
this.serializer = runtime.bodySerDe()
.serializer(new TypeMarker>() {}, this);
}
@Override
@SuppressWarnings("deprecation")
public void handleRequest(HttpServerExchange exchange) throws IOException {
AuthHeader authHeader = runtime.auth().header(exchange);
Map requests = deserializer.deserialize(exchange);
ListenableFuture> result =
delegate.getCommitTimestamps(authHeader, requests);
runtime.async().register(result, this, exchange);
}
@Override
public void write(Map result, HttpServerExchange exchange)
throws IOException {
serializer.serialize(result, exchange);
}
@Override
public HttpString method() {
return Methods.POST;
}
@Override
public String template() {
return "/tl/multi/gcts";
}
@Override
public String serviceName() {
return "MultiClientConjureTimelockService";
}
@Override
public String name() {
return "getCommitTimestamps";
}
@Override
public HttpHandler handler() {
return this;
}
@Override
public Optional deprecated() {
return Optional.of(
"This endpoint is deprecated. Please use {@link #getCommitTimestampsForClients} to get commit timestamps for multiple clients.\n");
}
}
private static final class StartTransactionsForClientsEndpoint
implements HttpHandler, Endpoint, ReturnValueWriter> {
private final UndertowRuntime runtime;
private final UndertowMultiClientConjureTimelockService delegate;
private final Deserializer> deserializer;
private final Serializer> serializer;
StartTransactionsForClientsEndpoint(
UndertowRuntime runtime, UndertowMultiClientConjureTimelockService delegate) {
this.runtime = runtime;
this.delegate = delegate;
this.deserializer = runtime.bodySerDe()
.deserializer(new TypeMarker>() {}, this);
this.serializer = runtime.bodySerDe()
.serializer(new TypeMarker>() {}, this);
}
@Override
public void handleRequest(HttpServerExchange exchange) throws IOException {
AuthHeader authHeader = runtime.auth().header(exchange);
Map requests = deserializer.deserialize(exchange);
ListenableFuture> result =
delegate.startTransactionsForClients(authHeader, requests);
runtime.async().register(result, this, exchange);
}
@Override
public void write(Map result, HttpServerExchange exchange)
throws IOException {
serializer.serialize(result, exchange);
}
@Override
public HttpString method() {
return Methods.POST;
}
@Override
public String template() {
return "/tl/multi/stsfc";
}
@Override
public String serviceName() {
return "MultiClientConjureTimelockService";
}
@Override
public String name() {
return "startTransactionsForClients";
}
@Override
public HttpHandler handler() {
return this;
}
}
private static final class GetCommitTimestampsForClientsEndpoint
implements HttpHandler, Endpoint, ReturnValueWriter> {
private final UndertowRuntime runtime;
private final UndertowMultiClientConjureTimelockService delegate;
private final Deserializer> deserializer;
private final Serializer> serializer;
GetCommitTimestampsForClientsEndpoint(
UndertowRuntime runtime, UndertowMultiClientConjureTimelockService delegate) {
this.runtime = runtime;
this.delegate = delegate;
this.deserializer = runtime.bodySerDe()
.deserializer(new TypeMarker>() {}, this);
this.serializer = runtime.bodySerDe()
.serializer(new TypeMarker>() {}, this);
}
@Override
public void handleRequest(HttpServerExchange exchange) throws IOException {
AuthHeader authHeader = runtime.auth().header(exchange);
Map requests = deserializer.deserialize(exchange);
ListenableFuture> result =
delegate.getCommitTimestampsForClients(authHeader, requests);
runtime.async().register(result, this, exchange);
}
@Override
public void write(Map result, HttpServerExchange exchange)
throws IOException {
serializer.serialize(result, exchange);
}
@Override
public HttpString method() {
return Methods.POST;
}
@Override
public String template() {
return "/tl/multi/gctsfc";
}
@Override
public String serviceName() {
return "MultiClientConjureTimelockService";
}
@Override
public String name() {
return "getCommitTimestampsForClients";
}
@Override
public HttpHandler handler() {
return this;
}
}
}