tech.ytsaurus.client.ApiServiceClient Maven / Gradle / Ivy
package tech.ytsaurus.client;
import java.time.Duration;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nullable;
import tech.ytsaurus.client.request.AbortJob;
import tech.ytsaurus.client.request.AbortOperation;
import tech.ytsaurus.client.request.AbortQuery;
import tech.ytsaurus.client.request.AbortTransaction;
import tech.ytsaurus.client.request.AbstractLookupRowsRequest;
import tech.ytsaurus.client.request.AbstractModifyRowsRequest;
import tech.ytsaurus.client.request.AlterQuery;
import tech.ytsaurus.client.request.AlterTable;
import tech.ytsaurus.client.request.AlterTableReplica;
import tech.ytsaurus.client.request.BuildSnapshot;
import tech.ytsaurus.client.request.CheckClusterLiveness;
import tech.ytsaurus.client.request.CommitTransaction;
import tech.ytsaurus.client.request.CompleteOperation;
import tech.ytsaurus.client.request.CreateObject;
import tech.ytsaurus.client.request.FreezeTable;
import tech.ytsaurus.client.request.GcCollect;
import tech.ytsaurus.client.request.GenerateTimestamps;
import tech.ytsaurus.client.request.GetInSyncReplicas;
import tech.ytsaurus.client.request.GetJob;
import tech.ytsaurus.client.request.GetJobStderr;
import tech.ytsaurus.client.request.GetJobStderrResult;
import tech.ytsaurus.client.request.GetOperation;
import tech.ytsaurus.client.request.GetQuery;
import tech.ytsaurus.client.request.GetQueryResult;
import tech.ytsaurus.client.request.GetTablePivotKeys;
import tech.ytsaurus.client.request.GetTabletInfos;
import tech.ytsaurus.client.request.ListJobs;
import tech.ytsaurus.client.request.ListJobsResult;
import tech.ytsaurus.client.request.ListQueries;
import tech.ytsaurus.client.request.ListQueriesResult;
import tech.ytsaurus.client.request.LookupRowsRequest;
import tech.ytsaurus.client.request.MountTable;
import tech.ytsaurus.client.request.PingTransaction;
import tech.ytsaurus.client.request.PullConsumer;
import tech.ytsaurus.client.request.Query;
import tech.ytsaurus.client.request.QueryResult;
import tech.ytsaurus.client.request.ReadQueryResult;
import tech.ytsaurus.client.request.RegisterQueueConsumer;
import tech.ytsaurus.client.request.RemountTable;
import tech.ytsaurus.client.request.ReshardTable;
import tech.ytsaurus.client.request.ResumeOperation;
import tech.ytsaurus.client.request.StartQuery;
import tech.ytsaurus.client.request.StartTransaction;
import tech.ytsaurus.client.request.SuspendOperation;
import tech.ytsaurus.client.request.TabletInfo;
import tech.ytsaurus.client.request.TrimTable;
import tech.ytsaurus.client.request.UnfreezeTable;
import tech.ytsaurus.client.request.UnmountTable;
import tech.ytsaurus.client.request.UpdateOperationParameters;
import tech.ytsaurus.client.rows.ConsumerSource;
import tech.ytsaurus.client.rows.QueueRowset;
import tech.ytsaurus.client.rows.UnversionedRowset;
import tech.ytsaurus.client.rows.VersionedRowset;
import tech.ytsaurus.core.GUID;
import tech.ytsaurus.core.YtTimestamp;
import tech.ytsaurus.core.rows.YTreeRowSerializer;
import tech.ytsaurus.core.tables.TableSchema;
import tech.ytsaurus.rpcproxy.EAtomicity;
import tech.ytsaurus.rpcproxy.ETableReplicaMode;
import tech.ytsaurus.ysontree.YTreeNode;
public interface ApiServiceClient extends TransactionalClient {
CompletableFuture startTransaction(StartTransaction startTransaction);
/**
* @deprecated prefer to use {@link #startTransaction(StartTransaction)}
*/
@Deprecated
default CompletableFuture startTransaction(
StartTransaction.BuilderBase> startTransaction) {
return startTransaction(startTransaction.build());
}
/**
* @deprecated prefer to use {@link #startTransaction(StartTransaction)}
*/
@Deprecated
default CompletableFuture startTransaction(ApiServiceTransactionOptions options) {
return startTransaction(options.toStartTransaction());
}
CompletableFuture pingTransaction(PingTransaction req);
default CompletableFuture pingTransaction(GUID id) {
return pingTransaction(new PingTransaction(id));
}
CompletableFuture commitTransaction(CommitTransaction req);
default CompletableFuture commitTransaction(GUID id) {
return commitTransaction(new CommitTransaction(id));
}
CompletableFuture abortTransaction(AbortTransaction req);
default CompletableFuture abortTransaction(GUID id) {
return abortTransaction(new AbortTransaction(id));
}
CompletableFuture> getTablePivotKeys(GetTablePivotKeys req);
CompletableFuture createObject(CreateObject req);
CompletableFuture checkClusterLiveness(CheckClusterLiveness req);
CompletableFuture lookupRows(
AbstractLookupRowsRequest, ?> request,
YTreeRowSerializer serializer,
ConsumerSource consumer
);
default CompletableFuture lookupRows(
AbstractLookupRowsRequest.Builder, ?> request,
YTreeRowSerializer serializer,
ConsumerSource consumer
) {
return lookupRows(request.build(), serializer, consumer);
}
@Deprecated
default CompletableFuture lookupRows(
LookupRowsRequest.BuilderBase> request, YtTimestamp timestamp) {
return lookupRows(request.setTimestamp(timestamp));
}
@Deprecated
default CompletableFuture versionedLookupRows(
LookupRowsRequest.BuilderBase> request, YtTimestamp timestamp) {
return versionedLookupRows(request.setTimestamp(timestamp));
}
CompletableFuture modifyRows(GUID transactionId, AbstractModifyRowsRequest, ?> request);
default CompletableFuture modifyRows(GUID transactionId, AbstractModifyRowsRequest.Builder, ?> request) {
return modifyRows(transactionId, (AbstractModifyRowsRequest, ?>) request.build());
}
CompletableFuture buildSnapshot(BuildSnapshot req);
CompletableFuture gcCollect(GcCollect req);
default CompletableFuture gcCollect(GUID cellId) {
return gcCollect(new GcCollect(cellId));
}
/**
* Mount table.
*
* This method doesn't wait until tablets become mounted.
*
* @see MountTable
* @see CompoundClient#mountTableAndWaitTablets(MountTable)
*/
CompletableFuture mountTable(MountTable req);
/**
* @deprecated prefer to use {@link #mountTable(MountTable)}
*/
@Deprecated
default CompletableFuture mountTable(MountTable.BuilderBase> req) {
return mountTable(req.build());
}
/**
* Unmount table.
*
* This method doesn't wait until tablets become unmounted.
*
* @see UnmountTable
* @see CompoundClient#unmountTableAndWaitTablets(UnmountTable)
*/
CompletableFuture unmountTable(UnmountTable req);
/**
* @deprecated prefer to use {@link #unmountTable(UnmountTable)}
*/
@Deprecated
default CompletableFuture unmountTable(UnmountTable.BuilderBase> req) {
return unmountTable(req.build());
}
default CompletableFuture remountTable(String path) {
return remountTable(RemountTable.builder().setPath(path).build());
}
CompletableFuture remountTable(RemountTable req);
/**
* @deprecated prefer to use {@link #remountTable(RemountTable)}
*/
@Deprecated
default CompletableFuture remountTable(RemountTable.BuilderBase> req) {
return remountTable(req.build());
}
default CompletableFuture freezeTable(String path) {
return freezeTable(path, null);
}
default CompletableFuture freezeTable(String path, @Nullable Duration requestTimeout) {
return freezeTable(FreezeTable.builder().setPath(path).setTimeout(requestTimeout).build());
}
CompletableFuture freezeTable(FreezeTable req);
/**
* @deprecated prefer to use {@link #freezeTable(FreezeTable)}
*/
@Deprecated
default CompletableFuture freezeTable(FreezeTable.BuilderBase> req) {
return freezeTable(req.build());
}
default CompletableFuture unfreezeTable(String path) {
return unfreezeTable(path, null);
}
default CompletableFuture unfreezeTable(String path, @Nullable Duration requestTimeout) {
return unfreezeTable(UnfreezeTable.builder().setPath(path).setTimeout(requestTimeout).build());
}
default CompletableFuture unfreezeTable(FreezeTable req) {
UnfreezeTable.Builder unfreezeReqBuilder = UnfreezeTable.builder().setPath(req.getPath());
if (req.getTimeout().isPresent()) {
unfreezeReqBuilder.setTimeout(req.getTimeout().get());
}
return unfreezeTable(unfreezeReqBuilder.build());
}
/**
* @deprecated prefer to use {@link #unfreezeTable(FreezeTable)}
*/
@Deprecated
default CompletableFuture unfreezeTable(FreezeTable.BuilderBase> req) {
return unfreezeTable(req.build());
}
CompletableFuture unfreezeTable(UnfreezeTable req);
/**
* @deprecated prefer to use {@link #unfreezeTable(UnfreezeTable)}
*/
@Deprecated
default CompletableFuture unfreezeTable(UnfreezeTable.BuilderBase> req) {
return unfreezeTable(req.build());
}
CompletableFuture> getInSyncReplicas(GetInSyncReplicas request, YtTimestamp timestamp);
default CompletableFuture> getInSyncReplicas(
String path,
YtTimestamp timestamp,
TableSchema schema,
Iterable extends List>> keys
) {
return getInSyncReplicas(new GetInSyncReplicas(path, schema, keys), timestamp);
}
CompletableFuture> getTabletInfos(GetTabletInfos req);
default CompletableFuture> getTabletInfos(String path, List tabletIndices) {
return getTabletInfos(GetTabletInfos.builder().setPath(path).setTabletIndexes(tabletIndices).build());
}
CompletableFuture generateTimestamps(GenerateTimestamps req);
default CompletableFuture generateTimestamps(int count) {
GenerateTimestamps req = new GenerateTimestamps(count);
return generateTimestamps(req);
}
default CompletableFuture generateTimestamps() {
return generateTimestamps(1);
}
CompletableFuture reshardTable(ReshardTable req);
/**
* @deprecated prefer to use {@link #reshardTable(ReshardTable)}
*/
@Deprecated
default CompletableFuture reshardTable(ReshardTable.BuilderBase> req) {
return reshardTable(req.build());
}
default CompletableFuture trimTable(String path, int tableIndex, long trimmedRowCount) {
TrimTable req = new TrimTable(path, tableIndex, trimmedRowCount);
return trimTable(req);
}
CompletableFuture trimTable(TrimTable req);
CompletableFuture alterTable(AlterTable req);
/**
* @deprecated prefer to use {@link #alterTable(AlterTable)}
*/
@Deprecated
default CompletableFuture alterTable(AlterTable.BuilderBase> req) {
return alterTable(req.build());
}
CompletableFuture alterTableReplica(
GUID replicaId,
boolean enabled,
ETableReplicaMode mode,
boolean preserveTimestamp,
EAtomicity atomicity
);
CompletableFuture alterTableReplica(AlterTableReplica req);
CompletableFuture pullConsumer(PullConsumer req);
CompletableFuture registerQueueConsumer(RegisterQueueConsumer req);
/**
* Request to start query.
*
* @return query id.
* @see StartQuery
*/
CompletableFuture startQuery(StartQuery req);
/**
* Request to abort query.
*
* @see AbortQuery
*/
CompletableFuture abortQuery(AbortQuery req);
/**
* Request to get query result.
*
* @return metadata about query result.
* @see GetQueryResult
*/
CompletableFuture getQueryResult(GetQueryResult req);
/**
* Request to read query result.
*
* @return query result.
* @see ReadQueryResult
*/
CompletableFuture readQueryResult(ReadQueryResult req);
/**
* Request to get information about query.
*
* @return query.
* @see GetQuery
*/
CompletableFuture getQuery(GetQuery req);
/**
* Request to get a list of queries by specified filters.
*
* @return list of queries.
* @see ListQueries
*/
CompletableFuture listQueries(ListQueries req);
/**
* Request to alter query.
*
* @see AlterQuery
*/
CompletableFuture alterQuery(AlterQuery req);
CompletableFuture getOperation(GetOperation req);
/**
* @deprecated prefer to use {@link #getOperation(GetOperation)}
*/
@Deprecated
default CompletableFuture getOperation(GetOperation.BuilderBase> req) {
return getOperation(req.build());
}
/**
* Request to abort operation.
*
* Operation will be finished in erroneous aborted state.
*
*
* @see AbortOperation
* @see
* abort_job documentation
*
*/
CompletableFuture abortOperation(AbortOperation req);
CompletableFuture completeOperation(CompleteOperation req);
CompletableFuture suspendOperation(SuspendOperation req);
CompletableFuture resumeOperation(ResumeOperation req);
/**
* @deprecated prefer to use {@link #resumeOperation(ResumeOperation)}
*/
@Deprecated
default CompletableFuture resumeOperation(ResumeOperation.BuilderBase> req) {
return resumeOperation(req.build());
}
CompletableFuture getJob(GetJob req);
/**
* @deprecated prefer to use {@link #getJob(GetJob)}
*/
@Deprecated
default CompletableFuture getJob(GetJob.BuilderBase> req) {
return getJob(req.build());
}
/**
* Request to abort job.
*
* Job will be aborted. In the future scheduler will restart this job.
*
*
* @see
* abort_job documentation
*
*/
CompletableFuture abortJob(AbortJob req);
CompletableFuture listJobs(ListJobs req);
CompletableFuture getJobStderr(GetJobStderr req);
CompletableFuture updateOperationParameters(UpdateOperationParameters req);
/**
* @deprecated prefer to use {@link #updateOperationParameters(UpdateOperationParameters)}
*/
@Deprecated
default CompletableFuture updateOperationParameters(
UpdateOperationParameters.BuilderBase> req) {
return updateOperationParameters(req.build());
}
}