diff --git a/evita_api/src/main/java/io/evitadb/api/CatalogContract.java b/evita_api/src/main/java/io/evitadb/api/CatalogContract.java index 3b1d22ca3..352c963c9 100644 --- a/evita_api/src/main/java/io/evitadb/api/CatalogContract.java +++ b/evita_api/src/main/java/io/evitadb/api/CatalogContract.java @@ -28,6 +28,7 @@ import io.evitadb.api.exception.InvalidMutationException; import io.evitadb.api.exception.SchemaAlteringException; import io.evitadb.api.exception.TemporalDataNotAvailableException; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.requestResponse.EvitaRequest; import io.evitadb.api.requestResponse.EvitaResponse; import io.evitadb.api.requestResponse.mutation.Mutation; @@ -41,18 +42,17 @@ import io.evitadb.api.requestResponse.system.CatalogVersionDescriptor; import io.evitadb.api.requestResponse.system.TimeFlow; import io.evitadb.api.requestResponse.transaction.TransactionMutation; -import io.evitadb.api.task.ProgressiveCompletableFuture; import io.evitadb.dataType.PaginatedList; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.Serializable; -import java.nio.file.Path; import java.time.OffsetDateTime; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.UUID; +import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; import java.util.stream.Stream; @@ -326,7 +326,7 @@ boolean renameCollectionOfEntity(@Nonnull String entityType, @Nonnull String new * @throws TemporalDataNotAvailableException when the past data is not available */ @Nonnull - ProgressiveCompletableFuture backup(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException; + CompletableFuture backup(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException; /** * Terminates catalog instance and frees all claimed resources. Prepares catalog instance to be garbage collected. diff --git a/evita_api/src/main/java/io/evitadb/api/EvitaContract.java b/evita_api/src/main/java/io/evitadb/api/EvitaContract.java index 65295215c..b2ddd3799 100644 --- a/evita_api/src/main/java/io/evitadb/api/EvitaContract.java +++ b/evita_api/src/main/java/io/evitadb/api/EvitaContract.java @@ -26,15 +26,17 @@ import io.evitadb.api.SessionTraits.SessionFlags; import io.evitadb.api.TransactionContract.CommitBehavior; import io.evitadb.api.exception.CatalogAlreadyPresentException; +import io.evitadb.api.exception.FileForFetchNotFoundException; import io.evitadb.api.exception.InstanceTerminatedException; +import io.evitadb.api.exception.TaskNotFoundException; import io.evitadb.api.exception.TemporalDataNotAvailableException; import io.evitadb.api.exception.TransactionException; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.requestResponse.schema.CatalogSchemaEditor.CatalogSchemaBuilder; import io.evitadb.api.requestResponse.schema.SealedCatalogSchema; import io.evitadb.api.requestResponse.schema.mutation.TopLevelCatalogSchemaMutation; import io.evitadb.api.requestResponse.system.SystemStatus; -import io.evitadb.api.task.JobStatus; -import io.evitadb.api.task.ProgressiveCompletableFuture; +import io.evitadb.api.task.TaskStatus; import io.evitadb.dataType.PaginatedList; import io.evitadb.exception.EvitaInternalError; import io.evitadb.exception.EvitaInvalidUsageException; @@ -45,7 +47,6 @@ import javax.annotation.concurrent.ThreadSafe; import java.io.InputStream; import java.io.OutputStream; -import java.nio.file.Path; import java.time.OffsetDateTime; import java.util.Optional; import java.util.Set; @@ -362,7 +363,7 @@ CompletableFuture updateCatalogAsync( /** * Creates a backup of the specified catalog and returns an InputStream to read the binary data of the zip file. * - * @param catalogName the name of the catalog to backup + * @param catalogName the name of the catalog to backup * @param pastMoment leave null for creating backup for actual dataset, or specify past moment to create backup for * the dataset as it was at that moment * @param includingWAL if true, the backup will include the Write-Ahead Log (WAL) file and when the catalog is @@ -371,55 +372,98 @@ CompletableFuture updateCatalogAsync( * @throws TemporalDataNotAvailableException when the past data is not available */ @Nonnull - ProgressiveCompletableFuture backupCatalog(@Nonnull String catalogName, @Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException; + CompletableFuture backupCatalog(@Nonnull String catalogName, @Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException; /** * Restores a catalog from the provided InputStream which contains the binary data of a previously backed up zip * file. The input stream is closed within the method. * - * @param catalogName the name of the catalog to restore + * @param catalogName the name of the catalog to restore * @param totalBytesExpected total bytes expected to be read from the input stream - * @param inputStream an InputStream to read the binary data of the zip file + * @param inputStream an InputStream to read the binary data of the zip file * @return jobId of the restore process * @throws UnexpectedIOException if an I/O error occurs */ @Nonnull - ProgressiveCompletableFuture restoreCatalog( + CompletableFuture restoreCatalog( @Nonnull String catalogName, long totalBytesExpected, @Nonnull InputStream inputStream ) throws UnexpectedIOException; /** - * TODO JNO - document me - * @param page - * @param pageSize - * @return + * Restores a catalog from the provided InputStream which contains the binary data of a previously backed up zip + * file. The input stream is closed within the method. + * + * @param catalogName the name of the catalog to restore + * @param fileId fileId of the file containing the binary data of the zip file + * @return jobId of the restore process + * @throws UnexpectedIOException if an I/O error occurs */ @Nonnull - PaginatedList> getJobStatuses(int page, int pageSize); + CompletableFuture restoreCatalog( + @Nonnull String catalogName, + @Nonnull UUID fileId + ) throws FileForFetchNotFoundException; /** - * TODO JNO - document me - * @param jobId - * @return + * Returns list of jobs that are currently running or have been finished recently in paginated fashion. + * + * @param page page number (1-based) + * @param pageSize number of items per page + * @return list of jobs */ @Nonnull - Optional> getJobStatus(@Nonnull UUID jobId); + PaginatedList> listTaskStatuses(int page, int pageSize); /** - * TODO JNO - document me - * @param jobId - * @return + * Returns job status for the specified jobId or empty if the job is not found. + * + * @param jobId jobId of the job + * @return job status + * @throws TaskNotFoundException if the job with the specified jobId is not found */ - boolean cancelJob(@Nonnull UUID jobId); + @Nonnull + Optional> getTaskStatus(@Nonnull UUID jobId) throws TaskNotFoundException; /** - * TODO JNO - document me - * @param fileId - * @param outputStream + * Cancels the job with the specified jobId. If the job is waiting in the queue, it will be removed from the queue. + * If the job is already running, it must support cancelling to be interrupted and canceled. + * + * @param jobId jobId of the job + * @return true if the job was found and cancellation triggered, false if the job was not found + * @throws TaskNotFoundException if the job with the specified jobId is not found + */ + boolean cancelTask(@Nonnull UUID jobId) throws TaskNotFoundException; + + /** + * Returns list of files that are available for download. + * + * @param page page number (1-based) + * @param pageSize number of items per page + * @param origin optional origin of the files (derived from {@link TaskStatus#taskType()}), passing non-null value + * in this argument filters the returned files to only those that are related to the specified origin + * @return list of files + */ + @Nonnull + PaginatedList listFilesToFetch(int page, int pageSize, @Nullable String origin); + + /** + * Writes contents of the file with the specified fileId to the provided OutputStream. + * + * @param fileId fileId of the file + * @param outputStream OutputStream to write the file contents to + * @throws FileForFetchNotFoundException if the file with the specified fileId is not found + */ + void fetchFile(@Nonnull UUID fileId, @Nonnull OutputStream outputStream) throws FileForFetchNotFoundException, UnexpectedIOException; + + /** + * Removes file with the specified fileId from the storage. + * + * @param fileId fileId of the file + * @throws FileForFetchNotFoundException if the file with the specified fileId is not found */ - void writeFile(@Nonnull UUID fileId, @Nonnull OutputStream outputStream); + void deleteFile(@Nonnull UUID fileId) throws FileForFetchNotFoundException; /** * Retrieves the current system status of the EvitaDB server. diff --git a/evita_api/src/main/java/io/evitadb/api/EvitaSessionContract.java b/evita_api/src/main/java/io/evitadb/api/EvitaSessionContract.java index 31a697270..6546615d3 100644 --- a/evita_api/src/main/java/io/evitadb/api/EvitaSessionContract.java +++ b/evita_api/src/main/java/io/evitadb/api/EvitaSessionContract.java @@ -33,6 +33,7 @@ import io.evitadb.api.exception.TemporalDataNotAvailableException; import io.evitadb.api.exception.UnexpectedResultCountException; import io.evitadb.api.exception.UnexpectedResultException; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.proxy.ProxyFactory; import io.evitadb.api.query.Query; import io.evitadb.api.query.QueryConstraints; @@ -65,7 +66,6 @@ import io.evitadb.api.requestResponse.schema.mutation.LocalCatalogSchemaMutation; import io.evitadb.api.requestResponse.schema.mutation.catalog.ModifyCatalogSchemaMutation; import io.evitadb.api.requestResponse.schema.mutation.catalog.ModifyEntitySchemaMutation; -import io.evitadb.api.task.ProgressiveCompletableFuture; import io.evitadb.exception.EvitaInvalidUsageException; import io.evitadb.utils.ArrayUtils; import io.evitadb.utils.Assert; @@ -75,7 +75,6 @@ import javax.annotation.concurrent.NotThreadSafe; import java.io.Closeable; import java.io.Serializable; -import java.nio.file.Path; import java.time.OffsetDateTime; import java.util.List; import java.util.Optional; @@ -1009,7 +1008,7 @@ DeletedHierarchy deleteEntityAndItsHierarchy(@Nonnul * @throws TemporalDataNotAvailableException when the past data is not available */ @Nonnull - ProgressiveCompletableFuture backupCatalog(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException; + CompletableFuture backupCatalog(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException; /** * Default implementation uses ID for comparing two sessions (and to distinguish one session from another). diff --git a/evita_api/src/main/java/io/evitadb/api/configuration/StorageOptions.java b/evita_api/src/main/java/io/evitadb/api/configuration/StorageOptions.java index 3381d77a0..8b8d48165 100644 --- a/evita_api/src/main/java/io/evitadb/api/configuration/StorageOptions.java +++ b/evita_api/src/main/java/io/evitadb/api/configuration/StorageOptions.java @@ -35,39 +35,46 @@ /** * Configuration options related to the key-value storage. * - * @param storageDirectory Directory on local disk where Evita files are stored. - * By default, temporary directory is used - but it is highly recommended setting your own - * directory if you don't want to lose the data. - * recommended setting your own directory with dedicated disk space. - * @param lockTimeoutSeconds This timeout represents a time in seconds that is tolerated to wait for lock acquiring. - * Locks are used to get handle to open file. Set of open handles is limited to - * {@link #maxOpenedReadHandles} for read operations and single write handle for write - * operations (only single thread is expected to append to a file). - * @param waitOnCloseSeconds This timeout represents a time that will file offset index wait for processes to release their - * read handles to file. After this timeout files will be closed by force and processes may - * experience an exception. - * @param outputBufferSize The output buffer size determines how large a buffer is kept in memory for output - * purposes. The size of the buffer limits the maximum size of an individual record in the - * key/value data store. - * @param maxOpenedReadHandles Maximum number of simultaneously opened {@link java.io.InputStream} to file offset index file. - * @param computeCRC32C Contains setting that determined whether CRC32C checksums will be computed for written - * records and also whether the CRC32C checksum will be checked on record read. - * @param minimalActiveRecordShare Minimal share of active records in the file. If the share is lower, the file will - * be compacted. - * @param fileSizeCompactionThresholdBytes Minimal file size threshold for compaction. If the file size is lower, - * the file will not be compacted even if the share of active records is lower - * than the minimal share. - * @param timeTravelEnabled When set to true, the data files are not removed immediately after compacting, - * but are kept on disk as long as there is history available in the WAL log. - * This allows a snapshot of the database to be taken at any point in - * the history covered by the WAL log. From the snapshot, the database can be - * restored to the exact point in time with all the data available at that time. - * + * @param storageDirectory Directory on local disk where Evita data files are stored. + * By default, temporary directory is used - but it is highly recommended setting your own + * directory if you don't want to lose the data. + * recommended setting your own directory with dedicated disk space. + * @param exportDirectory Directory on local disk where Evita files are exported - for example, backups, + * JFR recordings, query recordings etc. + * @param lockTimeoutSeconds This timeout represents a time in seconds that is tolerated to wait for lock acquiring. + * Locks are used to get handle to open file. Set of open handles is limited to + * {@link #maxOpenedReadHandles} for read operations and single write handle for write + * operations (only single thread is expected to append to a file). + * @param waitOnCloseSeconds This timeout represents a time that will file offset index wait for processes to release their + * read handles to file. After this timeout files will be closed by force and processes may + * experience an exception. + * @param outputBufferSize The output buffer size determines how large a buffer is kept in memory for output + * purposes. The size of the buffer limits the maximum size of an individual record in the + * key/value data store. + * @param maxOpenedReadHandles Maximum number of simultaneously opened {@link java.io.InputStream} to file offset index file. + * @param computeCRC32C Contains setting that determined whether CRC32C checksums will be computed for written + * records and also whether the CRC32C checksum will be checked on record read. + * @param minimalActiveRecordShare Minimal share of active records in the file. If the share is lower, the file will + * be compacted. + * @param fileSizeCompactionThresholdBytes Minimal file size threshold for compaction. If the file size is lower, + * the file will not be compacted even if the share of active records is lower + * than the minimal share. + * @param timeTravelEnabled When set to true, the data files are not removed immediately after compacting, + * but are kept on disk as long as there is history available in the WAL log. + * This allows a snapshot of the database to be taken at any point in + * the history covered by the WAL log. From the snapshot, the database can be + * restored to the exact point in time with all the data available at that time. + * @param exportDirectorySizeLimitBytes Maximum overall size of the export directory. When this threshold + * is exceeded the oldest files will automatically be removed until the + * size drops below the limit. + * @param exportFileHistoryExpirationSeconds Maximal age of exported file in seconds. When age is exceeded the file + * will be automatically removed. * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2021 */ @Builder public record StorageOptions( @Nullable Path storageDirectory, + @Nullable Path exportDirectory, long lockTimeoutSeconds, long waitOnCloseSeconds, int outputBufferSize, @@ -75,11 +82,14 @@ public record StorageOptions( boolean computeCRC32C, double minimalActiveRecordShare, long fileSizeCompactionThresholdBytes, - boolean timeTravelEnabled + boolean timeTravelEnabled, + long exportDirectorySizeLimitBytes, + long exportFileHistoryExpirationSeconds ) { public static final int DEFAULT_OUTPUT_BUFFER_SIZE = 2_097_152; - public static final Path DEFAULT_DIRECTORY = Paths.get("").resolve("data"); + public static final Path DEFAULT_DATA_DIRECTORY = Paths.get("").resolve("data"); + public static final Path DEFAULT_EXPORT_DIRECTORY = Paths.get("").resolve("export"); public static final int DEFAULT_LOCK_TIMEOUT_SECONDS = 5; public static final int DEFAULT_WAIT_ON_CLOSE_SECONDS = 5; public static final int DEFAULT_MAX_OPENED_READ_HANDLES = Runtime.getRuntime().availableProcessors(); @@ -87,6 +97,8 @@ public record StorageOptions( public static final double DEFAULT_MINIMAL_ACTIVE_RECORD_SHARE = 0.5; public static final long DEFAULT_MINIMAL_FILE_SIZE_COMPACTION_THRESHOLD = 104_857_600L; public static final boolean DEFAULT_TIME_TRAVEL_ENABLED = true; + public static final long DEFAULT_EXPORT_DIRECTORY_SIZE_LIMIT_BYTES = 1_073_741_824L; + public static final long DEFAULT_EXPORT_FILE_HISTORY_EXPIRATION_SECONDS = 604_800L; /** * Builder method is planned to be used only in tests. @@ -94,12 +106,15 @@ public record StorageOptions( public static StorageOptions temporary() { return new StorageOptions( Path.of(System.getProperty("java.io.tmpdir"), "evita/data"), + Path.of(System.getProperty("java.io.tmpdir"), "evita/export"), 5, 5, DEFAULT_OUTPUT_BUFFER_SIZE, Runtime.getRuntime().availableProcessors(), true, DEFAULT_MINIMAL_ACTIVE_RECORD_SHARE, DEFAULT_MINIMAL_FILE_SIZE_COMPACTION_THRESHOLD, - DEFAULT_TIME_TRAVEL_ENABLED + DEFAULT_TIME_TRAVEL_ENABLED, + DEFAULT_EXPORT_DIRECTORY_SIZE_LIMIT_BYTES, + DEFAULT_EXPORT_FILE_HISTORY_EXPIRATION_SECONDS ); } @@ -119,7 +134,8 @@ public static StorageOptions.Builder builder(@Nonnull StorageOptions storageOpti public StorageOptions() { this( - DEFAULT_DIRECTORY, + DEFAULT_DATA_DIRECTORY, + DEFAULT_EXPORT_DIRECTORY, DEFAULT_LOCK_TIMEOUT_SECONDS, DEFAULT_WAIT_ON_CLOSE_SECONDS, DEFAULT_OUTPUT_BUFFER_SIZE, @@ -127,12 +143,15 @@ public StorageOptions() { DEFAULT_COMPUTE_CRC, DEFAULT_MINIMAL_ACTIVE_RECORD_SHARE, DEFAULT_MINIMAL_FILE_SIZE_COMPACTION_THRESHOLD, - DEFAULT_TIME_TRAVEL_ENABLED + DEFAULT_TIME_TRAVEL_ENABLED, + DEFAULT_EXPORT_DIRECTORY_SIZE_LIMIT_BYTES, + DEFAULT_EXPORT_FILE_HISTORY_EXPIRATION_SECONDS ); } public StorageOptions( @Nullable Path storageDirectory, + @Nullable Path exportDirectory, long lockTimeoutSeconds, long waitOnCloseSeconds, int outputBufferSize, @@ -140,9 +159,12 @@ public StorageOptions( boolean computeCRC32C, double minimalActiveRecordShare, long fileSizeCompactionThresholdBytes, - boolean timeTravelEnabled + boolean timeTravelEnabled, + long exportDirectorySizeLimitBytes, + long exportFileHistoryExpirationSeconds ) { - this.storageDirectory = Optional.ofNullable(storageDirectory).orElse(DEFAULT_DIRECTORY); + this.storageDirectory = Optional.ofNullable(storageDirectory).orElse(DEFAULT_DATA_DIRECTORY); + this.exportDirectory = Optional.ofNullable(exportDirectory).orElse(DEFAULT_EXPORT_DIRECTORY); this.lockTimeoutSeconds = lockTimeoutSeconds; this.waitOnCloseSeconds = waitOnCloseSeconds; this.outputBufferSize = outputBufferSize; @@ -151,6 +173,8 @@ public StorageOptions( this.minimalActiveRecordShare = minimalActiveRecordShare; this.fileSizeCompactionThresholdBytes = fileSizeCompactionThresholdBytes; this.timeTravelEnabled = timeTravelEnabled; + this.exportDirectorySizeLimitBytes = exportDirectorySizeLimitBytes; + this.exportFileHistoryExpirationSeconds = exportFileHistoryExpirationSeconds; } /** @@ -159,7 +183,16 @@ public StorageOptions( @Nonnull public Path storageDirectoryOrDefault() { return storageDirectory == null ? - DEFAULT_DIRECTORY : storageDirectory; + DEFAULT_DATA_DIRECTORY : storageDirectory; + } + + /** + * Method returns null safe export directory. + */ + @Nonnull + public Path exportDirectoryOrDefault() { + return exportDirectory == null ? + DEFAULT_EXPORT_DIRECTORY : exportDirectory; } /** @@ -167,7 +200,8 @@ public Path storageDirectoryOrDefault() { */ @ToString public static class Builder { - private Path storageDirectory = DEFAULT_DIRECTORY; + private Path storageDirectory = DEFAULT_DATA_DIRECTORY; + private Path exportDirectory = DEFAULT_EXPORT_DIRECTORY; private long lockTimeoutSeconds = DEFAULT_LOCK_TIMEOUT_SECONDS; private long waitOnCloseSeconds = DEFAULT_WAIT_ON_CLOSE_SECONDS; private int outputBufferSize = DEFAULT_OUTPUT_BUFFER_SIZE; @@ -176,12 +210,15 @@ public static class Builder { private double minimalActiveRecordShare = DEFAULT_MINIMAL_ACTIVE_RECORD_SHARE; private long fileSizeCompactionThresholdBytes = DEFAULT_MINIMAL_FILE_SIZE_COMPACTION_THRESHOLD; private boolean timeTravelEnabled = DEFAULT_TIME_TRAVEL_ENABLED; + private long exportDirectorySizeLimitBytes = DEFAULT_EXPORT_DIRECTORY_SIZE_LIMIT_BYTES; + private long exportFileHistoryExpirationSeconds = DEFAULT_EXPORT_FILE_HISTORY_EXPIRATION_SECONDS; Builder() { } Builder(@Nonnull StorageOptions storageOptions) { this.storageDirectory = storageOptions.storageDirectory; + this.exportDirectory = storageOptions.exportDirectory; this.lockTimeoutSeconds = storageOptions.lockTimeoutSeconds; this.waitOnCloseSeconds = storageOptions.waitOnCloseSeconds; this.outputBufferSize = storageOptions.outputBufferSize; @@ -190,6 +227,8 @@ public static class Builder { this.minimalActiveRecordShare = storageOptions.minimalActiveRecordShare; this.fileSizeCompactionThresholdBytes = storageOptions.fileSizeCompactionThresholdBytes; this.timeTravelEnabled = storageOptions.timeTravelEnabled; + this.exportDirectorySizeLimitBytes = storageOptions.exportDirectorySizeLimitBytes; + this.exportFileHistoryExpirationSeconds = storageOptions.exportFileHistoryExpirationSeconds; } @Nonnull @@ -198,6 +237,12 @@ public Builder storageDirectory(@Nonnull Path storageDirectory) { return this; } + @Nonnull + public Builder exportDirectory(@Nonnull Path exportDirectory) { + this.exportDirectory = exportDirectory; + return this; + } + @Nonnull public Builder lockTimeoutSeconds(long lockTimeoutSeconds) { this.lockTimeoutSeconds = lockTimeoutSeconds; @@ -246,10 +291,23 @@ public Builder timeTravelEnabled(boolean timeTravelEnabled) { return this; } + @Nonnull + public Builder exportDirectorySizeLimitBytes(long exportDirectorySizeLimitBytes) { + this.exportDirectorySizeLimitBytes = exportDirectorySizeLimitBytes; + return this; + } + + @Nonnull + public Builder exportFileHistoryExpirationSeconds(long exportFileHistoryExpirationSeconds) { + this.exportFileHistoryExpirationSeconds = exportFileHistoryExpirationSeconds; + return this; + } + @Nonnull public StorageOptions build() { return new StorageOptions( storageDirectory, + exportDirectory, lockTimeoutSeconds, waitOnCloseSeconds, outputBufferSize, @@ -257,7 +315,9 @@ public StorageOptions build() { computeCRC32C, minimalActiveRecordShare, fileSizeCompactionThresholdBytes, - timeTravelEnabled + timeTravelEnabled, + exportDirectorySizeLimitBytes, + exportFileHistoryExpirationSeconds ); } diff --git a/evita_api/src/main/java/io/evitadb/api/task/JobResult.java b/evita_api/src/main/java/io/evitadb/api/exception/FileForFetchNotFoundException.java similarity index 61% rename from evita_api/src/main/java/io/evitadb/api/task/JobResult.java rename to evita_api/src/main/java/io/evitadb/api/exception/FileForFetchNotFoundException.java index ae78bc2da..62aad33c2 100644 --- a/evita_api/src/main/java/io/evitadb/api/task/JobResult.java +++ b/evita_api/src/main/java/io/evitadb/api/exception/FileForFetchNotFoundException.java @@ -21,14 +21,29 @@ * limitations under the License. */ -package io.evitadb.api.task; +package io.evitadb.api.exception; -import java.io.Serializable; +import io.evitadb.exception.EvitaInvalidUsageException; +import lombok.Getter; + +import javax.annotation.Nonnull; +import java.io.Serial; +import java.util.UUID; /** - * This interface marks a class as a result of a job. + * Exception is thrown when no file with the given ID is found. * * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 */ -public interface JobResult extends Serializable { +public class FileForFetchNotFoundException extends EvitaInvalidUsageException { + @Serial private static final long serialVersionUID = 6188715534953413955L; + @Getter private final UUID fileId; + + public FileForFetchNotFoundException(@Nonnull UUID fileId) { + super( + "File not found: " + fileId, + "File not found." + ); + this.fileId = fileId; + } } diff --git a/evita_api/src/main/java/io/evitadb/api/task/JobType.java b/evita_api/src/main/java/io/evitadb/api/exception/TaskNotFoundException.java similarity index 62% rename from evita_api/src/main/java/io/evitadb/api/task/JobType.java rename to evita_api/src/main/java/io/evitadb/api/exception/TaskNotFoundException.java index c792f21d4..499176528 100644 --- a/evita_api/src/main/java/io/evitadb/api/task/JobType.java +++ b/evita_api/src/main/java/io/evitadb/api/exception/TaskNotFoundException.java @@ -21,15 +21,29 @@ * limitations under the License. */ -package io.evitadb.api.task; +package io.evitadb.api.exception; + +import io.evitadb.exception.EvitaInvalidUsageException; +import lombok.Getter; + +import javax.annotation.Nonnull; +import java.io.Serial; +import java.util.UUID; /** - * This enumeration contains listing of all job types. + * Exception is thrown when a task with the given ID is not found. * * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 */ -public enum JobType { - - BACKUP, RESTORE +public class TaskNotFoundException extends EvitaInvalidUsageException { + @Serial private static final long serialVersionUID = 6188715534953413955L; + @Getter private final UUID taskId; + public TaskNotFoundException(@Nonnull UUID taskId) { + super( + "Task not found: " + taskId, + "Task not found." + ); + this.taskId = taskId; + } } diff --git a/evita_api/src/main/java/io/evitadb/api/file/FileForFetch.java b/evita_api/src/main/java/io/evitadb/api/file/FileForFetch.java new file mode 100644 index 000000000..32ca0ec76 --- /dev/null +++ b/evita_api/src/main/java/io/evitadb/api/file/FileForFetch.java @@ -0,0 +1,116 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.evitadb.api.file; + +import io.evitadb.api.task.TaskStatus; +import io.evitadb.utils.FileUtils; +import io.evitadb.utils.UUIDUtil; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.io.Serializable; +import java.nio.file.Path; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +/** + * Record that represents single file stored in the server export file available for download. + * + * @param fileId ID of the file. + * @param name Name of the file. + * @param path Path to the data file. + * @param description Optional short description of the file in human readable form. + * @param contentType MIME type of the file. + * @param totalSizeInBytes Total size of the file in bytes. + * @param created Date and time when the file was created. + * @param origin Optional origin of the file. Usually {@link TaskStatus#taskType()}. + * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 + */ +public record FileForFetch( + @Nonnull UUID fileId, + @Nonnull String name, + @Nonnull Path path, + @Nullable String description, + @Nonnull String contentType, + long totalSizeInBytes, + @Nonnull OffsetDateTime created, + @Nullable String[] origin +) implements Serializable { + + public static final String METADATA_EXTENSION = ".metadata"; + + /** + * Returns path to the metadata file. + * @return Path to the metadata file. + */ + @Nonnull + public Path metadataPath() { + return path.getParent().resolve(fileId + METADATA_EXTENSION); + } + + /** + * Creates new instance of the record from the metadata lines. + * Might throw exception and in that case metadata file is corrupted. + * + * @param metadataLines Lines of the metadata file. + * @param exportDirectory Directory where the file is stored. + * @return New instance of the record. + */ + @Nonnull + public static FileForFetch fromLines( + @Nonnull List metadataLines, + @Nonnull Path exportDirectory + ) { + return new FileForFetch( + UUIDUtil.uuid(metadataLines.get(0)), + metadataLines.get(1), + exportDirectory.resolve(metadataLines.get(2)), + metadataLines.get(3), + metadataLines.get(4), + Long.parseLong(metadataLines.get(5)), + OffsetDateTime.parse(metadataLines.get(6), DateTimeFormatter.ISO_OFFSET_DATE_TIME), + metadataLines.get(7).split(",") + ); + } + + /** + * Returns contents of the record written as set of lines. + */ + @Nonnull + public List toLines() { + return Arrays.asList( + fileId.toString(), + name, + fileId + FileUtils.getFileExtension(name).map(it -> "." + it).orElse(""), + description, + contentType, + Long.toString(totalSizeInBytes), + created.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME), + origin == null ? "" : String.join(",", origin) + ); + } +} diff --git a/evita_api/src/main/java/io/evitadb/api/task/ProgressiveCompletableFuture.java b/evita_api/src/main/java/io/evitadb/api/task/ProgressiveCompletableFuture.java deleted file mode 100644 index 401ba880c..000000000 --- a/evita_api/src/main/java/io/evitadb/api/task/ProgressiveCompletableFuture.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * - * _ _ ____ ____ - * _____ _(_) |_ __ _| _ \| __ ) - * / _ \ \ / / | __/ _` | | | | _ \ - * | __/\ V /| | || (_| | |_| | |_) | - * \___| \_/ |_|\__\__,_|____/|____/ - * - * Copyright (c) 2024 - * - * Licensed under the Business Source License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://github.com/FgForrest/evitaDB/blob/master/LICENSE - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.evitadb.api.task; - -import io.evitadb.utils.Assert; -import io.evitadb.utils.UUIDUtil; -import lombok.Getter; - -import javax.annotation.Nonnull; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Function; -import java.util.function.IntConsumer; - -/** - * This extension of {@link CompletableFuture} is used to track the progress of the task and to provide a unique id for - * the task. - * - * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 - */ -public class ProgressiveCompletableFuture extends CompletableFuture { - /** - * Unique id of the task. - */ - @Getter - private final UUID id = UUIDUtil.randomUUID(); - /** - * This counter is used to track the progress of the task. - * The value -1 means that the future is still waiting for the task to start. - * The value 0 means that the task has started. - * The value 100 means that the task has finished. - */ - private final AtomicInteger progress = new AtomicInteger(-1); - /** - * Listeners that are notified when the progress of the task changes. - */ - private final CopyOnWriteArrayList progressListeners = new CopyOnWriteArrayList<>(); - - /** - * Creates a new completed instance of {@link ProgressiveCompletableFuture}. - */ - @Nonnull - public static ProgressiveCompletableFuture completed() { - final ProgressiveCompletableFuture future = new ProgressiveCompletableFuture<>(); - future.complete(null); - return future; - } - - /** - * Returns progress of the task. - * - * @return progress of the task in percents - */ - public int getProgress() { - return progress.get(); - } - - /** - * Method updates the progress of the task. - * - * @param progress new progress of the task in percents - */ - public void updateProgress(int progress) { - Assert.isPremiseValid(progress >= 0 && progress <= 100, "Progress must be in range 0-100"); - final int currentProgress = this.progress.updateAndGet(operand -> Math.max(progress, operand)); - for (IntConsumer progressListener : progressListeners) { - progressListener.accept(currentProgress); - } - } - - @Override - public boolean complete(T value) { - updateProgress(100); - this.progressListeners.clear(); - return super.complete(value); - } - - @Override - public boolean completeExceptionally(Throwable ex) { - updateProgress(100); - this.progressListeners.clear(); - return super.completeExceptionally(ex); - } - - /** - * Returns a new {@link ProgressiveCompletableFuture} that is completed when this task completes. The progress will - * be correctly adjusted to reach 100% when both tasks are finished. - * - * @param nextStage function that is applied to the result of this task - * @return new {@link ProgressiveCompletableFuture} that is completed when this task completes - * @param type of the result of the next task - */ - @Nonnull - public ProgressiveCompletableFuture andThen(@Nonnull Function> nextStage) { - final ProgressiveCompletableFuture combinedFuture = new ProgressiveCompletableFuture<>(); - this.addProgressListener(progress -> combinedFuture.combineProgressOfTwoSequentialParts(progress, 1)) - .whenComplete((t, throwable) -> { - if (throwable != null) { - combinedFuture.completeExceptionally(throwable); - } else { - final ProgressiveCompletableFuture nextFuture = nextStage.apply(t); - nextFuture - .addProgressListener(progress -> combinedFuture.combineProgressOfTwoSequentialParts(progress, 2)) - .whenComplete((u, throwable1) -> { - if (throwable1 != null) { - combinedFuture.completeExceptionally(throwable1); - } else { - combinedFuture.complete(u); - } - }); - } - }); - return combinedFuture; - } - - /** - * The second part is expected to start when the first part is finished. The progress of the second part is combined - * with the progress of the first part. - * @param progress progress of the particular part - * @param part order number of the part - */ - private void combineProgressOfTwoSequentialParts(int progress, int part) { - this.updateProgress(((part - 1) * 50) + progress / 2); - } - - /** - * Adds a listener that is notified when the progress of the task changes. - * - * @param listener listener that is notified when the progress of the task changes - * @return this instance - */ - @Nonnull - ProgressiveCompletableFuture addProgressListener(@Nonnull IntConsumer listener) { - progressListeners.add(listener); - return this; - } -} diff --git a/evita_api/src/main/java/io/evitadb/api/task/Task.java b/evita_api/src/main/java/io/evitadb/api/task/Task.java new file mode 100644 index 000000000..92955468f --- /dev/null +++ b/evita_api/src/main/java/io/evitadb/api/task/Task.java @@ -0,0 +1,71 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.evitadb.api.task; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.concurrent.CompletableFuture; + +/** + * Interface for different tasks that can be executed in the background service. It represents an instance of single + * task execution with particular settings executed by the service thread pool with lower priority on the background. + * + * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 + */ +public interface Task { + + /** + * Returns actual status of the task, telemetry information and access to its progress, settings and result. + * @return The status of the task. + */ + @Nonnull + TaskStatus getStatus(); + + /** + * Returns the future result of the task. The future is completed when the task is finished. + * @return The future result of the task. + */ + @Nonnull + CompletableFuture getFutureResult(); + + /** + * Executes the task and returns the result. + * @return The result of the task. + */ + @Nullable + T execute(); + + /** + * Cancels the task. + */ + void cancel(); + + /** + * Terminates the task using passed exception. + * + * @param exception The exception that caused the task to be cancelled. + */ + void fail(@Nonnull Exception exception); + +} diff --git a/evita_api/src/main/java/io/evitadb/api/task/TaskStatus.java b/evita_api/src/main/java/io/evitadb/api/task/TaskStatus.java new file mode 100644 index 000000000..84a0602f8 --- /dev/null +++ b/evita_api/src/main/java/io/evitadb/api/task/TaskStatus.java @@ -0,0 +1,204 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.evitadb.api.task; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.io.PrintWriter; +import java.io.Serializable; +import java.io.StringWriter; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** + * This record provides the status of a task, including telemetry information and access to its progress, settings, + * and result. + * + * @param taskType The name of the task (short class name). + * @param taskName The human readable name of the task. + * @param taskId The unique identifier of the task. + * @param catalogName The name of the catalog that the task belongs to (may be NULL if the task is not bound to any particular catalog). + * @param issued The time when the task was issued. + * @param started The time when the task was started. + * @param finished The time when the task was finished. + * @param progress The progress of the task (0-100). + * @param settings The settings of the task. + * @param result The result of the task. + * @param exceptionWithStackTrace The exception with stack trace if the task failed. + * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 + */ +public record TaskStatus( + @Nonnull String taskType, + @Nonnull String taskName, + @Nonnull UUID taskId, + @Nullable String catalogName, + @Nonnull OffsetDateTime issued, + @Nullable OffsetDateTime started, + @Nullable OffsetDateTime finished, + int progress, + @Nonnull S settings, + @Nullable T result, + @Nullable String exceptionWithStackTrace +) implements Serializable { + + /** + * Returns the shortened state of the task. + * + * @return The state of the task. + */ + @Nonnull + public State state() { + if (exceptionWithStackTrace != null) { + return State.FAILED; + } else if (finished != null) { + return State.FINISHED; + } else if (started != null) { + return State.RUNNING; + } else { + return State.QUEUED; + } + } + + /** + * Returns new instance of {@link TaskStatus} with updated progress. + * + * @param progress The new progress of the task. + * @return The new instance of {@link TaskStatus} with updated progress. + */ + @Nonnull + public TaskStatus updateProgress(int progress) { + if (progress != this.progress) { + return new TaskStatus<>( + this.taskType, + this.taskName, + this.taskId, + this.catalogName, + this.issued, + this.started, + this.finished, + progress, + this.settings, + this.result, + this.exceptionWithStackTrace + ); + } else { + return this; + } + } + + /** + * Returns new instance of {@link TaskStatus} with updated started time and progress. + * + * @return The new instance of {@link TaskStatus} with updated started time and progress. + */ + @Nonnull + public TaskStatus transitionToStarted() { + return new TaskStatus<>( + this.taskType, + this.taskName, + this.taskId, + this.catalogName, + this.issued, + OffsetDateTime.now(), + null, + 0, + this.settings, + this.result, + this.exceptionWithStackTrace + ); + } + + /** + * Returns new instance of {@link TaskStatus} with updated finished time and result. + * + * @param result The result of the task. + * @return The new instance of {@link TaskStatus} with updated finished time and result. + */ + @Nonnull + public TaskStatus transitionToFinished(@Nullable T result) { + return new TaskStatus<>( + this.taskType, + this.taskName, + this.taskId, + this.catalogName, + this.issued, + this.started, + OffsetDateTime.now(), + 100, + this.settings, + result, + null + ); + } + + /** + * Returns new instance of {@link TaskStatus} with updated exception. + * + * @param exception The exception that caused the task to fail. + * @return The new instance of {@link TaskStatus} with updated exception. + */ + @Nonnull + public TaskStatus transitionToFailed(@Nonnull Throwable exception) { + // copy the stack trace + final StringWriter sw = new StringWriter(512); + exception.printStackTrace(new PrintWriter(sw)); + + return new TaskStatus<>( + this.taskType, + this.taskName, + this.taskId, + this.catalogName, + this.issued, + this.started, + OffsetDateTime.now(), + 100, + this.settings, + null, + exception.getClass().getName() + ": " + exception.getMessage() + "\n" + sw + ); + } + + /** + * State aggregates the possible states of a task into a simple enumeration. + */ + public enum State { + /** + * Task is waiting in the queue to be executed. + */ + QUEUED, + /** + * Task is currently running. + */ + RUNNING, + /** + * Task has finished successfully. + */ + FINISHED, + /** + * Task has failed. + */ + FAILED + } + +} diff --git a/evita_api/src/main/java/module-info.java b/evita_api/src/main/java/module-info.java index 13000800a..821a00dbf 100644 --- a/evita_api/src/main/java/module-info.java +++ b/evita_api/src/main/java/module-info.java @@ -36,6 +36,7 @@ exports io.evitadb.api.configuration; exports io.evitadb.api.configuration.metric; exports io.evitadb.api.exception; + exports io.evitadb.api.file; exports io.evitadb.api.task; exports io.evitadb.api.proxy; exports io.evitadb.api.proxy.impl; diff --git a/evita_common/src/main/java/io/evitadb/utils/FileUtils.java b/evita_common/src/main/java/io/evitadb/utils/FileUtils.java index 1586a73e7..400c62ee7 100644 --- a/evita_common/src/main/java/io/evitadb/utils/FileUtils.java +++ b/evita_common/src/main/java/io/evitadb/utils/FileUtils.java @@ -35,6 +35,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; +import java.util.Optional; import java.util.stream.Stream; import java.util.stream.StreamSupport; @@ -218,4 +219,15 @@ public static long getDirectorySize(@Nonnull Path directory) { "Failed to calculate size of directory!", ex ); } + + /** + * Returns the extension of the file. + * @param fileName The name of the file. + * @return The extension of the file. + */ + @Nonnull + public static Optional getFileExtension(@Nonnull String fileName) { + final int i = fileName.lastIndexOf('.') + 1; + return i > 0 ? Optional.of(fileName.substring(i)).filter(it -> !it.isBlank()) : Optional.empty(); + } } diff --git a/evita_engine/src/main/java/io/evitadb/core/Catalog.java b/evita_engine/src/main/java/io/evitadb/core/Catalog.java index ebfd218c0..eb3933512 100644 --- a/evita_engine/src/main/java/io/evitadb/core/Catalog.java +++ b/evita_engine/src/main/java/io/evitadb/core/Catalog.java @@ -40,6 +40,7 @@ import io.evitadb.api.exception.SchemaNotFoundException; import io.evitadb.api.exception.TemporalDataNotAvailableException; import io.evitadb.api.exception.TransactionException; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.observability.trace.TracingContext; import io.evitadb.api.proxy.ProxyFactory; import io.evitadb.api.requestResponse.EvitaRequest; @@ -68,8 +69,7 @@ import io.evitadb.api.requestResponse.system.CatalogVersionDescriptor; import io.evitadb.api.requestResponse.system.TimeFlow; import io.evitadb.api.requestResponse.transaction.TransactionMutation; -import io.evitadb.api.task.ProgressiveCompletableFuture; -import io.evitadb.core.async.BackgroundCallableTask; +import io.evitadb.api.task.Task; import io.evitadb.core.async.ObservableExecutorService; import io.evitadb.core.async.Scheduler; import io.evitadb.core.buffer.DataStoreChanges; @@ -78,6 +78,7 @@ import io.evitadb.core.buffer.WarmUpDataStoreMemoryBuffer; import io.evitadb.core.cache.CacheSupervisor; import io.evitadb.core.exception.StorageImplementationNotFoundException; +import io.evitadb.core.file.ExportFileService; import io.evitadb.core.metric.event.transaction.CatalogGoesLiveEvent; import io.evitadb.core.query.QueryPlan; import io.evitadb.core.query.QueryPlanner; @@ -124,7 +125,6 @@ import javax.annotation.concurrent.ThreadSafe; import java.io.InputStream; import java.io.Serializable; -import java.nio.file.Path; import java.time.OffsetDateTime; import java.util.*; import java.util.Map.Entry; @@ -271,7 +271,7 @@ public final class Catalog implements CatalogContract, CatalogVersionBeyondTheHo * @param inputStream the input stream with the catalog data * @return future that will be completed with path where the content of the catalog was restored */ - public static BackgroundCallableTask restoreCatalogTo( + public static Task createRestoreCatalogTask( @Nonnull String catalogName, @Nonnull StorageOptions storageOptions, long totalBytesExpected, @@ -289,6 +289,7 @@ public Catalog( @Nonnull EvitaConfiguration evitaConfiguration, @Nonnull ReflectionLookup reflectionLookup, @Nonnull Scheduler scheduler, + @Nonnull ExportFileService exportFileService, @Nonnull ObservableExecutorService transactionalExecutor, @Nonnull Consumer newCatalogVersionConsumer, @Nonnull TracingContext tracingContext @@ -304,7 +305,15 @@ public Catalog( this.schema = new TransactionalReference<>(new CatalogSchemaDecorator(internalCatalogSchema)); this.persistenceService = ServiceLoader.load(CatalogPersistenceServiceFactory.class) .findFirst() - .map(it -> it.createNew(this, this.getSchema().getName(), evitaConfiguration.storage(), evitaConfiguration.transaction(), scheduler)) + .map( + it -> it.createNew( + this, this.getSchema().getName(), + evitaConfiguration.storage(), + evitaConfiguration.transaction(), + scheduler, + exportFileService + ) + ) .orElseThrow(StorageImplementationNotFoundException::new); this.catalogId = UUID.randomUUID(); @@ -347,6 +356,7 @@ public Catalog( @Nonnull EvitaConfiguration evitaConfiguration, @Nonnull ReflectionLookup reflectionLookup, @Nonnull Scheduler scheduler, + @Nonnull ExportFileService exportFileService, @Nonnull ObservableExecutorService transactionalExecutor, @Nonnull Consumer newCatalogVersionConsumer, @Nonnull TracingContext tracingContext @@ -354,7 +364,15 @@ public Catalog( this.tracingContext = tracingContext; this.persistenceService = ServiceLoader.load(CatalogPersistenceServiceFactory.class) .findFirst() - .map(it -> it.load(this, catalogName, evitaConfiguration.storage(), evitaConfiguration.transaction(), scheduler)) + .map( + it -> it.load( + this, catalogName, + evitaConfiguration.storage(), + evitaConfiguration.transaction(), + scheduler, + exportFileService + ) + ) .orElseThrow(() -> new IllegalStateException("IO service is unexpectedly not available!")); final CatalogHeader catalogHeader = this.persistenceService.getCatalogHeader( this.persistenceService.getLastCatalogVersion() @@ -847,17 +865,10 @@ public Stream getReversedCommittedMutationStream(long catalogVersion) @Nonnull @Override - public ProgressiveCompletableFuture backup(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException { - final String catalogName = getName(); - return this.scheduler.submit( - new BackgroundCallableTask<>( - catalogName, - "Backup catalog `" + catalogName + "` at " + - ofNullable(pastMoment).map(OffsetDateTime::toString).orElse("current moment") + - (includingWAL ? " including WAL" : ""), - task -> this.persistenceService.backup(task.getId(), pastMoment, includingWAL, task::updateProgress) - ) - ); + public CompletableFuture backup(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException { + final Task backupTask = this.persistenceService.createBackupTask(pastMoment, includingWAL); + this.scheduler.submit(backupTask); + return backupTask.getFutureResult(); } @Override diff --git a/evita_engine/src/main/java/io/evitadb/core/CorruptedCatalog.java b/evita_engine/src/main/java/io/evitadb/core/CorruptedCatalog.java index 9ca5b3430..2a5035c77 100644 --- a/evita_engine/src/main/java/io/evitadb/core/CorruptedCatalog.java +++ b/evita_engine/src/main/java/io/evitadb/core/CorruptedCatalog.java @@ -31,6 +31,7 @@ import io.evitadb.api.exception.InvalidMutationException; import io.evitadb.api.exception.SchemaAlteringException; import io.evitadb.api.exception.TemporalDataNotAvailableException; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.requestResponse.EvitaRequest; import io.evitadb.api.requestResponse.EvitaResponse; import io.evitadb.api.requestResponse.mutation.Mutation; @@ -42,7 +43,6 @@ import io.evitadb.api.requestResponse.system.CatalogVersion; import io.evitadb.api.requestResponse.system.CatalogVersionDescriptor; import io.evitadb.api.requestResponse.system.TimeFlow; -import io.evitadb.api.task.ProgressiveCompletableFuture; import io.evitadb.core.exception.CatalogCorruptedException; import io.evitadb.dataType.PaginatedList; import io.evitadb.utils.FileUtils; @@ -58,6 +58,7 @@ import java.util.Optional; import java.util.Set; import java.util.UUID; +import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; import java.util.stream.Stream; @@ -234,7 +235,7 @@ public boolean goLive() { @Nonnull @Override - public ProgressiveCompletableFuture backup(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException { + public CompletableFuture backup(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException { throw new CatalogCorruptedException(this); } diff --git a/evita_engine/src/main/java/io/evitadb/core/Evita.java b/evita_engine/src/main/java/io/evitadb/core/Evita.java index 7dfb0dc39..8b2e5f0f9 100644 --- a/evita_engine/src/main/java/io/evitadb/core/Evita.java +++ b/evita_engine/src/main/java/io/evitadb/core/Evita.java @@ -38,9 +38,11 @@ import io.evitadb.api.configuration.ServerOptions; import io.evitadb.api.exception.CatalogAlreadyPresentException; import io.evitadb.api.exception.CatalogNotFoundException; +import io.evitadb.api.exception.FileForFetchNotFoundException; import io.evitadb.api.exception.InstanceTerminatedException; import io.evitadb.api.exception.ReadOnlyException; import io.evitadb.api.exception.TemporalDataNotAvailableException; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.observability.trace.TracingContext; import io.evitadb.api.observability.trace.TracingContextProvider; import io.evitadb.api.requestResponse.schema.CatalogSchemaContract; @@ -54,18 +56,19 @@ import io.evitadb.api.requestResponse.schema.mutation.catalog.ModifyCatalogSchemaNameMutation; import io.evitadb.api.requestResponse.schema.mutation.catalog.RemoveCatalogSchemaMutation; import io.evitadb.api.requestResponse.system.SystemStatus; -import io.evitadb.api.task.JobStatus; -import io.evitadb.api.task.ProgressiveCompletableFuture; -import io.evitadb.core.async.BackgroundCallableTask; -import io.evitadb.core.async.BackgroundRunnableTask; +import io.evitadb.api.task.Task; +import io.evitadb.api.task.TaskStatus; +import io.evitadb.core.async.ClientRunnableTask; import io.evitadb.core.async.ObservableExecutorService; import io.evitadb.core.async.ObservableThreadExecutor; import io.evitadb.core.async.Scheduler; +import io.evitadb.core.async.SequentialTask; +import io.evitadb.core.async.SessionKiller; import io.evitadb.core.cache.CacheSupervisor; import io.evitadb.core.cache.HeapMemoryCacheSupervisor; import io.evitadb.core.cache.NoCacheSupervisor; import io.evitadb.core.exception.CatalogCorruptedException; -import io.evitadb.core.maintenance.SessionKiller; +import io.evitadb.core.file.ExportFileService; import io.evitadb.core.metric.event.storage.EvitaDBCompositionChangedEvent; import io.evitadb.core.metric.event.system.EvitaStartedEvent; import io.evitadb.core.query.algebra.Formula; @@ -87,9 +90,12 @@ import javax.annotation.Nullable; import javax.annotation.concurrent.ThreadSafe; import java.io.Closeable; +import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.StandardOpenOption; import java.time.Duration; import java.time.OffsetDateTime; import java.util.*; @@ -178,6 +184,10 @@ public final class Evita implements EvitaContract { */ @Getter private final Scheduler serviceExecutor; + /** + * File service that maintains exported files and purges them eventually. + */ + private final ExportFileService exportFileService; /** * Temporary storage that keeps catalog being removed reference so that onDelete callback can still access it. */ @@ -236,6 +246,7 @@ public Evita(@Nonnull EvitaConfiguration configuration) { this.serviceExecutor, configuration.server().transactionTimeoutInMilliseconds() ); + this.exportFileService = new ExportFileService(configuration.storage()); this.sessionKiller = of(configuration.server().closeSessionsAfterSecondsOfInactivity()) .filter(it -> it > 0) .map(it -> new SessionKiller(it, this, this.serviceExecutor)) @@ -259,8 +270,9 @@ public Evita(@Nonnull EvitaConfiguration configuration) { try { CompletableFuture.allOf( Arrays.stream(directories) - .map(dir -> loadCatalog(dir.toFile().getName())) - .toArray(ProgressiveCompletableFuture[]::new) + .map(dir -> createLoadCatalogTask(dir.toFile().getName())) + .map(this.serviceExecutor::submit) + .toArray(CompletableFuture[]::new) ).get(); this.active = true; } catch (Exception ex) { @@ -531,7 +543,11 @@ public CompletableFuture updateCatalogAsync( @Nonnull @Override - public ProgressiveCompletableFuture backupCatalog(@Nonnull String catalogName, @Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException { + public CompletableFuture backupCatalog( + @Nonnull String catalogName, + @Nullable OffsetDateTime pastMoment, + boolean includingWAL + ) throws TemporalDataNotAvailableException { assertActive(); try (final EvitaSessionContract session = this.createSession(new SessionTraits(catalogName))) { return session.backupCatalog(pastMoment, includingWAL); @@ -540,41 +556,84 @@ public ProgressiveCompletableFuture backupCatalog(@Nonnull String catalogN @Nonnull @Override - public ProgressiveCompletableFuture restoreCatalog( + public CompletableFuture restoreCatalog( @Nonnull String catalogName, long totalBytesExpected, @Nonnull InputStream inputStream ) throws UnexpectedIOException { assertActive(); - - final BackgroundCallableTask restoreTask = Catalog.restoreCatalogTo( - catalogName, this.configuration.storage(), totalBytesExpected, inputStream + return this.serviceExecutor.submit( + new SequentialTask<>( + catalogName, + "Restore catalog " + catalogName + " from backup.", + Catalog.createRestoreCatalogTask( + catalogName, this.configuration.storage(), totalBytesExpected, inputStream + ), + createLoadCatalogTask(catalogName) + ) ); - return this.serviceExecutor.submit(restoreTask) - // finally, try to load catalog from the disk - .andThen(path -> loadCatalog(catalogName)); } @Nonnull @Override - public PaginatedList> getJobStatuses(int page, int pageSize) { - return null; + public CompletableFuture restoreCatalog(@Nonnull String catalogName, @Nonnull UUID fileId) throws FileForFetchNotFoundException { + assertActive(); + final FileForFetch file = this.exportFileService.getFile(fileId); + try { + return this.serviceExecutor.submit( + new SequentialTask<>( + catalogName, + "Restore catalog " + catalogName + " from backup.", + Catalog.createRestoreCatalogTask( + catalogName, this.configuration.storage(), + file.totalSizeInBytes(), + Files.newInputStream(file.path(), StandardOpenOption.READ) + ), + createLoadCatalogTask(catalogName) + ) + ); + } catch (IOException e) { + throw new FileForFetchNotFoundException(fileId); + } + } + + @Nonnull + @Override + public PaginatedList> listTaskStatuses(int page, int pageSize) { + assertActive(); + return this.serviceExecutor.getJobStatuses(page, pageSize); } @Nonnull @Override - public Optional> getJobStatus(@Nonnull UUID jobId) { - return Optional.empty(); + public Optional> getTaskStatus(@Nonnull UUID jobId) { + assertActive(); + return this.serviceExecutor.getJobStatus(jobId); } @Override - public boolean cancelJob(@Nonnull UUID jobId) { - return false; + public boolean cancelTask(@Nonnull UUID jobId) { + assertActive(); + return this.serviceExecutor.cancelJob(jobId); } + @Nonnull @Override - public void writeFile(@Nonnull UUID fileId, @Nonnull OutputStream outputStream) { + public PaginatedList listFilesToFetch(int page, int pageSize, @Nullable String origin) { + assertActive(); + return this.exportFileService.listFilesToFetch(page, pageSize, origin); + } + + @Override + public void fetchFile(@Nonnull UUID fileId, @Nonnull OutputStream outputStream) throws FileForFetchNotFoundException, UnexpectedIOException { + assertActive(); + this.exportFileService.fetchFile(fileId, outputStream); + } + @Override + public void deleteFile(@Nonnull UUID fileId) throws FileForFetchNotFoundException { + assertActive(); + this.exportFileService.deleteFile(fileId); } @Nonnull @@ -650,55 +709,41 @@ public CatalogContract getCatalogInstanceOrThrowException(@Nonnull String catalo * @param catalogName name of the catalog */ @Nonnull - private ProgressiveCompletableFuture loadCatalog(@Nonnull String catalogName) { - return this.serviceExecutor.submit( - new BackgroundCallableTask<>( - catalogName, - "Loading catalog " + catalogName + " from disk...", - () -> { - final long start = System.nanoTime(); - final Catalog theCatalog = new Catalog( - catalogName, - this.cacheSupervisor, - this.configuration, - this.reflectionLookup, - this.serviceExecutor, - this.transactionExecutor, - this::replaceCatalogReference, - this.tracingContext - ); - log.info("Catalog {} fully loaded in: {}", catalogName, StringUtils.formatNano(System.nanoTime() - start)); - return theCatalog; - }, - exception -> { - log.error("Catalog {} is corrupted!", catalogName); - return new CorruptedCatalog( + private Task createLoadCatalogTask(@Nonnull String catalogName) { + return new ClientRunnableTask<>( + catalogName, + "Loading catalog " + catalogName + " from disk...", + null, + () -> { + final long start = System.nanoTime(); + final Catalog theCatalog = new Catalog( + catalogName, + this.cacheSupervisor, + this.configuration, + this.reflectionLookup, + this.serviceExecutor, + this.exportFileService, + this.transactionExecutor, + this::replaceCatalogReference, + this.tracingContext + ); + log.info("Catalog {} fully loaded in: {}", catalogName, StringUtils.formatNano(System.nanoTime() - start)); + // this will be one day used in more clever way, when entire catalog loading will be split into + // multiple smaller tasks and done asynchronously after the startup (along with catalog loading / unloading feature) + theCatalog.processWriteAheadLog( + updatedCatalog -> this.catalogs.put(catalogName, updatedCatalog) + ); + }, + exception -> { + log.error("Catalog {} is corrupted!", catalogName, exception); + this.catalogs.put( + catalogName, + new CorruptedCatalog( catalogName, configuration.storage().storageDirectoryOrDefault().resolve(catalogName), exception - ); - } - ) - ).andThen( - catalog -> { - if (catalog instanceof CorruptedCatalog) { - this.catalogs.put(catalogName, catalog); - return ProgressiveCompletableFuture.completed(); - } else { - return this.serviceExecutor.submit( - new BackgroundRunnableTask( - catalogName, - "Processing write ahead log of " + catalogName + "...", - () -> { - // this will be one day used in more clever way, when entire catalog loading will be split into - // multiple smaller tasks and done asynchronously after the startup (along with catalog loading / unloading feature) - catalog.processWriteAheadLog( - updatedCatalog -> this.catalogs.put(catalogName, updatedCatalog) - ); - } - ) - ); - } + ) + ); } ); } @@ -748,6 +793,7 @@ private void createCatalogInternal(@Nonnull CreateCatalogSchemaMutation createCa this.configuration, this.reflectionLookup, this.serviceExecutor, + this.exportFileService, this.transactionExecutor, this::replaceCatalogReference, this.tracingContext diff --git a/evita_engine/src/main/java/io/evitadb/core/EvitaSession.java b/evita_engine/src/main/java/io/evitadb/core/EvitaSession.java index db9bb9ad2..ac0b8b736 100644 --- a/evita_engine/src/main/java/io/evitadb/core/EvitaSession.java +++ b/evita_engine/src/main/java/io/evitadb/core/EvitaSession.java @@ -33,6 +33,7 @@ import io.evitadb.api.SessionTraits; import io.evitadb.api.TransactionContract.CommitBehavior; import io.evitadb.api.exception.*; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.observability.trace.RepresentsMutation; import io.evitadb.api.observability.trace.RepresentsQuery; import io.evitadb.api.observability.trace.Traced; @@ -68,7 +69,6 @@ import io.evitadb.api.requestResponse.schema.mutation.LocalCatalogSchemaMutation; import io.evitadb.api.requestResponse.schema.mutation.catalog.CreateEntitySchemaMutation; import io.evitadb.api.requestResponse.schema.mutation.catalog.ModifyEntitySchemaMutation; -import io.evitadb.api.task.ProgressiveCompletableFuture; import io.evitadb.core.async.Interruptible; import io.evitadb.core.exception.CatalogCorruptedException; import io.evitadb.core.metric.event.query.EntityEnrichEvent; @@ -89,7 +89,6 @@ import javax.annotation.Nullable; import javax.annotation.concurrent.NotThreadSafe; import java.io.Serializable; -import java.nio.file.Path; import java.time.OffsetDateTime; import java.util.Arrays; import java.util.Collections; @@ -1177,7 +1176,7 @@ public SealedEntity[] deleteSealedEntitiesAndReturnBodies(@Nonnull Query query) @Traced @Nonnull @Override - public ProgressiveCompletableFuture backupCatalog(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException { + public CompletableFuture backupCatalog(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException { return getCatalog().backup(pastMoment, includingWAL); } diff --git a/evita_engine/src/main/java/io/evitadb/core/async/AbstractBackgroundTask.java b/evita_engine/src/main/java/io/evitadb/core/async/AbstractBackgroundTask.java deleted file mode 100644 index ebedb97f2..000000000 --- a/evita_engine/src/main/java/io/evitadb/core/async/AbstractBackgroundTask.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * - * _ _ ____ ____ - * _____ _(_) |_ __ _| _ \| __ ) - * / _ \ \ / / | __/ _` | | | | _ \ - * | __/\ V /| | || (_| | |_| | |_) | - * \___| \_/ |_|\__\__,_|____/|____/ - * - * Copyright (c) 2024 - * - * Licensed under the Business Source License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://github.com/FgForrest/evitaDB/blob/master/LICENSE - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.evitadb.core.async; - -import io.evitadb.api.task.ProgressiveCompletableFuture; -import io.evitadb.core.metric.event.system.BackgroundTaskFinishedEvent; -import io.evitadb.core.metric.event.system.BackgroundTaskStartedEvent; -import lombok.Getter; - -import javax.annotation.Nonnull; -import java.util.UUID; -import java.util.function.Function; - -/** - * Represents a task that is executed in the background. This is a thin wrapper around {@link Runnable} that emits - * observability events before and after the task is executed. - * - * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 - */ -abstract class AbstractBackgroundTask { - /** - * The name of the catalog that the task belongs to (may be NULL if the task is not bound to any particular catalog). - */ - private final String catalogName; - /** - * The name of the task. - */ - @Getter - private final String taskName; - /** - * The exception handler that is called when an exception is thrown during the task execution. - * When the exception handler doesn't throw exception and instead returns a compatible value it's considered as a - * successful handling of the exception and value is returned as a result of the task. - */ - private final Function exceptionHandler; - /** - * This future can be returned to a client to join the future in its pipeline. - */ - private final ProgressiveCompletableFuture future; - - public AbstractBackgroundTask(@Nonnull String taskName) { - this.catalogName = null; - this.taskName = taskName; - this.future = new ProgressiveCompletableFuture<>(); - this.exceptionHandler = null; - } - - public AbstractBackgroundTask(@Nonnull String catalogName, @Nonnull String taskName) { - this.catalogName = catalogName; - this.taskName = taskName; - this.future = new ProgressiveCompletableFuture<>(); - this.exceptionHandler = null; - } - - public AbstractBackgroundTask(@Nonnull String taskName, @Nonnull Function exceptionHandler) { - this.catalogName = null; - this.taskName = taskName; - this.future = new ProgressiveCompletableFuture<>(); - this.exceptionHandler = exceptionHandler; - } - - public AbstractBackgroundTask(@Nonnull String catalogName, @Nonnull String taskName, @Nonnull Function exceptionHandler) { - this.catalogName = catalogName; - this.taskName = taskName; - this.future = new ProgressiveCompletableFuture<>(); - this.exceptionHandler = exceptionHandler; - } - - /** - * Returns the future of the task. - * @return the future of the task - */ - @Nonnull - public ProgressiveCompletableFuture getFuture() { - return future; - } - - /** - * Returns the ID of the task. - * @return the ID of the task - */ - @Nonnull - public UUID getId() { - return this.future.getId(); - } - - /** - * Returns progress of the task. - * @return progress of the task in percents - */ - public int getProgress() { - return this.future.getProgress(); - } - - /** - * Method updates the progress of the task. - * @param progress new progress of the task in percents - */ - public void updateProgress(int progress) { - this.future.updateProgress(progress); - } - - /** - * Executes the task and emits the start and finish events. - * - * @return the result of the task - */ - public final V execute() { - // emit the start event - new BackgroundTaskStartedEvent(this.catalogName, this.taskName).commit(); - - // init progress information - updateProgress(0); - - // prepare the finish event - final BackgroundTaskFinishedEvent finishedEvent = new BackgroundTaskFinishedEvent(catalogName, taskName); - try { - final V result = this.executeInternal(); - this.future.complete(result); - return result; - } catch (Throwable e) { - if (this.exceptionHandler != null) { - try { - final V defaultResult = this.exceptionHandler.apply(e); - this.future.complete(defaultResult); - return defaultResult; - } catch (Throwable e2) { - this.future.completeExceptionally(e2); - throw e2; - } - } else { - this.future.completeExceptionally(e); - throw e; - } - } finally { - // emit the finish event - finishedEvent.finish().commit(); - } - } - - /** - * Executes the task logic. - * @return the result of the task - */ - protected abstract V executeInternal(); - -} diff --git a/evita_engine/src/main/java/io/evitadb/core/async/AbstractClientTask.java b/evita_engine/src/main/java/io/evitadb/core/async/AbstractClientTask.java new file mode 100644 index 000000000..b7f4b7aab --- /dev/null +++ b/evita_engine/src/main/java/io/evitadb/core/async/AbstractClientTask.java @@ -0,0 +1,247 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.evitadb.core.async; + +import io.evitadb.api.task.Task; +import io.evitadb.api.task.TaskStatus; +import io.evitadb.api.task.TaskStatus.State; +import io.evitadb.core.metric.event.system.BackgroundTaskFinishedEvent; +import io.evitadb.core.metric.event.system.BackgroundTaskStartedEvent; +import io.evitadb.utils.UUIDUtil; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.time.OffsetDateTime; +import java.util.concurrent.CancellationException; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Function; + +/** + * Represents a task that is executed in the background. This is a thin wrapper around {@link Runnable} that emits + * observability events before and after the task is executed. + * + * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 + */ +abstract class AbstractClientTask implements Task { + /** + * Contains the actual status of the task. + */ + private final AtomicReference> status; + /** + * The exception handler that is called when an exception is thrown during the task execution. + * When the exception handler doesn't throw exception and instead returns a compatible value it's considered as a + * successful handling of the exception and value is returned as a result of the task. + */ + private final Function exceptionHandler; + /** + * This future can be returned to a client to join the future in its pipeline. + */ + private final CompletableFuture future; + + public AbstractClientTask(@Nonnull String taskName, @Nullable S settings) { + this.future = new CompletableFuture<>(); + this.status = new AtomicReference<>( + new TaskStatus<>( + this.getClass().getSimpleName(), + taskName, + UUIDUtil.randomUUID(), + null, + OffsetDateTime.now(), + null, + null, + 0, + settings, + null, + null + ) + ); + this.exceptionHandler = null; + } + + public AbstractClientTask(@Nonnull String catalogName, @Nonnull String taskName, @Nullable S settings) { + this.future = new CompletableFuture<>(); + this.status = new AtomicReference<>( + new TaskStatus<>( + this.getClass().getSimpleName(), + taskName, + UUIDUtil.randomUUID(), + catalogName, + OffsetDateTime.now(), + null, + null, + 0, + settings, + null, + null + ) + ); + this.exceptionHandler = null; + } + + public AbstractClientTask(@Nonnull String taskName, @Nullable S settings, @Nonnull Function exceptionHandler) { + this.future = new CompletableFuture<>(); + this.status = new AtomicReference<>( + new TaskStatus<>( + this.getClass().getSimpleName(), + taskName, + UUIDUtil.randomUUID(), + null, + OffsetDateTime.now(), + null, + null, + 0, + settings, + null, + null + ) + ); + this.exceptionHandler = exceptionHandler; + } + + public AbstractClientTask(@Nonnull String catalogName, @Nonnull String taskName, @Nullable S settings, @Nonnull Function exceptionHandler) { + this.future = new CompletableFuture<>(); + this.status = new AtomicReference<>( + new TaskStatus<>( + this.getClass().getSimpleName(), + taskName, + UUIDUtil.randomUUID(), + catalogName, + OffsetDateTime.now(), + null, + null, + 0, + settings, + null, + null + ) + ); + this.exceptionHandler = exceptionHandler; + } + + @Nonnull + @Override + public TaskStatus getStatus() { + return status.get(); + } + + @Nonnull + @Override + public CompletableFuture getFutureResult() { + return this.future; + } + + @Override + @Nullable + public final T execute() { + // emit the start event + final TaskStatus theStatus = getStatus(); + + if (theStatus.state() == State.QUEUED) { + new BackgroundTaskStartedEvent(theStatus.catalogName(), theStatus.taskName()).commit(); + + this.status.updateAndGet( + TaskStatus::transitionToStarted + ); + + // prepare the finish event + final BackgroundTaskFinishedEvent finishedEvent = new BackgroundTaskFinishedEvent(theStatus.catalogName(), theStatus.taskName()); + try { + final T result = this.executeInternal(); + if (this.future.isDone() || this.future.isCancelled()) { + return null; + } else { + this.future.complete(result); + this.status.updateAndGet( + currentStatus -> currentStatus.transitionToFinished(result) + ); + return result; + } + } catch (Throwable e) { + this.status.updateAndGet( + currentStatus -> currentStatus.transitionToFailed(e) + ); + if (this.exceptionHandler != null) { + try { + final T defaultResult = this.exceptionHandler.apply(e); + this.future.complete(defaultResult); + return defaultResult; + } catch (Throwable e2) { + this.future.completeExceptionally(e2); + throw e2; + } + } else { + this.future.completeExceptionally(e); + throw e; + } + } finally { + // emit the finish event + finishedEvent.finish().commit(); + } + } else { + return null; + } + } + + @Override + public void cancel() { + if (!(this.future.isDone() || this.future.isCancelled())) { + this.future.cancel(true); + this.status.updateAndGet( + currentStatus -> currentStatus.transitionToFailed( + new CancellationException("Task was canceled.") + ) + ); + } + } + + @Override + public void fail(@Nonnull Exception exception) { + if (!(this.future.isDone() || this.future.isCancelled())) { + this.future.completeExceptionally(exception); + this.status.updateAndGet( + currentStatus -> currentStatus.transitionToFailed(exception) + ); + } + } + + /** + * Method updates the progress of the task. + * @param progress new progress of the task in percents + */ + public void updateProgress(int progress) { + if (!(this.future.isDone() || this.future.isCancelled())) { + this.status.updateAndGet( + currentStatus -> currentStatus.updateProgress(progress) + ); + } + } + + /** + * Executes the task logic. + * @return the result of the task + */ + protected abstract T executeInternal(); + +} diff --git a/evita_engine/src/main/java/io/evitadb/core/async/BackgroundCallableTask.java b/evita_engine/src/main/java/io/evitadb/core/async/ClientCallableTask.java similarity index 62% rename from evita_engine/src/main/java/io/evitadb/core/async/BackgroundCallableTask.java rename to evita_engine/src/main/java/io/evitadb/core/async/ClientCallableTask.java index deab51ac7..38b4f0007 100644 --- a/evita_engine/src/main/java/io/evitadb/core/async/BackgroundCallableTask.java +++ b/evita_engine/src/main/java/io/evitadb/core/async/ClientCallableTask.java @@ -38,11 +38,11 @@ * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 */ @Slf4j -public class BackgroundCallableTask extends AbstractBackgroundTask implements Callable { +public class ClientCallableTask extends AbstractClientTask implements Callable { /** * The actual logic wrapped in a lambda that is executed by the task with progress tracking. */ - private final Function, V> callableWithProgress; + private final Function, T> callableWithProgress; /** * Wraps the given {@link Callable} and logs any exceptions that occur during its execution. @@ -73,53 +73,53 @@ private static V wrapCallable(@Nullable String catalogName, @Nonnull String } } - public BackgroundCallableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nonnull Callable callable) { - super(catalogName, taskName); - this.callableWithProgress = intConsumer -> wrapCallable(catalogName, getTaskName(), callable); + public ClientCallableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nullable S settings, @Nonnull Callable callable) { + super(catalogName, taskName, settings); + this.callableWithProgress = intConsumer -> wrapCallable(catalogName, taskName, callable); } - public BackgroundCallableTask(@Nonnull String taskName, @Nonnull Callable callable) { - super(taskName); + public ClientCallableTask(@Nonnull String taskName, @Nullable S settings, @Nonnull Callable callable) { + super(taskName, settings); this.callableWithProgress = intConsumer -> wrapCallable(null, taskName, callable); } - public BackgroundCallableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nonnull Function, V> callable) { - super(catalogName, taskName); + public ClientCallableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nullable S settings, @Nonnull Function, T> callable) { + super(catalogName, taskName, settings); this.callableWithProgress = callable; } - public BackgroundCallableTask(@Nonnull String taskName, @Nonnull Function, V> callable) { - super(taskName); + public ClientCallableTask(@Nonnull String taskName, @Nullable S settings, @Nonnull Function, T> callable) { + super(taskName, settings); this.callableWithProgress = callable; } - public BackgroundCallableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nonnull Callable callable, @Nonnull Function exceptionHandler) { - super(catalogName, taskName, exceptionHandler); - this.callableWithProgress = intConsumer -> wrapCallable(catalogName, getTaskName(), callable); + public ClientCallableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nullable S settings, @Nonnull Callable callable, @Nonnull Function exceptionHandler) { + super(catalogName, taskName, settings, exceptionHandler); + this.callableWithProgress = intConsumer -> wrapCallable(catalogName, taskName, callable); } - public BackgroundCallableTask(@Nonnull String taskName, @Nonnull Callable callable, @Nonnull Function exceptionHandler) { - super(taskName, exceptionHandler); + public ClientCallableTask(@Nonnull String taskName, @Nullable S settings, @Nonnull Callable callable, @Nonnull Function exceptionHandler) { + super(taskName, settings, exceptionHandler); this.callableWithProgress = intConsumer -> wrapCallable(null, taskName, callable); } - public BackgroundCallableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nonnull Function, V> callable, @Nonnull Function exceptionHandler) { - super(catalogName, taskName, exceptionHandler); + public ClientCallableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nullable S settings, @Nonnull Function, T> callable, @Nonnull Function exceptionHandler) { + super(catalogName, taskName, settings, exceptionHandler); this.callableWithProgress = callable; } - public BackgroundCallableTask(@Nonnull String taskName, @Nonnull Function, V> callable, @Nonnull Function exceptionHandler) { - super(taskName, exceptionHandler); + public ClientCallableTask(@Nonnull String taskName, @Nullable S settings, @Nonnull Function, T> callable, @Nonnull Function exceptionHandler) { + super(taskName, settings, exceptionHandler); this.callableWithProgress = callable; } @Override - public V call() throws Exception { + public T call() throws Exception { return super.execute(); } @Override - protected V executeInternal() { + protected T executeInternal() { return this.callableWithProgress.apply(this); } } diff --git a/evita_engine/src/main/java/io/evitadb/core/async/BackgroundRunnableTask.java b/evita_engine/src/main/java/io/evitadb/core/async/ClientRunnableTask.java similarity index 56% rename from evita_engine/src/main/java/io/evitadb/core/async/BackgroundRunnableTask.java rename to evita_engine/src/main/java/io/evitadb/core/async/ClientRunnableTask.java index cb7ad5007..2192a52a0 100644 --- a/evita_engine/src/main/java/io/evitadb/core/async/BackgroundRunnableTask.java +++ b/evita_engine/src/main/java/io/evitadb/core/async/ClientRunnableTask.java @@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.function.Consumer; import java.util.function.Function; @@ -36,11 +37,11 @@ * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 */ @Slf4j -public class BackgroundRunnableTask extends AbstractBackgroundTask implements Runnable { +public class ClientRunnableTask extends AbstractClientTask implements Runnable { /** * The actual logic wrapped in a lambda that is executed by the task. */ - private final Consumer runnableWithProgress; + private final Consumer> runnableWithProgress; /** * Transforms {@link Consumer} to {@link Function} that can be used as an exception handler. @@ -54,43 +55,43 @@ public class BackgroundRunnableTask extends AbstractBackgroundTask impleme }; } - public BackgroundRunnableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nonnull Runnable runnable) { - super(catalogName, taskName); + public ClientRunnableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nullable S settings, @Nonnull Runnable runnable) { + super(catalogName, taskName, settings); this.runnableWithProgress = task -> runnable.run(); } - public BackgroundRunnableTask(@Nonnull String taskName, @Nonnull Runnable runnable) { - super(taskName); + public ClientRunnableTask(@Nonnull String taskName, @Nullable S settings, @Nonnull Runnable runnable) { + super(taskName, settings); this.runnableWithProgress = task -> runnable.run(); } - public BackgroundRunnableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nonnull Runnable runnable, @Nonnull Consumer exceptionHandler) { - super(catalogName, taskName, wrapExceptionHandler(exceptionHandler)); + public ClientRunnableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nullable S settings, @Nonnull Runnable runnable, @Nonnull Consumer exceptionHandler) { + super(catalogName, taskName, settings, wrapExceptionHandler(exceptionHandler)); this.runnableWithProgress = task -> runnable.run(); } - public BackgroundRunnableTask(@Nonnull String taskName, @Nonnull Runnable runnable, @Nonnull Consumer exceptionHandler) { - super(taskName, wrapExceptionHandler(exceptionHandler)); + public ClientRunnableTask(@Nonnull String taskName, @Nullable S settings, @Nonnull Runnable runnable, @Nonnull Consumer exceptionHandler) { + super(taskName, settings, wrapExceptionHandler(exceptionHandler)); this.runnableWithProgress = task -> runnable.run(); } - public BackgroundRunnableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nonnull Consumer runnableWithProgress) { - super(catalogName, taskName); + public ClientRunnableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nullable S settings, @Nonnull Consumer> runnableWithProgress) { + super(catalogName, taskName, settings); this.runnableWithProgress = runnableWithProgress; } - public BackgroundRunnableTask(@Nonnull String taskName, @Nonnull Consumer runnableWithProgress) { - super(taskName); + public ClientRunnableTask(@Nonnull String taskName, @Nullable S settings, @Nonnull Consumer> runnableWithProgress) { + super(taskName, settings); this.runnableWithProgress = runnableWithProgress; } - public BackgroundRunnableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nonnull Consumer runnableWithProgress, @Nonnull Consumer exceptionHandler) { - super(catalogName, taskName, wrapExceptionHandler(exceptionHandler)); + public ClientRunnableTask(@Nonnull String catalogName, @Nonnull String taskName, @Nullable S settings, @Nonnull Consumer> runnableWithProgress, @Nonnull Consumer exceptionHandler) { + super(catalogName, taskName, settings, wrapExceptionHandler(exceptionHandler)); this.runnableWithProgress = runnableWithProgress; } - public BackgroundRunnableTask(@Nonnull String taskName, @Nonnull Consumer runnableWithProgress, @Nonnull Consumer exceptionHandler) { - super(taskName, wrapExceptionHandler(exceptionHandler)); + public ClientRunnableTask(@Nonnull String taskName, @Nullable S settings, @Nonnull Consumer> runnableWithProgress, @Nonnull Consumer exceptionHandler) { + super(taskName, settings, wrapExceptionHandler(exceptionHandler)); this.runnableWithProgress = runnableWithProgress; } diff --git a/evita_engine/src/main/java/io/evitadb/core/async/DelayedAsyncTask.java b/evita_engine/src/main/java/io/evitadb/core/async/DelayedAsyncTask.java index 052313eba..acf1319cc 100644 --- a/evita_engine/src/main/java/io/evitadb/core/async/DelayedAsyncTask.java +++ b/evita_engine/src/main/java/io/evitadb/core/async/DelayedAsyncTask.java @@ -27,6 +27,7 @@ import lombok.extern.slf4j.Slf4j; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.time.OffsetDateTime; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; @@ -36,8 +37,8 @@ /** * Represents a task that is executed asynchronously after a specified delay. The task is guarded to be scheduled only * once at a time or not at all. Task is scheduled by {@link #schedule()} method with constant delay. The task is paused - * when the {@link #task} is finished and returns negative value. The task is re-scheduled when the {@link #task} returns - * positive value. The task is re-scheduled with shorter delay when the {@link #task} returns positive value. + * when the {@link #lambda} is finished and returns negative value. The task is re-scheduled when the {@link #lambda} returns + * positive value. The task is re-scheduled with shorter delay when the {@link #lambda} returns positive value. * * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 */ @@ -63,11 +64,19 @@ public class DelayedAsyncTask { * The time unit of the delay. */ private final TimeUnit delayUnits; + /** + * Name of the catalog that the task belongs to (may be NULL if the task is not bound to any particular catalog). + */ + private final String catalogName; + /** + * The name of the task. + */ + private final String taskName; /** * The task that is executed asynchronously after the specified delay and returns negative value when it should be * paused or positive value when it should be re-scheduled (with shortened delay). */ - private final BackgroundRunnableTask task; + private final Runnable lambda; /** * The next planned cache cut time - if there is scheduled action planned in the current scheduled executor service, * the time is stored here to avoid scheduling the same action multiple times. @@ -83,7 +92,7 @@ public class DelayedAsyncTask { private final AtomicBoolean reSchedule = new AtomicBoolean(); public DelayedAsyncTask( - @Nonnull String catalogName, + @Nullable String catalogName, @Nonnull String taskName, @Nonnull Scheduler scheduler, @Nonnull LongSupplier runnable, @@ -96,7 +105,7 @@ public DelayedAsyncTask( } public DelayedAsyncTask( - @Nonnull String catalogName, + @Nullable String catalogName, @Nonnull String taskName, @Nonnull Scheduler scheduler, @Nonnull LongSupplier runnable, @@ -108,9 +117,9 @@ public DelayedAsyncTask( this.delay = delay; this.delayUnits = delayUnits; this.minimalSchedulingGap = minimalSchedulingGap; - this.task = new BackgroundRunnableTask( - catalogName, taskName, () -> runTask(runnable) - ); + this.catalogName = catalogName; + this.taskName = taskName; + this.lambda = () -> runTask(runnable); } /** @@ -127,7 +136,7 @@ public void schedule() { this.minimalSchedulingGap ); this.scheduler.schedule( - this.task, + this.lambda, computedDelay, TimeUnit.MILLISECONDS ); @@ -161,7 +170,7 @@ private void scheduleWithDelayShorterBy(long shorterBy) { this.minimalSchedulingGap ); this.scheduler.schedule( - this.task, + this.lambda, computedDelay, TimeUnit.MILLISECONDS ); @@ -179,7 +188,7 @@ private void runTask(@Nonnull LongSupplier runnable) { ); planWithShorterDelay = runnable.getAsLong(); } catch (RuntimeException ex) { - log.error("Error while running task: {}", this.task.getTaskName(), ex); + log.error("Error while running task: {}", this.taskName, ex); throw ex; } finally { Assert.isPremiseValid( diff --git a/evita_engine/src/main/java/io/evitadb/core/async/Scheduler.java b/evita_engine/src/main/java/io/evitadb/core/async/Scheduler.java index 81e176eda..8a217dbfc 100644 --- a/evita_engine/src/main/java/io/evitadb/core/async/Scheduler.java +++ b/evita_engine/src/main/java/io/evitadb/core/async/Scheduler.java @@ -24,23 +24,23 @@ package io.evitadb.core.async; import io.evitadb.api.configuration.ThreadPoolOptions; -import io.evitadb.api.task.ProgressiveCompletableFuture; +import io.evitadb.api.task.Task; +import io.evitadb.api.task.TaskStatus; +import io.evitadb.api.task.TaskStatus.State; +import io.evitadb.dataType.PaginatedList; import lombok.extern.slf4j.Slf4j; import javax.annotation.Nonnull; +import java.util.ArrayList; import java.util.Collection; +import java.util.Iterator; import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; +import java.util.Optional; +import java.util.UUID; +import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; +import java.util.stream.Collectors; /** * Scheduler spins up a new {@link ScheduledThreadPoolExecutor} that regularly executes Evita maintenance jobs such as @@ -62,34 +62,56 @@ public class Scheduler implements ObservableExecutorService { * Counter monitoring the number of tasks rejected by the executor service. */ private final AtomicLong rejectedTaskCount = new AtomicLong(); + /** + * Queue that holds the tasks that are currently being executed or waiting to be executed. It could also contain + * already finished tasks that are subject to be removed. + */ + private final ArrayBlockingQueue> queue; + /** + * Rejected execution handler that is called when the queue is full and a new task cannot be added. + */ + private final EvitaRejectingExecutorHandler rejectingExecutorHandler; public Scheduler(@Nonnull ThreadPoolOptions options) { + this.rejectingExecutorHandler = new EvitaRejectingExecutorHandler("service", this.rejectedTaskCount::incrementAndGet); final ScheduledThreadPoolExecutor theExecutor = new ScheduledThreadPoolExecutor( options.maxThreadCount(), new EvitaThreadFactory(options.threadPriority()), - new EvitaRejectingExecutorHandler("service", this.rejectedTaskCount::incrementAndGet) + this.rejectingExecutorHandler ); theExecutor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); theExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); this.executorService = theExecutor; + // create queue with double the size of the configured queue size to have some breathing room + this.queue = new ArrayBlockingQueue<>(options.queueSize() << 1); + // schedule automatic purging task + new DelayedAsyncTask( + null, + "Scheduler queue purging task", + this, + this::purgeFinishedTasks, + 1, TimeUnit.MINUTES + ).schedule(); } /** * This constructor is used only in tests. + * * @param executorService to be used for scheduling tasks */ public Scheduler(@Nonnull ScheduledExecutorService executorService) { this.executorService = executorService; + this.queue = new ArrayBlockingQueue<>(64); + this.rejectingExecutorHandler = null; } /** * Method schedules execution of `runnable` after `initialDelay` with frequency of `period`. * - * @param runnable the task to be executed + * @param runnable the task to be executed * @param initialDelay the initial delay before the first execution * @param period the period between subsequent executions * @param timeUnit the time unit of the initialDelay and period parameters - * * @throws NullPointerException if the runnable or timeUnit parameter is null * @throws RejectedExecutionException if the task cannot be scheduled for execution */ @@ -108,10 +130,10 @@ public void scheduleAtFixedRate(@Nonnull Runnable runnable, int initialDelay, in /** * Schedules the execution of a {@link Runnable} task after a specified delay. * - * @param lambda The task to be executed. - * @param delay The amount of time to delay the execution. + * @param lambda The task to be executed. + * @param delay The amount of time to delay the execution. * @param delayUnits The time unit of the delay parameter. - * @throws NullPointerException if the lambda or delayUnits parameter is null. + * @throws NullPointerException if the lambda or delayUnits parameter is null. * @throws RejectedExecutionException if the task cannot be scheduled for execution. */ public void schedule(@Nonnull Runnable lambda, long delay, @Nonnull TimeUnit delayUnits) { @@ -125,7 +147,7 @@ public void schedule(@Nonnull Runnable lambda, long delay, @Nonnull TimeUnit del * will be executed "as soon as possible". * * @param runnable the runnable task to be executed - * @throws NullPointerException if the runnable parameter is null + * @throws NullPointerException if the runnable parameter is null * @throws RejectedExecutionException if the task cannot be submitted for execution */ @Override @@ -172,20 +194,6 @@ public boolean awaitTermination(long timeout, @Nonnull TimeUnit unit) throws Int return executorService.awaitTermination(timeout, unit); } - @Nonnull - public ProgressiveCompletableFuture submit(@Nonnull BackgroundCallableTask task) { - this.executorService.submit(task); - this.submittedTaskCount.incrementAndGet(); - return task.getFuture(); - } - - @Nonnull - public ProgressiveCompletableFuture submit(@Nonnull BackgroundRunnableTask task) { - this.executorService.submit(task); - this.submittedTaskCount.incrementAndGet(); - return task.getFuture(); - } - @Nonnull @Override public Future submit(@Nonnull Callable task) { @@ -241,6 +249,128 @@ public T invokeAny(@Nonnull Collection> tasks, long ti return result; } + @Nonnull + public CompletableFuture submit(@Nonnull Task task) { + addTaskToQueue(task); + this.executorService.submit(task::execute); + this.submittedTaskCount.incrementAndGet(); + return task.getFutureResult(); + } + + /** + * Returns a paginated list of all tasks that are currently in the queue - either waiting to be executed or + * currently running, or recently finished. + * + * @param page the page number (starting from 1) + * @param pageSize the size of the page + * @return the paginated list of tasks + */ + @Nonnull + public PaginatedList> getJobStatuses(int page, int pageSize) { + return new PaginatedList<>( + page, pageSize, this.queue.size(), + this.queue.stream() + .skip(PaginatedList.getFirstItemNumberForPage(page, pageSize)) + .limit(pageSize) + .map(Task::getStatus) + .collect(Collectors.toCollection(ArrayList::new)) + ); + } + + /** + * Returns job status for the specified jobId or empty if the job is not found. + * @param jobId jobId of the job + * @return job status + */ + @Nonnull + public Optional> getJobStatus(@Nonnull UUID jobId) { + return this.queue.stream() + .filter(it -> it.getStatus().taskId().equals(jobId)) + .findFirst() + .map(Task::getStatus); + } + + /** + * Cancels the job with the specified jobId. If the job is waiting in the queue, it will be removed from the queue. + * If the job is already running, it must support cancelling to be interrupted and canceled. + * + * @param jobId jobId of the job + * @return true if the job was found and cancellation triggered, false if the job was not found + */ + public boolean cancelJob(@Nonnull UUID jobId) { + return this.queue.stream() + .filter(it -> it.getStatus().taskId().equals(jobId)) + .findFirst() + .map(theJob -> { + theJob.cancel(); + return true; + }) + .orElse(false); + } + + /** + * Wraps the task into an observable task and adds it to the queue. Returns the same type as the input argument + * to allow for fluent chaining. + * + * @param task the task to add + * @param the type of the task + * @return the task that was added and wrapped + */ + @Nonnull + private > T addTaskToQueue(@Nonnull T task) { + try { + // add the task to the queue + this.queue.add(task); + } catch (IllegalStateException e) { + // this means the queue is full, so we need to remove some tasks + this.purgeFinishedTasks(); + // and try adding the task again + try { + this.queue.add(task); + } catch (IllegalStateException exceptionAgain) { + // and this should never happen since queue was cleared of finished and timed out tasks and its size + // is double the configured size + if (this.rejectingExecutorHandler != null) { + this.rejectingExecutorHandler.rejectedExecution(); + } + task.fail(exceptionAgain); + throw exceptionAgain; + } + } + return task; + } + + /** + * Iterates over all tasks in {@link #queue} in a batch manner and removes all finished tasks. Tasks that are + * still waiting or running are added to the tail of the queue again. + */ + private long purgeFinishedTasks() { + // go through the entire queue, but only once + final int bufferSize = 512; + final ArrayList> buffer = new ArrayList<>(bufferSize); + final int queueSize = this.queue.size(); + for (int i = 0; i < queueSize; i++) { + // effectively withdraw first block of tasks from the queue + this.queue.drainTo(buffer, bufferSize); + // now go through all of them + final Iterator> it = buffer.iterator(); + while (it.hasNext()) { + final Task task = it.next(); + final State taskState = task.getStatus().state(); + if (taskState == State.FINISHED || taskState == State.FAILED) { + // if task is finished, remove it from the queue + it.remove(); + } + } + // add the remaining tasks back to the queue in an effective way + this.queue.addAll(buffer); + // clear the buffer for the next iteration + buffer.clear(); + } + // plan to next standard time + return 0L; + } + /** * Custom thread factory to manage thread priority and naming. */ diff --git a/evita_engine/src/main/java/io/evitadb/core/async/SequentialTask.java b/evita_engine/src/main/java/io/evitadb/core/async/SequentialTask.java new file mode 100644 index 000000000..d15f03cb4 --- /dev/null +++ b/evita_engine/src/main/java/io/evitadb/core/async/SequentialTask.java @@ -0,0 +1,162 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.evitadb.core.async; + +import io.evitadb.api.task.Task; +import io.evitadb.api.task.TaskStatus; +import io.evitadb.api.task.TaskStatus.State; +import io.evitadb.utils.UUIDUtil; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.time.OffsetDateTime; +import java.util.Objects; +import java.util.concurrent.CancellationException; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicReference; + +import static java.util.Optional.ofNullable; + +/** + * This task ensures that all the steps are executed in a sequence. It is a thin wrapper around {@link Task} that + * executes a sequence of tasks in a single background task and translates the progress of the steps to the overall + * progress of the task. + * + * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 + */ +public class SequentialTask implements Task { + private final String taskName; + private final AtomicReference> status; + private final Task[] steps; + private final AtomicReference> currentStep; + private final CompletableFuture futureResult; + + public SequentialTask(@Nullable String catalogName, @Nonnull String taskName, @Nonnull Task step1, @Nonnull Task step2) { + this.taskName = taskName; + this.status = new AtomicReference<>( + new TaskStatus<>( + step1.getStatus().taskType() + ", " + step2.getStatus().taskType(), + taskName, + UUIDUtil.randomUUID(), + catalogName, + OffsetDateTime.now(), + null, + null, + 0, + null, + null, + null + ) + ); + this.currentStep = new AtomicReference<>(); + this.steps = new Task[]{step1, step2}; + this.futureResult = new CompletableFuture<>(); + } + + @Nonnull + @Override + public TaskStatus getStatus() { + int overallProgress = 0; + for (Task step : steps) { + overallProgress |= step.getStatus().progress(); + } + final String newTaskName = this.taskName + ofNullable(this.currentStep.get()).map(it -> " [" + it.getStatus().taskName() + "]").orElse(""); + final int newProgress = overallProgress / this.steps.length; + final TaskStatus currentStatus = this.status.get(); + return currentStatus.state() != State.RUNNING || + currentStatus.progress() == newProgress || + !Objects.equals(currentStatus.taskName(), newTaskName) ? + currentStatus : + this.status.updateAndGet(current -> current.updateProgress(newProgress)); + } + + @Nonnull + @Override + public CompletableFuture getFutureResult() { + return this.futureResult; + } + + @Nullable + @Override + public T execute() { + if (this.status.get().state() == State.QUEUED) { + try { + this.status.updateAndGet(TaskStatus::transitionToStarted); + + for (Task step : steps) { + if (step.getStatus().state() == State.QUEUED) { + this.currentStep.set(step); + step.execute(); + } + } + //noinspection unchecked + final T theFinalResult = (T) this.steps[this.steps.length - 1] + .getFutureResult() + .getNow(null); + this.futureResult.complete(theFinalResult); + + this.status.updateAndGet(current -> current.transitionToFinished(theFinalResult)); + + return theFinalResult; + } catch (Exception ex) { + fail(ex); + throw ex; + } finally { + this.currentStep.set(null); + } + } else { + return null; + } + } + + @Override + public void cancel() { + if (!(this.futureResult.isDone() || this.futureResult.isCancelled())) { + for (Task step : steps) { + final State state = step.getStatus().state(); + if (state == State.QUEUED) { + step.cancel(); + } + } + this.status.updateAndGet( + current -> current.transitionToFailed(new CancellationException("Task was canceled.")) + ); + this.futureResult.cancel(true); + } + } + + @Override + public void fail(@Nonnull Exception exception) { + if (!(this.futureResult.isDone() || this.futureResult.isCancelled())) { + for (Task step : steps) { + final State state = step.getStatus().state(); + if (state == State.QUEUED) { + step.fail(exception); + } + } + this.status.updateAndGet(current -> current.transitionToFailed(exception)); + this.futureResult.completeExceptionally(exception); + } + } +} diff --git a/evita_engine/src/main/java/io/evitadb/core/maintenance/SessionKiller.java b/evita_engine/src/main/java/io/evitadb/core/async/SessionKiller.java similarity index 87% rename from evita_engine/src/main/java/io/evitadb/core/maintenance/SessionKiller.java rename to evita_engine/src/main/java/io/evitadb/core/async/SessionKiller.java index 6319f226c..60b270dc1 100644 --- a/evita_engine/src/main/java/io/evitadb/core/maintenance/SessionKiller.java +++ b/evita_engine/src/main/java/io/evitadb/core/async/SessionKiller.java @@ -21,13 +21,11 @@ * limitations under the License. */ -package io.evitadb.core.maintenance; +package io.evitadb.core.async; import io.evitadb.api.configuration.ServerOptions; import io.evitadb.api.exception.InstanceTerminatedException; import io.evitadb.core.Evita; -import io.evitadb.core.async.BackgroundRunnableTask; -import io.evitadb.core.async.Scheduler; import io.evitadb.core.metric.event.session.KilledEvent; import lombok.extern.slf4j.Slf4j; @@ -43,18 +41,35 @@ */ @Slf4j public class SessionKiller implements Runnable { + /** + * The allowed inactivity time in seconds. + */ private final long allowedInactivityInSeconds; + /** + * Reference to the evitaDB instance. + */ private final Evita evita; + /** + * The task that is scheduled to kill the sessions. + */ + private final DelayedAsyncTask killerTask; public SessionKiller(int allowedInactivityInSeconds, @Nonnull Evita evita, @Nonnull Scheduler scheduler) { this.allowedInactivityInSeconds = allowedInactivityInSeconds; this.evita = evita; - scheduler.scheduleAtFixedRate( - new BackgroundRunnableTask("Session killer", this), - Math.min(60, allowedInactivityInSeconds), + this.killerTask = new DelayedAsyncTask( + null, + "Session killer", + scheduler, + () -> { + run(); + // plan again according to plan + return 0L; + }, Math.min(60, allowedInactivityInSeconds), TimeUnit.SECONDS ); + this.killerTask.schedule(); } @Override diff --git a/evita_engine/src/main/java/io/evitadb/core/cache/CacheAnteroom.java b/evita_engine/src/main/java/io/evitadb/core/cache/CacheAnteroom.java index 54551fa35..78b7c86fd 100644 --- a/evita_engine/src/main/java/io/evitadb/core/cache/CacheAnteroom.java +++ b/evita_engine/src/main/java/io/evitadb/core/cache/CacheAnteroom.java @@ -26,7 +26,7 @@ import io.evitadb.api.EvitaSessionContract; import io.evitadb.api.query.require.EntityFetch; import io.evitadb.api.requestResponse.data.structure.BinaryEntity; -import io.evitadb.core.async.BackgroundRunnableTask; +import io.evitadb.core.async.DelayedAsyncTask; import io.evitadb.core.async.Scheduler; import io.evitadb.core.cache.model.CacheRecordAdept; import io.evitadb.core.cache.model.CacheRecordType; @@ -99,9 +99,9 @@ public class CacheAnteroom { */ private final CacheEden cacheEden; /** - * Contains reference to the asynchronous task executor. + * Task that evaluates adepts for the eden. */ - private final Scheduler scheduler; + private final DelayedAsyncTask edenGateKeeper; /** * Contains a hash map that collects adepts for the caching. In other terms the expensive data structures that were * recently computed and might be worth caching. The map is cleared each time {@link #evaluateAssociates(boolean)} @@ -132,10 +132,12 @@ public CacheAnteroom(int maxRecordCount, long minimalComplexityThreshold, @Nonnu this.cacheEden = cacheEden; this.maxRecordCount = maxRecordCount; this.minimalComplexityThreshold = minimalComplexityThreshold; - this.scheduler = scheduler; - this.scheduler.scheduleAtFixedRate( - this::reportStatistics, - 1, 1, TimeUnit.MINUTES + this.edenGateKeeper = new DelayedAsyncTask( + null, + "Eden cache adepts inbound reevaluation", + scheduler, + this.cacheEden::evaluateAdepts, + 0, TimeUnit.MILLISECONDS, 0 ); } @@ -152,7 +154,7 @@ public void evaluateAssociatesSynchronously() { /** * Hands off {@link #cacheAdepts} via. {@link CacheEden#setNextAdeptsToEvaluate(Map)} for evaluation. It also - * triggers evaluation of those adepts in different thread using {@link #scheduler}. The evaluation will start almost + * triggers evaluation of those adepts in different thread using {@link Scheduler}. The evaluation will start almost * immediately if there is any thread available in the executor pool. */ public void evaluateAssociatesAsynchronously() { @@ -441,9 +443,7 @@ private void evaluateAssociates(boolean synchronously) { if (synchronously) { this.cacheEden.evaluateAdepts(); } else { - this.scheduler.execute( - new BackgroundRunnableTask("Eden cache gatekeeper", this.cacheEden::evaluateAdepts) - ); + this.edenGateKeeper.schedule(); } } catch (RuntimeException e) { // we don't rethrow - it would stop engine, just log error diff --git a/evita_engine/src/main/java/io/evitadb/core/cache/CacheEden.java b/evita_engine/src/main/java/io/evitadb/core/cache/CacheEden.java index 98597351f..d4b22377d 100644 --- a/evita_engine/src/main/java/io/evitadb/core/cache/CacheEden.java +++ b/evita_engine/src/main/java/io/evitadb/core/cache/CacheEden.java @@ -289,7 +289,7 @@ public boolean isAdeptsWaitingForEvaluation() { * and registers the most precious of them into the cache. It also evicts currently cached records if they become * cool enough. */ - public void evaluateAdepts() { + public long evaluateAdepts() { try { // this method is allowed to run in one thread only if (this.lock.tryLock() || this.lock.tryLock(1, TimeUnit.SECONDS)) { @@ -425,6 +425,10 @@ public void evaluateAdepts() { log.warn("Failed to acquire lock for cache re-evaluation!"); Thread.currentThread().interrupt(); } + // always report statistics to the observability + this.reportStatistics(); + // plan with standard delay + return 0L; } /** diff --git a/evita_engine/src/main/java/io/evitadb/core/cache/HeapMemoryCacheSupervisor.java b/evita_engine/src/main/java/io/evitadb/core/cache/HeapMemoryCacheSupervisor.java index ef5e66b6d..77997578e 100644 --- a/evita_engine/src/main/java/io/evitadb/core/cache/HeapMemoryCacheSupervisor.java +++ b/evita_engine/src/main/java/io/evitadb/core/cache/HeapMemoryCacheSupervisor.java @@ -26,7 +26,7 @@ import io.evitadb.api.EvitaSessionContract; import io.evitadb.api.configuration.CacheOptions; import io.evitadb.api.query.require.EntityFetch; -import io.evitadb.core.async.BackgroundRunnableTask; +import io.evitadb.core.async.DelayedAsyncTask; import io.evitadb.core.async.Scheduler; import io.evitadb.core.query.algebra.Formula; import io.evitadb.core.query.extraResult.CacheableEvitaResponseExtraResultComputer; @@ -57,8 +57,18 @@ * @see CacheSupervisor for more information */ public class HeapMemoryCacheSupervisor implements CacheSupervisor { + /** + * Anteroom with cache adepts. + */ private final CacheAnteroom cacheAnteroom; + /** + * Eden cache. + */ private final CacheEden cacheEden; + /** + * Task that reevaluates the cache contents. + */ + private final DelayedAsyncTask reevaluationTask; public HeapMemoryCacheSupervisor(@Nonnull CacheOptions cacheOptions, @Nonnull Scheduler scheduler) { this.cacheEden = new CacheEden( @@ -74,12 +84,19 @@ public HeapMemoryCacheSupervisor(@Nonnull CacheOptions cacheOptions, @Nonnull Sc ); // initialize function that will frequently evaluate contents of the cache, discard unused entries and introduce // new ones from the CacheAnteroom - scheduler.scheduleAtFixedRate( - new BackgroundRunnableTask("Eden cache gatekeeper", this.cacheAnteroom::evaluateAssociatesSynchronouslyIfNoAdeptsWait), - 0, + this.reevaluationTask = new DelayedAsyncTask( + null, + "Eden cache timed reevaluation", + scheduler, + () -> { + this.cacheAnteroom.evaluateAssociatesSynchronouslyIfNoAdeptsWait(); + // plan next reevaluation in standard interval + return 0L; + }, cacheOptions.reevaluateEachSeconds(), TimeUnit.SECONDS ); + this.reevaluationTask.schedule(); } @Nonnull diff --git a/evita_engine/src/main/java/io/evitadb/core/file/ExportFileService.java b/evita_engine/src/main/java/io/evitadb/core/file/ExportFileService.java new file mode 100644 index 000000000..47b4b836d --- /dev/null +++ b/evita_engine/src/main/java/io/evitadb/core/file/ExportFileService.java @@ -0,0 +1,345 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.evitadb.core.file; + +import io.evitadb.api.configuration.StorageOptions; +import io.evitadb.api.exception.FileForFetchNotFoundException; +import io.evitadb.api.file.FileForFetch; +import io.evitadb.dataType.PaginatedList; +import io.evitadb.exception.UnexpectedIOException; +import io.evitadb.utils.Assert; +import io.evitadb.utils.FileUtils; +import io.evitadb.utils.UUIDUtil; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.io.Closeable; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardOpenOption; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.locks.ReentrantLock; +import java.util.function.Supplier; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static java.util.Optional.empty; +import static java.util.Optional.of; + +/** + * Export file service manages files that represents backups or some kind of recordings created by the database engine. + * All is stored in single directory and for each data file there is metadata file with the same name and .metadata + * extension that contains information about the file. This could be quite slow for large number of + * files, but it's easy to start with. If performance becomes an issue, we can switch to more efficient approach + * later - probably some kind of infrastructural database. Because we want to support clustered solutions we would have + * to move to S3 storage or similar anyway. + * + * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 + */ +public class ExportFileService { + /** + * Storage options. + */ + private final StorageOptions storageOptions; + /** + * Lock for the files list. + */ + private final ReentrantLock lock = new ReentrantLock(); + /** + * Cached list of files to fetch. + */ + private List files; + + public ExportFileService(@Nonnull StorageOptions storageOptions) { + this.storageOptions = storageOptions; + this.initFilesForFetch(); + } + + /** + * Returns paginated list of files to fetch. Optionally filtered by origin. + * + * @param page requested page + * @param pageSize requested page size + * @param origin optional origin filter + * @return paginated list of files to fetch + */ + @Nonnull + public PaginatedList listFilesToFetch(int page, int pageSize, @Nullable String origin) { + final List filePage = this.files.stream() + .filter(it -> origin == null || (it.origin() != null && Arrays.asList(it.origin()).contains(origin))) + .skip(PaginatedList.getFirstItemNumberForPage(page, pageSize)) + .limit(pageSize) + .toList(); + return new PaginatedList<>( + page, pageSize, + this.files.size(), + filePage + ); + } + + /** + * Method creates new file for fetch and stores it in the export directory. + * + * @param fileName name of the file + * @param description optional description of the file + * @param contentType MIME type of the file + * @param origin optional origin of the file + * @return input stream to write the file + */ + @Nonnull + public ExportFileHandle storeFile( + @Nonnull String fileName, + @Nullable String description, + @Nonnull String contentType, + @Nullable String origin + ) { + final UUID fileId = UUIDUtil.randomUUID(); + final String finalFileName = fileId + FileUtils.getFileExtension(fileName).map(it -> "." + it).orElse(""); + final Path finalFilePath = storageOptions.exportDirectory().resolve(finalFileName); + try { + if (!storageOptions.exportDirectory().toFile().exists()) { + Assert.isPremiseValid( + storageOptions.exportDirectory().toFile().mkdirs(), + () -> new UnexpectedIOException( + "Failed to create directory: " + storageOptions.exportDirectory(), + "Failed to create directory." + ) + ); + } + Assert.isPremiseValid( + finalFilePath.toFile().createNewFile(), + () -> new UnexpectedIOException( + "Failed to create file: " + finalFilePath, + "Failed to create file." + ) + ); + final CompletableFuture fileForFetchCompletableFuture = new CompletableFuture<>(); + return new ExportFileHandle( + fileForFetchCompletableFuture, + new WriteMetadataOnCloseOutputStream( + finalFilePath, + fileForFetchCompletableFuture, + () -> { + lock.lock(); + try { + final FileForFetch fileForFetch = new FileForFetch( + fileId, + fileName, + finalFilePath, + description, + contentType, + Files.size(finalFilePath), + OffsetDateTime.now(), + origin == null ? null : Arrays.stream(origin.split(",")) + .map(String::trim) + .toArray(String[]::new) + ); + Files.write( + storageOptions.exportDirectory().resolve(fileId + FileForFetch.METADATA_EXTENSION), + fileForFetch.toLines(), + StandardCharsets.UTF_8, + StandardOpenOption.CREATE_NEW + ); + this.files.add(0, fileForFetch); + return fileForFetch; + } catch (IOException e) { + throw new UnexpectedIOException( + "Failed to write metadata file: " + e.getMessage(), + "Failed to write metadata file." + ); + } finally { + lock.unlock(); + } + } + ) + ); + } catch (IOException e) { + throw new UnexpectedIOException( + "Failed to store file: " + finalFilePath, + "Failed to store file.", + e + ); + } + } + + /** + * Returns file to fetch by its ID or throws exception if the file is not found. + * + * @param fileId file ID + * @return file to fetch + * @throws FileForFetchNotFoundException if the file is not found + */ + @Nonnull + public FileForFetch getFile(@Nonnull UUID fileId) { + return this.files.stream() + .filter(it -> it.fileId().equals(fileId)) + .findFirst() + .orElseThrow(() -> new FileForFetchNotFoundException(fileId)); + } + + /** + * Copies contents of the file to the output stream or throws exception if the file is not found. + * + * @param fileId file ID + * @param outputStream output stream + * @throws FileForFetchNotFoundException if the file is not found + */ + public void fetchFile(@Nonnull UUID fileId, @Nonnull OutputStream outputStream) { + try (outputStream) { + final FileForFetch file = getFile(fileId); + Files.copy(file.path(), outputStream); + outputStream.flush(); + } catch (IOException e) { + throw new UnexpectedIOException( + "Failed to copy the file to the output stream: " + e.getMessage(), + "Failed to copy the file to the output stream.", + e + ); + } + } + + /** + * Deletes the file by its ID or throws exception if the file is not found. + * + * @param fileId file ID + * @throws FileForFetchNotFoundException if the file is not found + * @throws UnexpectedIOException if the file cannot be deleted + */ + public void deleteFile(@Nonnull UUID fileId) { + lock.lock(); + try { + final FileForFetch file = getFile(fileId); + Files.delete(file.metadataPath()); + Files.delete(file.path()); + this.files.remove(file); + } catch (IOException e) { + throw new UnexpectedIOException( + "Failed to delete file: " + e.getMessage(), + "Failed to delete the file.", + e + ); + } finally { + lock.unlock(); + } + } + + /** + * Parses metadata file and creates {@link FileForFetch} instance. + * + * @param metadataFile Path to the metadata file. + * @return {@link FileForFetch} instance or empty if the file is not valid. + */ + @Nonnull + private Optional toFileForFetch(@Nonnull Path metadataFile) { + try { + final List metadataLines = Files.readAllLines(metadataFile, StandardCharsets.UTF_8); + return of(FileForFetch.fromLines(metadataLines, storageOptions.exportDirectory())); + } catch (Exception e) { + return empty(); + } + } + + /** + * Method refreshes the list of files to fetch. + */ + private void initFilesForFetch() { + try { + lock.lock(); + if (this.storageOptions.exportDirectory().toFile().exists()) { + try (final Stream fileStream = Files.list(this.storageOptions.exportDirectory())) { + this.files = fileStream + .filter(it -> !it.toFile().getName().endsWith(FileForFetch.METADATA_EXTENSION)) + .map(this::toFileForFetch) + .flatMap(Optional::stream) + .sorted(Comparator.comparing(FileForFetch::created).reversed()) + .collect(Collectors.toCollection(ArrayList::new)); + } catch (IOException e) { + throw new UnexpectedIOException( + "Failed to read the contents of the folder: " + e.getMessage(), + "Failed to read the contents of the folder.", + e + ); + } + } else { + this.files = new ArrayList<>(16); + } + } finally { + lock.unlock(); + } + } + + /** + * Record that contains output stream the export file can be written to and future that will be completed when the + * file is written. + * + * @param fileForFetchFuture Future that will be completed when the file is written. + * @param outputStream Output stream the file can be written to. + */ + public record ExportFileHandle( + @Nonnull CompletableFuture fileForFetchFuture, + @Nonnull OutputStream outputStream + ) { + } + + /** + * Thin wrapper around {@link FileOutputStream} that writes metadata file on close. + */ + private final static class WriteMetadataOnCloseOutputStream extends FileOutputStream implements Closeable { + private final CompletableFuture fileForFetchFuture; + private final Supplier onClose; + + public WriteMetadataOnCloseOutputStream( + @Nonnull Path finalFilePath, + @Nonnull CompletableFuture fileForFetchFuture, + @Nonnull Supplier onClose + ) throws FileNotFoundException { + super(finalFilePath.toFile()); + this.fileForFetchFuture = fileForFetchFuture; + this.onClose = onClose; + } + + @Override + public void close() throws IOException { + try { + super.close(); + } finally { + this.fileForFetchFuture.complete(onClose.get()); + } + } + + } + +} diff --git a/evita_engine/src/main/java/io/evitadb/store/spi/CatalogPersistenceService.java b/evita_engine/src/main/java/io/evitadb/store/spi/CatalogPersistenceService.java index 9a364b871..72dc40535 100644 --- a/evita_engine/src/main/java/io/evitadb/store/spi/CatalogPersistenceService.java +++ b/evita_engine/src/main/java/io/evitadb/store/spi/CatalogPersistenceService.java @@ -28,12 +28,14 @@ import io.evitadb.api.EntityCollectionContract; import io.evitadb.api.exception.EntityTypeAlreadyPresentInCatalogSchemaException; import io.evitadb.api.exception.TemporalDataNotAvailableException; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.requestResponse.mutation.Mutation; import io.evitadb.api.requestResponse.schema.dto.CatalogSchema; import io.evitadb.api.requestResponse.system.CatalogVersion; import io.evitadb.api.requestResponse.system.CatalogVersionDescriptor; import io.evitadb.api.requestResponse.system.TimeFlow; import io.evitadb.api.requestResponse.transaction.TransactionMutation; +import io.evitadb.api.task.Task; import io.evitadb.core.Catalog; import io.evitadb.core.EntityCollection; import io.evitadb.core.buffer.DataStoreIndexChanges; @@ -55,14 +57,12 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.nio.file.Path; import java.time.OffsetDateTime; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; -import java.util.function.IntConsumer; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Stream; @@ -484,17 +484,15 @@ void deleteEntityCollection( /** * Creates a backup of the specified catalog and returns an InputStream to read the binary data of the zip file. * - * @param id the id of the backup process * @param pastMoment leave null for creating backup for actual dataset, or specify past moment to create backup for * the dataset as it was at that moment * @param includingWAL if true, the backup will include the Write-Ahead Log (WAL) file and when the catalog is * restored, it'll replay the WAL contents locally to bring the catalog to the current state - * @param progressUpdater a consumer that will be called with the progress of the backup operation * @return path to the file where the backup was created * @throws TemporalDataNotAvailableException when the past data is not available */ @Nonnull - Path backup(@Nonnull UUID id, @Nullable OffsetDateTime pastMoment, boolean includingWAL, @Nonnull IntConsumer progressUpdater) throws TemporalDataNotAvailableException; + Task createBackupTask(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException; /** * Method closes this persistence service and also all {@link EntityCollectionPersistenceService} that were created diff --git a/evita_engine/src/main/java/io/evitadb/store/spi/CatalogPersistenceServiceFactory.java b/evita_engine/src/main/java/io/evitadb/store/spi/CatalogPersistenceServiceFactory.java index 46fb5ef76..1e2ffdae5 100644 --- a/evita_engine/src/main/java/io/evitadb/store/spi/CatalogPersistenceServiceFactory.java +++ b/evita_engine/src/main/java/io/evitadb/store/spi/CatalogPersistenceServiceFactory.java @@ -26,14 +26,14 @@ import io.evitadb.api.CatalogContract; import io.evitadb.api.configuration.StorageOptions; import io.evitadb.api.configuration.TransactionOptions; -import io.evitadb.core.async.BackgroundCallableTask; +import io.evitadb.core.async.ClientRunnableTask; import io.evitadb.core.async.Scheduler; +import io.evitadb.core.file.ExportFileService; import io.evitadb.store.exception.InvalidStoragePathException; import io.evitadb.store.spi.exception.DirectoryNotEmptyException; import javax.annotation.Nonnull; import java.io.InputStream; -import java.nio.file.Path; /** * This interface and layer of abstraction was introduced because we want to split data storage / serialization and @@ -69,7 +69,8 @@ CatalogPersistenceService createNew( @Nonnull String catalogName, @Nonnull StorageOptions storageOptions, @Nonnull TransactionOptions transactionOptions, - @Nonnull Scheduler scheduler + @Nonnull Scheduler scheduler, + @Nonnull ExportFileService exportFileService ); /** @@ -82,7 +83,8 @@ CatalogPersistenceService load( @Nonnull String catalogName, @Nonnull StorageOptions storageOptions, @Nonnull TransactionOptions transactionOptions, - @Nonnull Scheduler scheduler + @Nonnull Scheduler scheduler, + @Nonnull ExportFileService exportFileService ); /** @@ -98,7 +100,7 @@ CatalogPersistenceService load( * @throws InvalidStoragePathException if the storage path is invalid */ @Nonnull - BackgroundCallableTask restoreCatalogTo( + ClientRunnableTask restoreCatalogTo( @Nonnull String catalogName, @Nonnull StorageOptions storageOptions, long totalBytesExpected, diff --git a/evita_engine/src/main/java/io/evitadb/store/spi/StoragePartPersistenceService.java b/evita_engine/src/main/java/io/evitadb/store/spi/StoragePartPersistenceService.java index ed5d045b7..9cf02bf3f 100644 --- a/evita_engine/src/main/java/io/evitadb/store/spi/StoragePartPersistenceService.java +++ b/evita_engine/src/main/java/io/evitadb/store/spi/StoragePartPersistenceService.java @@ -32,6 +32,7 @@ import java.io.Closeable; import java.io.OutputStream; import java.util.UUID; +import java.util.function.IntConsumer; import java.util.stream.Stream; /** @@ -124,6 +125,15 @@ public interface StoragePartPersistenceService extends Closeable { @Nonnull Stream getEntryStream(@Nonnull Class containerType); + /** + * Counts the number of storage parts of the specified container type. + * + * @param catalogVersion the version of the catalog the value is read from + * @param the type of the storage part container + * @return the number of storage parts of the specified container type + */ + int countStorageParts(long catalogVersion); + /** * Counts the number of storage parts of the specified container type. * @@ -199,6 +209,7 @@ public interface StoragePartPersistenceService extends Closeable { PersistentStorageDescriptor copySnapshotTo( long catalogVersion, @Nonnull OutputStream outputStream, + @Nullable IntConsumer progressConsumer, @Nullable StoragePart... updatedStorageParts ); diff --git a/evita_engine/src/main/java/module-info.java b/evita_engine/src/main/java/module-info.java index 3c4403785..b15d64a8d 100644 --- a/evita_engine/src/main/java/module-info.java +++ b/evita_engine/src/main/java/module-info.java @@ -35,6 +35,7 @@ exports io.evitadb.core.cache; exports io.evitadb.core.cache.model; exports io.evitadb.core.cache.payload; + exports io.evitadb.core.file; exports io.evitadb.core.metric.event; exports io.evitadb.core.metric.event.cache; exports io.evitadb.core.metric.event.query; diff --git a/evita_external_api/evita_external_api_grpc/client/src/main/java/io/evitadb/driver/EvitaClient.java b/evita_external_api/evita_external_api_grpc/client/src/main/java/io/evitadb/driver/EvitaClient.java index 5b226285a..139d0b2bd 100644 --- a/evita_external_api/evita_external_api_grpc/client/src/main/java/io/evitadb/driver/EvitaClient.java +++ b/evita_external_api/evita_external_api_grpc/client/src/main/java/io/evitadb/driver/EvitaClient.java @@ -30,16 +30,17 @@ import io.evitadb.api.SessionTraits; import io.evitadb.api.SessionTraits.SessionFlags; import io.evitadb.api.TransactionContract.CommitBehavior; +import io.evitadb.api.exception.FileForFetchNotFoundException; import io.evitadb.api.exception.InstanceTerminatedException; import io.evitadb.api.exception.TemporalDataNotAvailableException; import io.evitadb.api.exception.TransactionException; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.requestResponse.schema.CatalogSchemaEditor.CatalogSchemaBuilder; import io.evitadb.api.requestResponse.schema.EntitySchemaContract; import io.evitadb.api.requestResponse.schema.mutation.TopLevelCatalogSchemaMutation; import io.evitadb.api.requestResponse.schema.mutation.catalog.CreateCatalogSchemaMutation; import io.evitadb.api.requestResponse.system.SystemStatus; -import io.evitadb.api.task.JobStatus; -import io.evitadb.api.task.ProgressiveCompletableFuture; +import io.evitadb.api.task.TaskStatus; import io.evitadb.dataType.PaginatedList; import io.evitadb.driver.config.EvitaClientConfiguration; import io.evitadb.driver.exception.EvitaClientTimedOutException; @@ -85,7 +86,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.nio.ByteBuffer; -import java.nio.file.Path; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateEncodingException; import java.time.Duration; @@ -668,7 +668,7 @@ public CompletableFuture updateCatalogAsync( @Nonnull @Override - public ProgressiveCompletableFuture backupCatalog( + public CompletableFuture backupCatalog( @Nonnull String catalogName, @Nullable OffsetDateTime pastMoment, boolean includingWAL @@ -684,7 +684,7 @@ public ProgressiveCompletableFuture backupCatalog( @Nonnull @Override - public ProgressiveCompletableFuture restoreCatalog( + public CompletableFuture restoreCatalog( @Nonnull String catalogName, long totalBytesExpected, @Nonnull InputStream inputStream @@ -770,26 +770,45 @@ public void onCompleted() { @Nonnull @Override - public PaginatedList> getJobStatuses(int page, int pageSize) { + public CompletableFuture restoreCatalog(@Nonnull String catalogName, @Nonnull UUID fileId) throws FileForFetchNotFoundException { /* TODO JNO - Implement me */ return null; } @Nonnull @Override - public Optional> getJobStatus(@Nonnull UUID jobId) { + public PaginatedList> listTaskStatuses(int page, int pageSize) { + /* TODO JNO - Implement me */ + return null; + } + + @Nonnull + @Override + public Optional> getTaskStatus(@Nonnull UUID jobId) { /* TODO JNO - Implement me */ return Optional.empty(); } @Override - public boolean cancelJob(@Nonnull UUID jobId) { + public boolean cancelTask(@Nonnull UUID jobId) { /* TODO JNO - Implement me */ return false; } + @Nonnull + @Override + public PaginatedList listFilesToFetch(int page, int pageSize, @Nullable String origin) { + /* TODO JNO - Implement me */ + return null; + } + + @Override + public void fetchFile(@Nonnull UUID fileId, @Nonnull OutputStream outputStream) throws FileForFetchNotFoundException { + /* TODO JNO - Implement me */ + } + @Override - public void writeFile(@Nonnull UUID fileId, @Nonnull OutputStream outputStream) { + public void deleteFile(@Nonnull UUID fileId) throws FileForFetchNotFoundException { /* TODO JNO - Implement me */ } diff --git a/evita_external_api/evita_external_api_grpc/client/src/main/java/io/evitadb/driver/EvitaClientSession.java b/evita_external_api/evita_external_api_grpc/client/src/main/java/io/evitadb/driver/EvitaClientSession.java index a88f4666c..c6e4f0191 100644 --- a/evita_external_api/evita_external_api_grpc/client/src/main/java/io/evitadb/driver/EvitaClientSession.java +++ b/evita_external_api/evita_external_api_grpc/client/src/main/java/io/evitadb/driver/EvitaClientSession.java @@ -33,6 +33,7 @@ import io.evitadb.api.SessionTraits; import io.evitadb.api.TransactionContract.CommitBehavior; import io.evitadb.api.exception.*; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.proxy.ProxyFactory; import io.evitadb.api.proxy.SealedEntityProxy; import io.evitadb.api.proxy.SealedEntityReferenceProxy; @@ -74,7 +75,6 @@ import io.evitadb.api.requestResponse.schema.dto.EntitySchemaProvider; import io.evitadb.api.requestResponse.schema.mutation.LocalCatalogSchemaMutation; import io.evitadb.api.requestResponse.schema.mutation.catalog.ModifyEntitySchemaMutation; -import io.evitadb.api.task.ProgressiveCompletableFuture; import io.evitadb.dataType.DataChunk; import io.evitadb.driver.config.EvitaClientConfiguration; import io.evitadb.driver.exception.EvitaClientServerCallException; @@ -115,7 +115,6 @@ import javax.annotation.Nullable; import javax.annotation.concurrent.NotThreadSafe; import java.io.Serializable; -import java.nio.file.Path; import java.time.OffsetDateTime; import java.util.*; import java.util.concurrent.CancellationException; @@ -1275,7 +1274,7 @@ public SealedEntity[] deleteSealedEntitiesAndReturnBodies(@Nonnull Query query) @Nonnull @Override - public ProgressiveCompletableFuture backupCatalog(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException { + public CompletableFuture backupCatalog(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException { assertActive(); final CompletableFuture result = new CompletableFuture<>(); executeWithAsyncEvitaSessionService( diff --git a/evita_external_api/evita_external_api_grpc/server/src/main/java/io/evitadb/externalApi/grpc/services/EvitaSessionService.java b/evita_external_api/evita_external_api_grpc/server/src/main/java/io/evitadb/externalApi/grpc/services/EvitaSessionService.java index 658177e39..7f6956828 100644 --- a/evita_external_api/evita_external_api_grpc/server/src/main/java/io/evitadb/externalApi/grpc/services/EvitaSessionService.java +++ b/evita_external_api/evita_external_api_grpc/server/src/main/java/io/evitadb/externalApi/grpc/services/EvitaSessionService.java @@ -23,7 +23,6 @@ package io.evitadb.externalApi.grpc.services; -import com.google.protobuf.ByteString; import com.google.protobuf.Empty; import io.evitadb.api.CatalogContract; import io.evitadb.api.CatalogState; @@ -274,10 +273,11 @@ public void backupCatalog(Empty request, StreamObserver getRestoreCata return getRestoreCatalogMethod; } + private static volatile io.grpc.MethodDescriptor getRestoreCatalogFromServerFileMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "RestoreCatalogFromServerFile", + requestType = io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest.class, + responseType = io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) + public static io.grpc.MethodDescriptor getRestoreCatalogFromServerFileMethod() { + io.grpc.MethodDescriptor getRestoreCatalogFromServerFileMethod; + if ((getRestoreCatalogFromServerFileMethod = EvitaServiceGrpc.getRestoreCatalogFromServerFileMethod) == null) { + synchronized (EvitaServiceGrpc.class) { + if ((getRestoreCatalogFromServerFileMethod = EvitaServiceGrpc.getRestoreCatalogFromServerFileMethod) == null) { + EvitaServiceGrpc.getRestoreCatalogFromServerFileMethod = getRestoreCatalogFromServerFileMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "RestoreCatalogFromServerFile")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogResponse.getDefaultInstance())) + .setSchemaDescriptor(new EvitaServiceMethodDescriptorSupplier("RestoreCatalogFromServerFile")) + .build(); + } + } + } + return getRestoreCatalogFromServerFileMethod; + } + private static volatile io.grpc.MethodDescriptor getDeleteCatalogIfExistsMethod; @@ -443,6 +474,161 @@ com.google.protobuf.Empty> getUpdateMethod() { return getUpdateMethod; } + private static volatile io.grpc.MethodDescriptor getListTaskStatusesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListTaskStatuses", + requestType = io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest.class, + responseType = io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getListTaskStatusesMethod() { + io.grpc.MethodDescriptor getListTaskStatusesMethod; + if ((getListTaskStatusesMethod = EvitaServiceGrpc.getListTaskStatusesMethod) == null) { + synchronized (EvitaServiceGrpc.class) { + if ((getListTaskStatusesMethod = EvitaServiceGrpc.getListTaskStatusesMethod) == null) { + EvitaServiceGrpc.getListTaskStatusesMethod = getListTaskStatusesMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListTaskStatuses")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse.getDefaultInstance())) + .setSchemaDescriptor(new EvitaServiceMethodDescriptorSupplier("ListTaskStatuses")) + .build(); + } + } + } + return getListTaskStatusesMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetTaskStatusMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetTaskStatus", + requestType = io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest.class, + responseType = io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetTaskStatusMethod() { + io.grpc.MethodDescriptor getGetTaskStatusMethod; + if ((getGetTaskStatusMethod = EvitaServiceGrpc.getGetTaskStatusMethod) == null) { + synchronized (EvitaServiceGrpc.class) { + if ((getGetTaskStatusMethod = EvitaServiceGrpc.getGetTaskStatusMethod) == null) { + EvitaServiceGrpc.getGetTaskStatusMethod = getGetTaskStatusMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetTaskStatus")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse.getDefaultInstance())) + .setSchemaDescriptor(new EvitaServiceMethodDescriptorSupplier("GetTaskStatus")) + .build(); + } + } + } + return getGetTaskStatusMethod; + } + + private static volatile io.grpc.MethodDescriptor getCancelTaskMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CancelTask", + requestType = io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest.class, + responseType = io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getCancelTaskMethod() { + io.grpc.MethodDescriptor getCancelTaskMethod; + if ((getCancelTaskMethod = EvitaServiceGrpc.getCancelTaskMethod) == null) { + synchronized (EvitaServiceGrpc.class) { + if ((getCancelTaskMethod = EvitaServiceGrpc.getCancelTaskMethod) == null) { + EvitaServiceGrpc.getCancelTaskMethod = getCancelTaskMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CancelTask")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse.getDefaultInstance())) + .setSchemaDescriptor(new EvitaServiceMethodDescriptorSupplier("CancelTask")) + .build(); + } + } + } + return getCancelTaskMethod; + } + + private static volatile io.grpc.MethodDescriptor getListFilesToFetchMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListFilesToFetch", + requestType = io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest.class, + responseType = io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getListFilesToFetchMethod() { + io.grpc.MethodDescriptor getListFilesToFetchMethod; + if ((getListFilesToFetchMethod = EvitaServiceGrpc.getListFilesToFetchMethod) == null) { + synchronized (EvitaServiceGrpc.class) { + if ((getListFilesToFetchMethod = EvitaServiceGrpc.getListFilesToFetchMethod) == null) { + EvitaServiceGrpc.getListFilesToFetchMethod = getListFilesToFetchMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListFilesToFetch")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse.getDefaultInstance())) + .setSchemaDescriptor(new EvitaServiceMethodDescriptorSupplier("ListFilesToFetch")) + .build(); + } + } + } + return getListFilesToFetchMethod; + } + + private static volatile io.grpc.MethodDescriptor getFetchFileMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "FetchFile", + requestType = io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest.class, + responseType = io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getFetchFileMethod() { + io.grpc.MethodDescriptor getFetchFileMethod; + if ((getFetchFileMethod = EvitaServiceGrpc.getFetchFileMethod) == null) { + synchronized (EvitaServiceGrpc.class) { + if ((getFetchFileMethod = EvitaServiceGrpc.getFetchFileMethod) == null) { + EvitaServiceGrpc.getFetchFileMethod = getFetchFileMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "FetchFile")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse.getDefaultInstance())) + .setSchemaDescriptor(new EvitaServiceMethodDescriptorSupplier("FetchFile")) + .build(); + } + } + } + return getFetchFileMethod; + } + /** * Creates a new async stub that supports all call types for the service */ @@ -605,6 +791,16 @@ public io.grpc.stub.StreamObserver + * Procedure used to restore a catalog from backup. + * + */ + public io.grpc.stub.StreamObserver restoreCatalogFromServerFile( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getRestoreCatalogFromServerFileMethod(), responseObserver); + } + /** *
      * Procedure used to delete an existing catalog.
@@ -625,6 +821,56 @@ public void update(io.evitadb.externalApi.grpc.generated.GrpcUpdateEvitaRequest
       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUpdateMethod(), responseObserver);
     }
 
+    /**
+     * 
+     * Procedure used to get listing of task statuses.
+     * 
+ */ + public void listTaskStatuses(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListTaskStatusesMethod(), responseObserver); + } + + /** + *
+     * Procedure used to get detail of particular task status.
+     * 
+ */ + public void getTaskStatus(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetTaskStatusMethod(), responseObserver); + } + + /** + *
+     * Procedure used to cancel queued or running task.
+     * 
+ */ + public void cancelTask(io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCancelTaskMethod(), responseObserver); + } + + /** + *
+     * Procedure used to get listing of files available for fetching.
+     * 
+ */ + public void listFilesToFetch(io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListFilesToFetchMethod(), responseObserver); + } + + /** + *
+     * Procedure used to get file contents
+     * 
+ */ + public void fetchFile(io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getFetchFileMethod(), responseObserver); + } + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) .addMethod( @@ -704,6 +950,13 @@ public void update(io.evitadb.externalApi.grpc.generated.GrpcUpdateEvitaRequest io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogRequest, io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogResponse>( this, METHODID_RESTORE_CATALOG))) + .addMethod( + getRestoreCatalogFromServerFileMethod(), + io.grpc.stub.ServerCalls.asyncClientStreamingCall( + new MethodHandlers< + io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest, + io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogResponse>( + this, METHODID_RESTORE_CATALOG_FROM_SERVER_FILE))) .addMethod( getDeleteCatalogIfExistsMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -718,6 +971,41 @@ public void update(io.evitadb.externalApi.grpc.generated.GrpcUpdateEvitaRequest io.evitadb.externalApi.grpc.generated.GrpcUpdateEvitaRequest, com.google.protobuf.Empty>( this, METHODID_UPDATE))) + .addMethod( + getListTaskStatusesMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest, + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse>( + this, METHODID_LIST_TASK_STATUSES))) + .addMethod( + getGetTaskStatusMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest, + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse>( + this, METHODID_GET_TASK_STATUS))) + .addMethod( + getCancelTaskMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest, + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse>( + this, METHODID_CANCEL_TASK))) + .addMethod( + getListFilesToFetchMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest, + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse>( + this, METHODID_LIST_FILES_TO_FETCH))) + .addMethod( + getFetchFileMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest, + io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse>( + this, METHODID_FETCH_FILE))) .build(); } } @@ -861,6 +1149,17 @@ public io.grpc.stub.StreamObserver + * Procedure used to restore a catalog from backup. + *
+ */ + public io.grpc.stub.StreamObserver restoreCatalogFromServerFile( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ClientCalls.asyncClientStreamingCall( + getChannel().newCall(getRestoreCatalogFromServerFileMethod(), getCallOptions()), responseObserver); + } + /** *
      * Procedure used to delete an existing catalog.
@@ -882,6 +1181,61 @@ public void update(io.evitadb.externalApi.grpc.generated.GrpcUpdateEvitaRequest
       io.grpc.stub.ClientCalls.asyncUnaryCall(
           getChannel().newCall(getUpdateMethod(), getCallOptions()), request, responseObserver);
     }
+
+    /**
+     * 
+     * Procedure used to get listing of task statuses.
+     * 
+ */ + public void listTaskStatuses(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListTaskStatusesMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Procedure used to get detail of particular task status.
+     * 
+ */ + public void getTaskStatus(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetTaskStatusMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Procedure used to cancel queued or running task.
+     * 
+ */ + public void cancelTask(io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCancelTaskMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Procedure used to get listing of files available for fetching.
+     * 
+ */ + public void listFilesToFetch(io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListFilesToFetchMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Procedure used to get file contents
+     * 
+ */ + public void fetchFile(io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getFetchFileMethod(), getCallOptions()), request, responseObserver); + } } /** @@ -1021,6 +1375,56 @@ public com.google.protobuf.Empty update(io.evitadb.externalApi.grpc.generated.Gr return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getUpdateMethod(), getCallOptions(), request); } + + /** + *
+     * Procedure used to get listing of task statuses.
+     * 
+ */ + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse listTaskStatuses(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListTaskStatusesMethod(), getCallOptions(), request); + } + + /** + *
+     * Procedure used to get detail of particular task status.
+     * 
+ */ + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse getTaskStatus(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetTaskStatusMethod(), getCallOptions(), request); + } + + /** + *
+     * Procedure used to cancel queued or running task.
+     * 
+ */ + public io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse cancelTask(io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCancelTaskMethod(), getCallOptions(), request); + } + + /** + *
+     * Procedure used to get listing of files available for fetching.
+     * 
+ */ + public io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse listFilesToFetch(io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListFilesToFetchMethod(), getCallOptions(), request); + } + + /** + *
+     * Procedure used to get file contents
+     * 
+ */ + public io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse fetchFile(io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getFetchFileMethod(), getCallOptions(), request); + } } /** @@ -1172,6 +1576,61 @@ public com.google.common.util.concurrent.ListenableFuture + * Procedure used to get listing of task statuses. + *
+ */ + public com.google.common.util.concurrent.ListenableFuture listTaskStatuses( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListTaskStatusesMethod(), getCallOptions()), request); + } + + /** + *
+     * Procedure used to get detail of particular task status.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getTaskStatus( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetTaskStatusMethod(), getCallOptions()), request); + } + + /** + *
+     * Procedure used to cancel queued or running task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture cancelTask( + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCancelTaskMethod(), getCallOptions()), request); + } + + /** + *
+     * Procedure used to get listing of files available for fetching.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture listFilesToFetch( + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListFilesToFetchMethod(), getCallOptions()), request); + } + + /** + *
+     * Procedure used to get file contents
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture fetchFile( + io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getFetchFileMethod(), getCallOptions()), request); + } } private static final int METHODID_SERVER_STATUS = 0; @@ -1186,7 +1645,13 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -1253,6 +1718,26 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv serviceImpl.update((io.evitadb.externalApi.grpc.generated.GrpcUpdateEvitaRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_LIST_TASK_STATUSES: + serviceImpl.listTaskStatuses((io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_TASK_STATUS: + serviceImpl.getTaskStatus((io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CANCEL_TASK: + serviceImpl.cancelTask((io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_FILES_TO_FETCH: + serviceImpl.listFilesToFetch((io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_FETCH_FILE: + serviceImpl.fetchFile((io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; default: throw new AssertionError(); } @@ -1266,6 +1751,9 @@ public io.grpc.stub.StreamObserver invoke( case METHODID_RESTORE_CATALOG: return (io.grpc.stub.StreamObserver) serviceImpl.restoreCatalog( (io.grpc.stub.StreamObserver) responseObserver); + case METHODID_RESTORE_CATALOG_FROM_SERVER_FILE: + return (io.grpc.stub.StreamObserver) serviceImpl.restoreCatalogFromServerFile( + (io.grpc.stub.StreamObserver) responseObserver); default: throw new AssertionError(); } @@ -1328,8 +1816,14 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getRenameCatalogMethod()) .addMethod(getReplaceCatalogMethod()) .addMethod(getRestoreCatalogMethod()) + .addMethod(getRestoreCatalogFromServerFileMethod()) .addMethod(getDeleteCatalogIfExistsMethod()) .addMethod(getUpdateMethod()) + .addMethod(getListTaskStatusesMethod()) + .addMethod(getGetTaskStatusMethod()) + .addMethod(getCancelTaskMethod()) + .addMethod(getListFilesToFetchMethod()) + .addMethod(getFetchFileMethod()) .build(); } } diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcBackupCatalogResponse.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcBackupCatalogResponse.java index b3d290119..4b2a5a5c3 100644 --- a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcBackupCatalogResponse.java +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcBackupCatalogResponse.java @@ -43,7 +43,6 @@ private GrpcBackupCatalogResponse(com.google.protobuf.GeneratedMessageV3.Builder super(builder); } private GrpcBackupCatalogResponse() { - backupFile_ = com.google.protobuf.ByteString.EMPTY; } @java.lang.Override @@ -77,8 +76,16 @@ private GrpcBackupCatalogResponse( done = true; break; case 10: { + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder subBuilder = null; + if (taskId_ != null) { + subBuilder = taskId_.toBuilder(); + } + taskId_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcUuid.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(taskId_); + taskId_ = subBuilder.buildPartial(); + } - backupFile_ = input.readBytes(); break; } default: { @@ -113,19 +120,42 @@ private GrpcBackupCatalogResponse( io.evitadb.externalApi.grpc.generated.GrpcBackupCatalogResponse.class, io.evitadb.externalApi.grpc.generated.GrpcBackupCatalogResponse.Builder.class); } - public static final int BACKUPFILE_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString backupFile_; + public static final int TASKID_FIELD_NUMBER = 1; + private io.evitadb.externalApi.grpc.generated.GrpcUuid taskId_; /** *
-   * Binary contents of the backup file.
+   * the id of the task that is used to backup the catalog and getting its progress
    * 
* - * bytes backupFile = 1; - * @return The backupFile. + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return Whether the taskId field is set. */ @java.lang.Override - public com.google.protobuf.ByteString getBackupFile() { - return backupFile_; + public boolean hasTaskId() { + return taskId_ != null; + } + /** + *
+   * the id of the task that is used to backup the catalog and getting its progress
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return The taskId. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId() { + return taskId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } + /** + *
+   * the id of the task that is used to backup the catalog and getting its progress
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder() { + return getTaskId(); } private byte memoizedIsInitialized = -1; @@ -142,8 +172,8 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!backupFile_.isEmpty()) { - output.writeBytes(1, backupFile_); + if (taskId_ != null) { + output.writeMessage(1, getTaskId()); } unknownFields.writeTo(output); } @@ -154,9 +184,9 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!backupFile_.isEmpty()) { + if (taskId_ != null) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, backupFile_); + .computeMessageSize(1, getTaskId()); } size += unknownFields.getSerializedSize(); memoizedSize = size; @@ -173,8 +203,11 @@ public boolean equals(final java.lang.Object obj) { } io.evitadb.externalApi.grpc.generated.GrpcBackupCatalogResponse other = (io.evitadb.externalApi.grpc.generated.GrpcBackupCatalogResponse) obj; - if (!getBackupFile() - .equals(other.getBackupFile())) return false; + if (hasTaskId() != other.hasTaskId()) return false; + if (hasTaskId()) { + if (!getTaskId() + .equals(other.getTaskId())) return false; + } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -186,8 +219,10 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + BACKUPFILE_FIELD_NUMBER; - hash = (53 * hash) + getBackupFile().hashCode(); + if (hasTaskId()) { + hash = (37 * hash) + TASKID_FIELD_NUMBER; + hash = (53 * hash) + getTaskId().hashCode(); + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -325,8 +360,12 @@ private void maybeForceBuilderInitialization() { @java.lang.Override public Builder clear() { super.clear(); - backupFile_ = com.google.protobuf.ByteString.EMPTY; - + if (taskIdBuilder_ == null) { + taskId_ = null; + } else { + taskId_ = null; + taskIdBuilder_ = null; + } return this; } @@ -353,7 +392,11 @@ public io.evitadb.externalApi.grpc.generated.GrpcBackupCatalogResponse build() { @java.lang.Override public io.evitadb.externalApi.grpc.generated.GrpcBackupCatalogResponse buildPartial() { io.evitadb.externalApi.grpc.generated.GrpcBackupCatalogResponse result = new io.evitadb.externalApi.grpc.generated.GrpcBackupCatalogResponse(this); - result.backupFile_ = backupFile_; + if (taskIdBuilder_ == null) { + result.taskId_ = taskId_; + } else { + result.taskId_ = taskIdBuilder_.build(); + } onBuilt(); return result; } @@ -402,8 +445,8 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcBackupCatalogResponse other) { if (other == io.evitadb.externalApi.grpc.generated.GrpcBackupCatalogResponse.getDefaultInstance()) return this; - if (other.getBackupFile() != com.google.protobuf.ByteString.EMPTY) { - setBackupFile(other.getBackupFile()); + if (other.hasTaskId()) { + mergeTaskId(other.getTaskId()); } this.mergeUnknownFields(other.unknownFields); onChanged(); @@ -434,51 +477,160 @@ public Builder mergeFrom( return this; } - private com.google.protobuf.ByteString backupFile_ = com.google.protobuf.ByteString.EMPTY; + private io.evitadb.externalApi.grpc.generated.GrpcUuid taskId_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> taskIdBuilder_; /** *
-     * Binary contents of the backup file.
+     * the id of the task that is used to backup the catalog and getting its progress
      * 
* - * bytes backupFile = 1; - * @return The backupFile. + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return Whether the taskId field is set. */ - @java.lang.Override - public com.google.protobuf.ByteString getBackupFile() { - return backupFile_; + public boolean hasTaskId() { + return taskIdBuilder_ != null || taskId_ != null; } /** *
-     * Binary contents of the backup file.
+     * the id of the task that is used to backup the catalog and getting its progress
      * 
* - * bytes backupFile = 1; - * @param value The backupFile to set. - * @return This builder for chaining. + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return The taskId. */ - public Builder setBackupFile(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } + public io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId() { + if (taskIdBuilder_ == null) { + return taskId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } else { + return taskIdBuilder_.getMessage(); + } + } + /** + *
+     * the id of the task that is used to backup the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public Builder setTaskId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (taskIdBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + taskId_ = value; + onChanged(); + } else { + taskIdBuilder_.setMessage(value); + } - backupFile_ = value; - onChanged(); return this; } /** *
-     * Binary contents of the backup file.
+     * the id of the task that is used to backup the catalog and getting its progress
      * 
* - * bytes backupFile = 1; - * @return This builder for chaining. + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; */ - public Builder clearBackupFile() { + public Builder setTaskId( + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder builderForValue) { + if (taskIdBuilder_ == null) { + taskId_ = builderForValue.build(); + onChanged(); + } else { + taskIdBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * the id of the task that is used to backup the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public Builder mergeTaskId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (taskIdBuilder_ == null) { + if (taskId_ != null) { + taskId_ = + io.evitadb.externalApi.grpc.generated.GrpcUuid.newBuilder(taskId_).mergeFrom(value).buildPartial(); + } else { + taskId_ = value; + } + onChanged(); + } else { + taskIdBuilder_.mergeFrom(value); + } - backupFile_ = getDefaultInstance().getBackupFile(); - onChanged(); return this; } + /** + *
+     * the id of the task that is used to backup the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public Builder clearTaskId() { + if (taskIdBuilder_ == null) { + taskId_ = null; + onChanged(); + } else { + taskId_ = null; + taskIdBuilder_ = null; + } + + return this; + } + /** + *
+     * the id of the task that is used to backup the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder getTaskIdBuilder() { + + onChanged(); + return getTaskIdFieldBuilder().getBuilder(); + } + /** + *
+     * the id of the task that is used to backup the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder() { + if (taskIdBuilder_ != null) { + return taskIdBuilder_.getMessageOrBuilder(); + } else { + return taskId_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } + } + /** + *
+     * the id of the task that is used to backup the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> + getTaskIdFieldBuilder() { + if (taskIdBuilder_ == null) { + taskIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder>( + getTaskId(), + getParentForChildren(), + isClean()); + taskId_ = null; + } + return taskIdBuilder_; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcBackupCatalogResponseOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcBackupCatalogResponseOrBuilder.java index 55c88d258..2349f2abd 100644 --- a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcBackupCatalogResponseOrBuilder.java +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcBackupCatalogResponseOrBuilder.java @@ -32,11 +32,28 @@ public interface GrpcBackupCatalogResponseOrBuilder extends /** *
-   * Binary contents of the backup file.
+   * the id of the task that is used to backup the catalog and getting its progress
    * 
* - * bytes backupFile = 1; - * @return The backupFile. + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return Whether the taskId field is set. */ - com.google.protobuf.ByteString getBackupFile(); + boolean hasTaskId(); + /** + *
+   * the id of the task that is used to backup the catalog and getting its progress
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return The taskId. + */ + io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId(); + /** + *
+   * the id of the task that is used to backup the catalog and getting its progress
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder(); } diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskRequest.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskRequest.java new file mode 100644 index 000000000..2d1fefa16 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskRequest.java @@ -0,0 +1,686 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Request to get cancel task status by id
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest} + */ +public final class GrpcCancelTaskRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest) + GrpcCancelTaskRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcCancelTaskRequest.newBuilder() to construct. + private GrpcCancelTaskRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcCancelTaskRequest() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcCancelTaskRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcCancelTaskRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder subBuilder = null; + if (taskId_ != null) { + subBuilder = taskId_.toBuilder(); + } + taskId_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcUuid.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(taskId_); + taskId_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest.class, io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest.Builder.class); + } + + public static final int TASKID_FIELD_NUMBER = 1; + private io.evitadb.externalApi.grpc.generated.GrpcUuid taskId_; + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return Whether the taskId field is set. + */ + @java.lang.Override + public boolean hasTaskId() { + return taskId_ != null; + } + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return The taskId. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId() { + return taskId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder() { + return getTaskId(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (taskId_ != null) { + output.writeMessage(1, getTaskId()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (taskId_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getTaskId()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest other = (io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest) obj; + + if (hasTaskId() != other.hasTaskId()) return false; + if (hasTaskId()) { + if (!getTaskId() + .equals(other.getTaskId())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasTaskId()) { + hash = (37 * hash) + TASKID_FIELD_NUMBER; + hash = (53 * hash) + getTaskId().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Request to get cancel task status by id
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest) + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest.class, io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (taskIdBuilder_ == null) { + taskId_ = null; + } else { + taskId_ = null; + taskIdBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskRequest_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest build() { + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest result = new io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest(this); + if (taskIdBuilder_ == null) { + result.taskId_ = taskId_; + } else { + result.taskId_ = taskIdBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest.getDefaultInstance()) return this; + if (other.hasTaskId()) { + mergeTaskId(other.getTaskId()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private io.evitadb.externalApi.grpc.generated.GrpcUuid taskId_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> taskIdBuilder_; + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return Whether the taskId field is set. + */ + public boolean hasTaskId() { + return taskIdBuilder_ != null || taskId_ != null; + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return The taskId. + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId() { + if (taskIdBuilder_ == null) { + return taskId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } else { + return taskIdBuilder_.getMessage(); + } + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public Builder setTaskId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (taskIdBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + taskId_ = value; + onChanged(); + } else { + taskIdBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public Builder setTaskId( + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder builderForValue) { + if (taskIdBuilder_ == null) { + taskId_ = builderForValue.build(); + onChanged(); + } else { + taskIdBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public Builder mergeTaskId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (taskIdBuilder_ == null) { + if (taskId_ != null) { + taskId_ = + io.evitadb.externalApi.grpc.generated.GrpcUuid.newBuilder(taskId_).mergeFrom(value).buildPartial(); + } else { + taskId_ = value; + } + onChanged(); + } else { + taskIdBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public Builder clearTaskId() { + if (taskIdBuilder_ == null) { + taskId_ = null; + onChanged(); + } else { + taskId_ = null; + taskIdBuilder_ = null; + } + + return this; + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder getTaskIdBuilder() { + + onChanged(); + return getTaskIdFieldBuilder().getBuilder(); + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder() { + if (taskIdBuilder_ != null) { + return taskIdBuilder_.getMessageOrBuilder(); + } else { + return taskId_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> + getTaskIdFieldBuilder() { + if (taskIdBuilder_ == null) { + taskIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder>( + getTaskId(), + getParentForChildren(), + isClean()); + taskId_ = null; + } + return taskIdBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest) + private static final io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcCancelTaskRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcCancelTaskRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskRequestOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskRequestOrBuilder.java new file mode 100644 index 000000000..6c79ce827 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskRequestOrBuilder.java @@ -0,0 +1,59 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +public interface GrpcCancelTaskRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcCancelTaskRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return Whether the taskId field is set. + */ + boolean hasTaskId(); + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return The taskId. + */ + io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId(); + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder(); +} diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskResponse.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskResponse.java new file mode 100644 index 000000000..7089da8b8 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskResponse.java @@ -0,0 +1,531 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Request to get cancel task status by id
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse} + */ +public final class GrpcCancelTaskResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse) + GrpcCancelTaskResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcCancelTaskResponse.newBuilder() to construct. + private GrpcCancelTaskResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcCancelTaskResponse() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcCancelTaskResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcCancelTaskResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + success_ = input.readBool(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse.class, io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse.Builder.class); + } + + public static final int SUCCESS_FIELD_NUMBER = 1; + private boolean success_; + /** + *
+   * true if the task was found and canceled
+   * 
+ * + * bool success = 1; + * @return The success. + */ + @java.lang.Override + public boolean getSuccess() { + return success_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (success_ != false) { + output.writeBool(1, success_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (success_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, success_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse other = (io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse) obj; + + if (getSuccess() + != other.getSuccess()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SUCCESS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getSuccess()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Request to get cancel task status by id
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse) + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse.class, io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + success_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskResponse_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse build() { + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse result = new io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse(this); + result.success_ = success_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse.getDefaultInstance()) return this; + if (other.getSuccess() != false) { + setSuccess(other.getSuccess()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean success_ ; + /** + *
+     * true if the task was found and canceled
+     * 
+ * + * bool success = 1; + * @return The success. + */ + @java.lang.Override + public boolean getSuccess() { + return success_; + } + /** + *
+     * true if the task was found and canceled
+     * 
+ * + * bool success = 1; + * @param value The success to set. + * @return This builder for chaining. + */ + public Builder setSuccess(boolean value) { + + success_ = value; + onChanged(); + return this; + } + /** + *
+     * true if the task was found and canceled
+     * 
+ * + * bool success = 1; + * @return This builder for chaining. + */ + public Builder clearSuccess() { + + success_ = false; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse) + private static final io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcCancelTaskResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcCancelTaskResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_api/src/main/java/io/evitadb/api/task/JobSettings.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskResponseOrBuilder.java similarity index 61% rename from evita_api/src/main/java/io/evitadb/api/task/JobSettings.java rename to evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskResponseOrBuilder.java index 97c4e1be2..4205e55d7 100644 --- a/evita_api/src/main/java/io/evitadb/api/task/JobSettings.java +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcCancelTaskResponseOrBuilder.java @@ -6,7 +6,7 @@ * | __/\ V /| | || (_| | |_| | |_) | * \___| \_/ |_|\__\__,_|____/|____/ * - * Copyright (c) 2024 + * Copyright (c) 2023-2024 * * Licensed under the Business Source License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -21,14 +21,22 @@ * limitations under the License. */ -package io.evitadb.api.task; +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto -import java.io.Serializable; +package io.evitadb.externalApi.grpc.generated; -/** - * TODO JNO - document me - * - * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 - */ -public interface JobSettings extends Serializable { +public interface GrpcCancelTaskResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcCancelTaskResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * true if the task was found and canceled
+   * 
+ * + * bool success = 1; + * @return The success. + */ + boolean getSuccess(); } diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcEvitaAPI.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcEvitaAPI.java index 8fde87de3..02e34c2f3 100644 --- a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcEvitaAPI.java +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcEvitaAPI.java @@ -39,62 +39,62 @@ public static void registerAllExtensions( } static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEvitaServerStatusResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEvitaServerStatusResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEvitaSessionRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEvitaSessionRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEvitaSessionResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEvitaSessionResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEvitaSessionTerminationRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEvitaSessionTerminationRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEvitaSessionTerminationResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEvitaSessionTerminationResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcCatalogNamesResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcCatalogNamesResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDefineCatalogRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDefineCatalogRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDefineCatalogResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDefineCatalogResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcRenameCatalogRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcRenameCatalogRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcRenameCatalogResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcRenameCatalogResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcReplaceCatalogRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcReplaceCatalogRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcReplaceCatalogResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcReplaceCatalogResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor @@ -102,6 +102,11 @@ public static void registerAllExtensions( static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogFromServerFileRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogFromServerFileRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogResponse_descriptor; static final @@ -109,19 +114,79 @@ public static void registerAllExtensions( internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCatalogIfExistsRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCatalogIfExistsRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCatalogIfExistsResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCatalogIfExistsResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateEvitaRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateEvitaRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFile_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFile_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatus_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatus_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileResponse_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -135,45 +200,98 @@ public static void registerAllExtensions( "lApi.grpc.generated\032\033google/protobuf/emp" + "ty.proto\032\017GrpcEnums.proto\032\030GrpcEvitaData" + "Types.proto\032\037GrpcCatalogSchemaMutation.p" + - "roto\"\321\001\n\035GrpcEvitaServerStatusResponse\022\017" + - "\n\007version\030\001 \001(\t\022L\n\tstartedAt\030\002 \001(\01329.io." + - "evitadb.externalApi.grpc.generated.GrpcO" + - "ffsetDateTime\022\016\n\006uptime\030\003 \001(\003\022\022\n\ninstanc" + - "eId\030\004 \001(\t\022\031\n\021catalogsCorrupted\030\005 \001(\005\022\022\n\n" + - "catalogsOk\030\006 \001(\005\"\221\001\n\027GrpcEvitaSessionReq" + - "uest\022\023\n\013catalogName\030\001 \001(\t\022Q\n\016commitBehav" + - "ior\030\002 \001(\01629.io.evitadb.externalApi.grpc." + - "generated.GrpcCommitBehavior\022\016\n\006dryRun\030\003" + - " \001(\010\"\260\002\n\030GrpcEvitaSessionResponse\022\021\n\tses" + - "sionId\030\001 \001(\t\022K\n\013sessionType\030\002 \001(\01626.io.e" + - "vitadb.externalApi.grpc.generated.GrpcSe" + - "ssionType\022R\n\017commitBehaviour\030\003 \001(\01629.io." + - "evitadb.externalApi.grpc.generated.GrpcC" + - "ommitBehavior\022M\n\014catalogState\030\004 \001(\01627.io" + + "roto\032\036google/protobuf/wrappers.proto\"\321\001\n" + + "\035GrpcEvitaServerStatusResponse\022\017\n\007versio" + + "n\030\001 \001(\t\022L\n\tstartedAt\030\002 \001(\01329.io.evitadb." + + "externalApi.grpc.generated.GrpcOffsetDat" + + "eTime\022\016\n\006uptime\030\003 \001(\003\022\022\n\ninstanceId\030\004 \001(" + + "\t\022\031\n\021catalogsCorrupted\030\005 \001(\005\022\022\n\ncatalogs" + + "Ok\030\006 \001(\005\"\221\001\n\027GrpcEvitaSessionRequest\022\023\n\013" + + "catalogName\030\001 \001(\t\022Q\n\016commitBehavior\030\002 \001(" + + "\01629.io.evitadb.externalApi.grpc.generate" + + "d.GrpcCommitBehavior\022\016\n\006dryRun\030\003 \001(\010\"\260\002\n" + + "\030GrpcEvitaSessionResponse\022\021\n\tsessionId\030\001" + + " \001(\t\022K\n\013sessionType\030\002 \001(\01626.io.evitadb.e" + + "xternalApi.grpc.generated.GrpcSessionTyp" + + "e\022R\n\017commitBehaviour\030\003 \001(\01629.io.evitadb." + + "externalApi.grpc.generated.GrpcCommitBeh" + + "avior\022M\n\014catalogState\030\004 \001(\01627.io.evitadb" + + ".externalApi.grpc.generated.GrpcCatalogS" + + "tate\022\021\n\tcatalogId\030\005 \001(\t\"L\n\"GrpcEvitaSess" + + "ionTerminationRequest\022\023\n\013catalogName\030\001 \001" + + "(\t\022\021\n\tsessionId\030\002 \001(\t\"9\n#GrpcEvitaSessio" + + "nTerminationResponse\022\022\n\nterminated\030\001 \001(\010" + + "\"0\n\030GrpcCatalogNamesResponse\022\024\n\014catalogN" + + "ames\030\001 \003(\t\"/\n\030GrpcDefineCatalogRequest\022\023" + + "\n\013catalogName\030\001 \001(\t\",\n\031GrpcDefineCatalog" + + "Response\022\017\n\007success\030\001 \001(\010\"G\n\030GrpcRenameC" + + "atalogRequest\022\023\n\013catalogName\030\001 \001(\t\022\026\n\016ne" + + "wCatalogName\030\002 \001(\t\",\n\031GrpcRenameCatalogR" + + "esponse\022\017\n\007success\030\001 \001(\010\"a\n\031GrpcReplaceC" + + "atalogRequest\022#\n\033catalogNameToBeReplaced" + + "With\030\001 \001(\t\022\037\n\027catalogNameToBeReplaced\030\002 " + + "\001(\t\"-\n\032GrpcReplaceCatalogResponse\022\017\n\007suc" + + "cess\030\001 \001(\010\"D\n\031GrpcRestoreCatalogRequest\022" + + "\023\n\013catalogName\030\001 \001(\t\022\022\n\nbackupFile\030\002 \001(\014" + + "\"\177\n\'GrpcRestoreCatalogFromServerFileRequ" + + "est\022\023\n\013catalogName\030\001 \001(\t\022?\n\006fileId\030\002 \001(\013" + + "2/.io.evitadb.externalApi.grpc.generated" + + ".GrpcUuid\"k\n\032GrpcRestoreCatalogResponse\022" + + "\014\n\004read\030\001 \001(\003\022?\n\006taskId\030\002 \001(\0132/.io.evita" + + "db.externalApi.grpc.generated.GrpcUuid\"7" + + "\n GrpcDeleteCatalogIfExistsRequest\022\023\n\013ca" + + "talogName\030\001 \001(\t\"4\n!GrpcDeleteCatalogIfEx" + + "istsResponse\022\017\n\007success\030\001 \001(\010\"{\n\026GrpcUpd" + + "ateEvitaRequest\022a\n\017schemaMutations\030\001 \003(\013" + + "2H.io.evitadb.externalApi.grpc.generated" + + ".GrpcTopLevelCatalogSchemaMutation\"\351\001\n\010G" + + "rpcFile\022?\n\006fileId\030\001 \001(\0132/.io.evitadb.ext" + + "ernalApi.grpc.generated.GrpcUuid\022\014\n\004name" + + "\030\002 \001(\t\0221\n\013description\030\003 \001(\0132\034.google.pro" + + "tobuf.StringValue\022\023\n\013contentType\030\004 \001(\t\022\030" + + "\n\020totalSizeInBytes\030\005 \001(\003\022,\n\006origin\030\006 \001(\013" + + "2\034.google.protobuf.StringValue\"\370\004\n\016GrpcT" + + "askStatus\022\020\n\010taskType\030\001 \001(\t\022\020\n\010taskName\030" + + "\002 \001(\t\022?\n\006taskId\030\003 \001(\0132/.io.evitadb.exter" + + "nalApi.grpc.generated.GrpcUuid\0221\n\013catalo" + + "gName\030\004 \001(\0132\034.google.protobuf.StringValu" + + "e\022I\n\006issued\030\005 \001(\01329.io.evitadb.externalA" + + "pi.grpc.generated.GrpcOffsetDateTime\022J\n\007" + + "started\030\006 \001(\01329.io.evitadb.externalApi.g" + + "rpc.generated.GrpcOffsetDateTime\022K\n\010fini" + + "shed\030\007 \001(\01329.io.evitadb.externalApi.grpc" + + ".generated.GrpcOffsetDateTime\022\020\n\010progres" + + "s\030\010 \001(\005\022.\n\010settings\030\t \001(\0132\034.google.proto" + + "buf.StringValue\022,\n\004text\030\n \001(\0132\034.google.p" + + "rotobuf.StringValueH\000\022?\n\004file\030\013 \001(\0132/.io" + ".evitadb.externalApi.grpc.generated.Grpc" + - "CatalogState\"L\n\"GrpcEvitaSessionTerminat" + - "ionRequest\022\023\n\013catalogName\030\001 \001(\t\022\021\n\tsessi" + - "onId\030\002 \001(\t\"9\n#GrpcEvitaSessionTerminatio" + - "nResponse\022\022\n\nterminated\030\001 \001(\010\"0\n\030GrpcCat" + - "alogNamesResponse\022\024\n\014catalogNames\030\001 \003(\t\"" + - "/\n\030GrpcDefineCatalogRequest\022\023\n\013catalogNa" + - "me\030\001 \001(\t\",\n\031GrpcDefineCatalogResponse\022\017\n" + - "\007success\030\001 \001(\010\"G\n\030GrpcRenameCatalogReque" + - "st\022\023\n\013catalogName\030\001 \001(\t\022\026\n\016newCatalogNam" + - "e\030\002 \001(\t\",\n\031GrpcRenameCatalogResponse\022\017\n\007" + - "success\030\001 \001(\010\"a\n\031GrpcReplaceCatalogReque" + - "st\022#\n\033catalogNameToBeReplacedWith\030\001 \001(\t\022" + - "\037\n\027catalogNameToBeReplaced\030\002 \001(\t\"-\n\032Grpc" + - "ReplaceCatalogResponse\022\017\n\007success\030\001 \001(\010\"" + - "D\n\031GrpcRestoreCatalogRequest\022\023\n\013catalogN" + - "ame\030\001 \001(\t\022\022\n\nbackupFile\030\002 \001(\014\"*\n\032GrpcRes" + - "toreCatalogResponse\022\014\n\004read\030\001 \001(\003\"7\n Grp" + - "cDeleteCatalogIfExistsRequest\022\023\n\013catalog" + - "Name\030\001 \001(\t\"4\n!GrpcDeleteCatalogIfExistsR" + - "esponse\022\017\n\007success\030\001 \001(\010\"{\n\026GrpcUpdateEv" + - "itaRequest\022a\n\017schemaMutations\030\001 \003(\0132H.io" + - ".evitadb.externalApi.grpc.generated.Grpc" + - "TopLevelCatalogSchemaMutation2\370\016\n\014EvitaS" + + "FileH\000\022/\n\texception\030\014 \001(\0132\034.google.proto" + + "buf.StringValueB\010\n\006result\"?\n\027GrpcTaskSta" + + "tusesRequest\022\022\n\npageNumber\030\001 \001(\005\022\020\n\010page" + + "Size\030\002 \001(\005\"\253\001\n\030GrpcTaskStatusesResponse\022" + + "\020\n\010pageSize\030\001 \001(\005\022\022\n\npageNumber\030\002 \001(\005\022K\n" + + "\014taskStatuses\030\003 \003(\01325.io.evitadb.externa" + + "lApi.grpc.generated.GrpcTaskStatus\022\034\n\024to" + + "talNumberOfRecords\030\004 \001(\005\"X\n\025GrpcTaskStat" + + "usRequest\022?\n\006taskId\030\001 \001(\0132/.io.evitadb.e" + + "xternalApi.grpc.generated.GrpcUuid\"c\n\026Gr" + + "pcTaskStatusResponse\022I\n\ntaskStatus\030\001 \001(\013" + + "25.io.evitadb.externalApi.grpc.generated" + + ".GrpcTaskStatus\"X\n\025GrpcCancelTaskRequest" + + "\022?\n\006taskId\030\001 \001(\0132/.io.evitadb.externalAp" + + "i.grpc.generated.GrpcUuid\")\n\026GrpcCancelT" + + "askResponse\022\017\n\007success\030\001 \001(\010\"m\n\027GrpcFile" + + "sToFetchRequest\022\022\n\npageNumber\030\001 \001(\005\022\020\n\010p" + + "ageSize\030\002 \001(\005\022,\n\006origin\030\003 \001(\0132\034.google.p" + + "rotobuf.StringValue\"\245\001\n\030GrpcFilesToFetch" + + "Response\022\020\n\010pageSize\030\001 \001(\005\022\022\n\npageNumber" + + "\030\002 \001(\005\022E\n\014filesToFetch\030\003 \003(\0132/.io.evitad" + + "b.externalApi.grpc.generated.GrpcFile\022\034\n" + + "\024totalNumberOfRecords\030\004 \001(\005\"W\n\024GrpcFetch" + + "FileRequest\022?\n\006fileId\030\001 \001(\0132/.io.evitadb" + + ".externalApi.grpc.generated.GrpcUuid\"G\n\025" + + "GrpcFetchFileResponse\022\024\n\014fileContents\030\001 " + + "\001(\014\022\030\n\020totalSizeInBytes\030\002 \001(\0032\376\025\n\014EvitaS" + "ervice\022l\n\014ServerStatus\022\026.google.protobuf" + ".Empty\032D.io.evitadb.externalApi.grpc.gen" + "erated.GrpcEvitaServerStatusResponse\022\230\001\n" + @@ -214,15 +332,37 @@ public static void registerAllExtensions( "\022\227\001\n\016RestoreCatalog\022@.io.evitadb.externa" + "lApi.grpc.generated.GrpcRestoreCatalogRe" + "quest\032A.io.evitadb.externalApi.grpc.gene" + - "rated.GrpcRestoreCatalogResponse(\001\022\252\001\n\025D" + - "eleteCatalogIfExists\022G.io.evitadb.extern" + - "alApi.grpc.generated.GrpcDeleteCatalogIf" + - "ExistsRequest\032H.io.evitadb.externalApi.g" + - "rpc.generated.GrpcDeleteCatalogIfExistsR" + - "esponse\022_\n\006Update\022=.io.evitadb.externalA" + - "pi.grpc.generated.GrpcUpdateEvitaRequest" + - "\032\026.google.protobuf.EmptyB\014P\001\252\002\007EvitaDBb\006" + - "proto3" + "rated.GrpcRestoreCatalogResponse(\001\022\263\001\n\034R" + + "estoreCatalogFromServerFile\022N.io.evitadb" + + ".externalApi.grpc.generated.GrpcRestoreC" + + "atalogFromServerFileRequest\032A.io.evitadb" + + ".externalApi.grpc.generated.GrpcRestoreC" + + "atalogResponse(\001\022\252\001\n\025DeleteCatalogIfExis" + + "ts\022G.io.evitadb.externalApi.grpc.generat" + + "ed.GrpcDeleteCatalogIfExistsRequest\032H.io" + + ".evitadb.externalApi.grpc.generated.Grpc" + + "DeleteCatalogIfExistsResponse\022_\n\006Update\022" + + "=.io.evitadb.externalApi.grpc.generated." + + "GrpcUpdateEvitaRequest\032\026.google.protobuf" + + ".Empty\022\223\001\n\020ListTaskStatuses\022>.io.evitadb" + + ".externalApi.grpc.generated.GrpcTaskStat" + + "usesRequest\032?.io.evitadb.externalApi.grp" + + "c.generated.GrpcTaskStatusesResponse\022\214\001\n" + + "\rGetTaskStatus\022<.io.evitadb.externalApi." + + "grpc.generated.GrpcTaskStatusRequest\032=.i" + + "o.evitadb.externalApi.grpc.generated.Grp" + + "cTaskStatusResponse\022\211\001\n\nCancelTask\022<.io." + + "evitadb.externalApi.grpc.generated.GrpcC" + + "ancelTaskRequest\032=.io.evitadb.externalAp" + + "i.grpc.generated.GrpcCancelTaskResponse\022" + + "\223\001\n\020ListFilesToFetch\022>.io.evitadb.extern" + + "alApi.grpc.generated.GrpcFilesToFetchReq" + + "uest\032?.io.evitadb.externalApi.grpc.gener" + + "ated.GrpcFilesToFetchResponse\022\206\001\n\tFetchF" + + "ile\022;.io.evitadb.externalApi.grpc.genera" + + "ted.GrpcFetchFileRequest\032<.io.evitadb.ex" + + "ternalApi.grpc.generated.GrpcFetchFileRe" + + "sponseB\014P\001\252\002\007EvitaDBb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -231,6 +371,7 @@ public static void registerAllExtensions( io.evitadb.externalApi.grpc.generated.GrpcEnums.getDescriptor(), io.evitadb.externalApi.grpc.generated.GrpcEvitaDataTypes.getDescriptor(), io.evitadb.externalApi.grpc.generated.GrpcCatalogSchemaMutation.getDescriptor(), + com.google.protobuf.WrappersProto.getDescriptor(), }); internal_static_io_evitadb_externalApi_grpc_generated_GrpcEvitaServerStatusResponse_descriptor = getDescriptor().getMessageTypes().get(0); @@ -310,34 +451,113 @@ public static void registerAllExtensions( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogRequest_descriptor, new java.lang.String[] { "CatalogName", "BackupFile", }); - internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogResponse_descriptor = + internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogFromServerFileRequest_descriptor = getDescriptor().getMessageTypes().get(13); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogFromServerFileRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogFromServerFileRequest_descriptor, + new java.lang.String[] { "CatalogName", "FileId", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogResponse_descriptor = + getDescriptor().getMessageTypes().get(14); internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogResponse_descriptor, - new java.lang.String[] { "Read", }); + new java.lang.String[] { "Read", "TaskId", }); internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCatalogIfExistsRequest_descriptor = - getDescriptor().getMessageTypes().get(14); + getDescriptor().getMessageTypes().get(15); internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCatalogIfExistsRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCatalogIfExistsRequest_descriptor, new java.lang.String[] { "CatalogName", }); internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCatalogIfExistsResponse_descriptor = - getDescriptor().getMessageTypes().get(15); + getDescriptor().getMessageTypes().get(16); internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCatalogIfExistsResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCatalogIfExistsResponse_descriptor, new java.lang.String[] { "Success", }); internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateEvitaRequest_descriptor = - getDescriptor().getMessageTypes().get(16); + getDescriptor().getMessageTypes().get(17); internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateEvitaRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateEvitaRequest_descriptor, new java.lang.String[] { "SchemaMutations", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFile_descriptor = + getDescriptor().getMessageTypes().get(18); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFile_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFile_descriptor, + new java.lang.String[] { "FileId", "Name", "Description", "ContentType", "TotalSizeInBytes", "Origin", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatus_descriptor = + getDescriptor().getMessageTypes().get(19); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatus_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatus_descriptor, + new java.lang.String[] { "TaskType", "TaskName", "TaskId", "CatalogName", "Issued", "Started", "Finished", "Progress", "Settings", "Text", "File", "Exception", "Result", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesRequest_descriptor = + getDescriptor().getMessageTypes().get(20); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesRequest_descriptor, + new java.lang.String[] { "PageNumber", "PageSize", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesResponse_descriptor = + getDescriptor().getMessageTypes().get(21); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesResponse_descriptor, + new java.lang.String[] { "PageSize", "PageNumber", "TaskStatuses", "TotalNumberOfRecords", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusRequest_descriptor = + getDescriptor().getMessageTypes().get(22); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusRequest_descriptor, + new java.lang.String[] { "TaskId", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusResponse_descriptor = + getDescriptor().getMessageTypes().get(23); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusResponse_descriptor, + new java.lang.String[] { "TaskStatus", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskRequest_descriptor = + getDescriptor().getMessageTypes().get(24); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskRequest_descriptor, + new java.lang.String[] { "TaskId", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskResponse_descriptor = + getDescriptor().getMessageTypes().get(25); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcCancelTaskResponse_descriptor, + new java.lang.String[] { "Success", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchRequest_descriptor = + getDescriptor().getMessageTypes().get(26); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchRequest_descriptor, + new java.lang.String[] { "PageNumber", "PageSize", "Origin", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchResponse_descriptor = + getDescriptor().getMessageTypes().get(27); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchResponse_descriptor, + new java.lang.String[] { "PageSize", "PageNumber", "FilesToFetch", "TotalNumberOfRecords", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileRequest_descriptor = + getDescriptor().getMessageTypes().get(28); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileRequest_descriptor, + new java.lang.String[] { "FileId", }); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileResponse_descriptor = + getDescriptor().getMessageTypes().get(29); + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileResponse_descriptor, + new java.lang.String[] { "FileContents", "TotalSizeInBytes", }); com.google.protobuf.EmptyProto.getDescriptor(); io.evitadb.externalApi.grpc.generated.GrpcEnums.getDescriptor(); io.evitadb.externalApi.grpc.generated.GrpcEvitaDataTypes.getDescriptor(); io.evitadb.externalApi.grpc.generated.GrpcCatalogSchemaMutation.getDescriptor(); + com.google.protobuf.WrappersProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcEvitaSessionAPI.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcEvitaSessionAPI.java index e23e64984..313befb2e 100644 --- a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcEvitaSessionAPI.java +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcEvitaSessionAPI.java @@ -39,147 +39,147 @@ public static void registerAllExtensions( } static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcCatalogStateResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcCatalogStateResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcCatalogSchemaResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcCatalogSchemaResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntitySchemaRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntitySchemaRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntitySchemaResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntitySchemaResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateCatalogSchemaRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateCatalogSchemaRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateCatalogSchemaResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateCatalogSchemaResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateAndFetchCatalogSchemaResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateAndFetchCatalogSchemaResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDefineEntitySchemaRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDefineEntitySchemaRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDefineEntitySchemaResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDefineEntitySchemaResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateEntitySchemaRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateEntitySchemaRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateEntitySchemaResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateEntitySchemaResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateAndFetchEntitySchemaResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpdateAndFetchEntitySchemaResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityRequest_NamedQueryParamsEntry_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityRequest_NamedQueryParamsEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcPaginatedList_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcPaginatedList_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcStripList_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcStripList_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDataChunk_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDataChunk_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCollectionRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCollectionRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCollectionResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteCollectionResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcRenameCollectionRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcRenameCollectionRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcRenameCollectionResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcRenameCollectionResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcReplaceCollectionRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcReplaceCollectionRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcReplaceCollectionResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcReplaceCollectionResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityCollectionSizeRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityCollectionSizeRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityCollectionSizeResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityCollectionSizeResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcCloseRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcCloseRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcCloseResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcCloseResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcGoLiveAndCloseResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcGoLiveAndCloseResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor @@ -189,92 +189,92 @@ public static void registerAllExtensions( internal_static_io_evitadb_externalApi_grpc_generated_GrpcBackupCatalogResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityTypesResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityTypesResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryRequest_NamedQueryParamsEntry_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryRequest_NamedQueryParamsEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryOneResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryOneResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryListResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryListResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpsertEntityRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpsertEntityRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpsertEntityRequest_NamedQueryParamsEntry_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpsertEntityRequest_NamedQueryParamsEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntityRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntityRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntityRequest_NamedQueryParamsEntry_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntityRequest_NamedQueryParamsEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntitiesRequest_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntitiesRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntitiesRequest_NamedQueryParamsEntry_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntitiesRequest_NamedQueryParamsEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpsertEntityResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcUpsertEntityResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntityResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntityResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntityAndItsHierarchyResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntityAndItsHierarchyResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntitiesResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcDeleteEntitiesResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcTransactionResponse_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcTransactionResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryParam_descriptor; - static final + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_io_evitadb_externalApi_grpc_generated_GrpcQueryParam_fieldAccessorTable; @@ -369,275 +369,276 @@ public static void registerAllExtensions( "ted.GrpcCommitBehavior\"+\n\021GrpcCloseRespo" + "nse\022\026\n\016catalogVersion\030\001 \001(\003\"E\n\032GrpcGoLiv" + "eAndCloseResponse\022\017\n\007success\030\001 \001(\010\022\026\n\016ca" + - "talogVersion\030\002 \001(\003\"/\n\031GrpcBackupCatalogR" + - "esponse\022\022\n\nbackupFile\030\001 \001(\014\".\n\027GrpcEntit" + - "yTypesResponse\022\023\n\013entityTypes\030\001 \003(\t\"\320\002\n\020" + - "GrpcQueryRequest\022\r\n\005query\030\001 \001(\t\022T\n\025posit" + - "ionalQueryParams\030\002 \003(\01325.io.evitadb.exte" + - "rnalApi.grpc.generated.GrpcQueryParam\022g\n" + - "\020namedQueryParams\030\003 \003(\0132M.io.evitadb.ext" + - "ernalApi.grpc.generated.GrpcQueryRequest" + + "talogVersion\030\002 \001(\003\"\\\n\031GrpcBackupCatalogR" + + "esponse\022?\n\006taskId\030\001 \001(\0132/.io.evitadb.ext" + + "ernalApi.grpc.generated.GrpcUuid\".\n\027Grpc" + + "EntityTypesResponse\022\023\n\013entityTypes\030\001 \003(\t" + + "\"\320\002\n\020GrpcQueryRequest\022\r\n\005query\030\001 \001(\t\022T\n\025" + + "positionalQueryParams\030\002 \003(\01325.io.evitadb" + + ".externalApi.grpc.generated.GrpcQueryPar" + + "am\022g\n\020namedQueryParams\030\003 \003(\0132M.io.evitad" + + "b.externalApi.grpc.generated.GrpcQueryRe" + + "quest.NamedQueryParamsEntry\032n\n\025NamedQuer" + + "yParamsEntry\022\013\n\003key\030\001 \001(\t\022D\n\005value\030\002 \001(\013" + + "25.io.evitadb.externalApi.grpc.generated" + + ".GrpcQueryParam:\0028\001\"\254\001\n\021GrpcQueryRespons" + + "e\022H\n\nrecordPage\030\001 \001(\01324.io.evitadb.exter" + + "nalApi.grpc.generated.GrpcDataChunk\022M\n\014e" + + "xtraResults\030\002 \001(\01327.io.evitadb.externalA" + + "pi.grpc.generated.GrpcExtraResults\"\211\002\n\024G" + + "rpcQueryOneResponse\022S\n\017entityReference\030\001" + + " \001(\0132:.io.evitadb.externalApi.grpc.gener" + + "ated.GrpcEntityReference\022M\n\014sealedEntity" + + "\030\002 \001(\01327.io.evitadb.externalApi.grpc.gen" + + "erated.GrpcSealedEntity\022M\n\014binaryEntity\030" + + "\003 \001(\01327.io.evitadb.externalApi.grpc.gene" + + "rated.GrpcBinaryEntity\"\217\002\n\025GrpcQueryList" + + "Response\022T\n\020entityReferences\030\001 \003(\0132:.io." + + "evitadb.externalApi.grpc.generated.GrpcE" + + "ntityReference\022O\n\016sealedEntities\030\002 \003(\01327" + + ".io.evitadb.externalApi.grpc.generated.G" + + "rpcSealedEntity\022O\n\016binaryEntities\030\003 \003(\0132" + + "7.io.evitadb.externalApi.grpc.generated." + + "GrpcBinaryEntity\"\263\003\n\027GrpcUpsertEntityReq" + + "uest\022Q\n\016entityMutation\030\001 \001(\01329.io.evitad" + + "b.externalApi.grpc.generated.GrpcEntityM" + + "utation\022\017\n\007require\030\002 \001(\t\022T\n\025positionalQu" + + "eryParams\030\003 \003(\01325.io.evitadb.externalApi" + + ".grpc.generated.GrpcQueryParam\022n\n\020namedQ" + + "ueryParams\030\004 \003(\0132T.io.evitadb.externalAp" + + "i.grpc.generated.GrpcUpsertEntityRequest" + ".NamedQueryParamsEntry\032n\n\025NamedQueryPara" + "msEntry\022\013\n\003key\030\001 \001(\t\022D\n\005value\030\002 \001(\01325.io" + ".evitadb.externalApi.grpc.generated.Grpc" + - "QueryParam:\0028\001\"\254\001\n\021GrpcQueryResponse\022H\n\n" + - "recordPage\030\001 \001(\01324.io.evitadb.externalAp" + - "i.grpc.generated.GrpcDataChunk\022M\n\014extraR" + - "esults\030\002 \001(\01327.io.evitadb.externalApi.gr" + - "pc.generated.GrpcExtraResults\"\211\002\n\024GrpcQu" + - "eryOneResponse\022S\n\017entityReference\030\001 \001(\0132" + - ":.io.evitadb.externalApi.grpc.generated." + - "GrpcEntityReference\022M\n\014sealedEntity\030\002 \001(" + - "\01327.io.evitadb.externalApi.grpc.generate" + - "d.GrpcSealedEntity\022M\n\014binaryEntity\030\003 \001(\013" + - "27.io.evitadb.externalApi.grpc.generated" + - ".GrpcBinaryEntity\"\217\002\n\025GrpcQueryListRespo" + - "nse\022T\n\020entityReferences\030\001 \003(\0132:.io.evita" + - "db.externalApi.grpc.generated.GrpcEntity" + - "Reference\022O\n\016sealedEntities\030\002 \003(\01327.io.e" + - "vitadb.externalApi.grpc.generated.GrpcSe" + - "aledEntity\022O\n\016binaryEntities\030\003 \003(\01327.io." + - "evitadb.externalApi.grpc.generated.GrpcB" + - "inaryEntity\"\263\003\n\027GrpcUpsertEntityRequest\022" + - "Q\n\016entityMutation\030\001 \001(\01329.io.evitadb.ext" + - "ernalApi.grpc.generated.GrpcEntityMutati" + - "on\022\017\n\007require\030\002 \001(\t\022T\n\025positionalQueryPa" + - "rams\030\003 \003(\01325.io.evitadb.externalApi.grpc" + - ".generated.GrpcQueryParam\022n\n\020namedQueryP" + - "arams\030\004 \003(\0132T.io.evitadb.externalApi.grp" + - "c.generated.GrpcUpsertEntityRequest.Name" + - "dQueryParamsEntry\032n\n\025NamedQueryParamsEnt" + - "ry\022\013\n\003key\030\001 \001(\t\022D\n\005value\030\002 \001(\01325.io.evit" + - "adb.externalApi.grpc.generated.GrpcQuery" + - "Param:\0028\001\"\245\003\n\027GrpcDeleteEntityRequest\022\022\n" + - "\nentityType\030\001 \001(\t\022/\n\nprimaryKey\030\002 \001(\0132\033." + - "google.protobuf.Int32Value\022\017\n\007require\030\003 " + - "\001(\t\022T\n\025positionalQueryParams\030\004 \003(\01325.io." + + "QueryParam:\0028\001\"\245\003\n\027GrpcDeleteEntityReque" + + "st\022\022\n\nentityType\030\001 \001(\t\022/\n\nprimaryKey\030\002 \001" + + "(\0132\033.google.protobuf.Int32Value\022\017\n\007requi" + + "re\030\003 \001(\t\022T\n\025positionalQueryParams\030\004 \003(\0132" + + "5.io.evitadb.externalApi.grpc.generated." + + "GrpcQueryParam\022n\n\020namedQueryParams\030\005 \003(\013" + + "2T.io.evitadb.externalApi.grpc.generated" + + ".GrpcDeleteEntityRequest.NamedQueryParam" + + "sEntry\032n\n\025NamedQueryParamsEntry\022\013\n\003key\030\001" + + " \001(\t\022D\n\005value\030\002 \001(\01325.io.evitadb.externa" + + "lApi.grpc.generated.GrpcQueryParam:\0028\001\"\342" + + "\002\n\031GrpcDeleteEntitiesRequest\022\r\n\005query\030\001 " + + "\001(\t\022T\n\025positionalQueryParams\030\002 \003(\01325.io." + "evitadb.externalApi.grpc.generated.GrpcQ" + - "ueryParam\022n\n\020namedQueryParams\030\005 \003(\0132T.io" + + "ueryParam\022p\n\020namedQueryParams\030\003 \003(\0132V.io" + ".evitadb.externalApi.grpc.generated.Grpc" + - "DeleteEntityRequest.NamedQueryParamsEntr" + - "y\032n\n\025NamedQueryParamsEntry\022\013\n\003key\030\001 \001(\t\022" + - "D\n\005value\030\002 \001(\01325.io.evitadb.externalApi." + - "grpc.generated.GrpcQueryParam:\0028\001\"\342\002\n\031Gr" + - "pcDeleteEntitiesRequest\022\r\n\005query\030\001 \001(\t\022T" + - "\n\025positionalQueryParams\030\002 \003(\01325.io.evita" + - "db.externalApi.grpc.generated.GrpcQueryP" + - "aram\022p\n\020namedQueryParams\030\003 \003(\0132V.io.evit" + - "adb.externalApi.grpc.generated.GrpcDelet" + - "eEntitiesRequest.NamedQueryParamsEntry\032n" + - "\n\025NamedQueryParamsEntry\022\013\n\003key\030\001 \001(\t\022D\n\005" + - "value\030\002 \001(\01325.io.evitadb.externalApi.grp" + - "c.generated.GrpcQueryParam:\0028\001\"\310\001\n\030GrpcU" + - "psertEntityResponse\022U\n\017entityReference\030\001" + - " \001(\0132:.io.evitadb.externalApi.grpc.gener" + - "ated.GrpcEntityReferenceH\000\022I\n\006entity\030\002 \001" + - "(\01327.io.evitadb.externalApi.grpc.generat" + - "ed.GrpcSealedEntityH\000B\n\n\010response\"\310\001\n\030Gr" + - "pcDeleteEntityResponse\022U\n\017entityReferenc" + - "e\030\001 \001(\0132:.io.evitadb.externalApi.grpc.ge" + - "nerated.GrpcEntityReferenceH\000\022I\n\006entity\030" + - "\002 \001(\01327.io.evitadb.externalApi.grpc.gene" + - "rated.GrpcSealedEntityH\000B\n\n\010response\"\206\002\n" + - "\'GrpcDeleteEntityAndItsHierarchyResponse" + - "\022\027\n\017deletedEntities\030\001 \001(\005\022`\n\032deletedRoot" + - "EntityReference\030\002 \001(\0132:.io.evitadb.exter" + - "nalApi.grpc.generated.GrpcEntityReferenc" + - "eH\000\022T\n\021deletedRootEntity\030\003 \001(\01327.io.evit" + - "adb.externalApi.grpc.generated.GrpcSeale" + - "dEntityH\000B\n\n\010response\"\213\001\n\032GrpcDeleteEnti" + - "tiesResponse\022\027\n\017deletedEntities\030\001 \001(\005\022T\n" + - "\023deletedEntityBodies\030\002 \003(\01327.io.evitadb." + - "externalApi.grpc.generated.GrpcSealedEnt" + - "ity\"y\n\027GrpcTransactionResponse\022\026\n\016catalo" + - "gVersion\030\001 \001(\003\022F\n\rtransactionId\030\002 \001(\0132/." + + "DeleteEntitiesRequest.NamedQueryParamsEn" + + "try\032n\n\025NamedQueryParamsEntry\022\013\n\003key\030\001 \001(" + + "\t\022D\n\005value\030\002 \001(\01325.io.evitadb.externalAp" + + "i.grpc.generated.GrpcQueryParam:\0028\001\"\310\001\n\030" + + "GrpcUpsertEntityResponse\022U\n\017entityRefere" + + "nce\030\001 \001(\0132:.io.evitadb.externalApi.grpc." + + "generated.GrpcEntityReferenceH\000\022I\n\006entit" + + "y\030\002 \001(\01327.io.evitadb.externalApi.grpc.ge" + + "nerated.GrpcSealedEntityH\000B\n\n\010response\"\310" + + "\001\n\030GrpcDeleteEntityResponse\022U\n\017entityRef" + + "erence\030\001 \001(\0132:.io.evitadb.externalApi.gr" + + "pc.generated.GrpcEntityReferenceH\000\022I\n\006en" + + "tity\030\002 \001(\01327.io.evitadb.externalApi.grpc" + + ".generated.GrpcSealedEntityH\000B\n\n\010respons" + + "e\"\206\002\n\'GrpcDeleteEntityAndItsHierarchyRes" + + "ponse\022\027\n\017deletedEntities\030\001 \001(\005\022`\n\032delete" + + "dRootEntityReference\030\002 \001(\0132:.io.evitadb." + + "externalApi.grpc.generated.GrpcEntityRef" + + "erenceH\000\022T\n\021deletedRootEntity\030\003 \001(\01327.io" + + ".evitadb.externalApi.grpc.generated.Grpc" + + "SealedEntityH\000B\n\n\010response\"\213\001\n\032GrpcDelet" + + "eEntitiesResponse\022\027\n\017deletedEntities\030\001 \001" + + "(\005\022T\n\023deletedEntityBodies\030\002 \003(\01327.io.evi" + + "tadb.externalApi.grpc.generated.GrpcSeal" + + "edEntity\"y\n\027GrpcTransactionResponse\022\026\n\016c" + + "atalogVersion\030\001 \001(\003\022F\n\rtransactionId\030\002 \001" + + "(\0132/.io.evitadb.externalApi.grpc.generat" + + "ed.GrpcUuid\"\311\035\n\016GrpcQueryParam\022\025\n\013string" + + "Value\030\001 \001(\tH\000\022\026\n\014integerValue\030\002 \001(\005H\000\022\023\n" + + "\tlongValue\030\003 \001(\003H\000\022\026\n\014booleanValue\030\004 \001(\010" + + "H\000\022P\n\017bigDecimalValue\030\005 \001(\01325.io.evitadb" + + ".externalApi.grpc.generated.GrpcBigDecim" + + "alH\000\022V\n\022dateTimeRangeValue\030\006 \001(\01328.io.ev" + + "itadb.externalApi.grpc.generated.GrpcDat" + + "eTimeRangeH\000\022`\n\027integerNumberRangeValue\030" + + "\007 \001(\0132=.io.evitadb.externalApi.grpc.gene" + + "rated.GrpcIntegerNumberRangeH\000\022Z\n\024longNu" + + "mberRangeValue\030\010 \001(\0132:.io.evitadb.extern" + + "alApi.grpc.generated.GrpcLongNumberRange" + + "H\000\022f\n\032bigDecimalNumberRangeValue\030\t \001(\0132@" + + ".io.evitadb.externalApi.grpc.generated.G" + + "rpcBigDecimalNumberRangeH\000\022X\n\023offsetDate" + + "TimeValue\030\n \001(\01329.io.evitadb.externalApi" + + ".grpc.generated.GrpcOffsetDateTimeH\000\022H\n\013" + + "localeValue\030\013 \001(\01321.io.evitadb.externalA" + + "pi.grpc.generated.GrpcLocaleH\000\022L\n\rcurren" + + "cyValue\030\014 \001(\01323.io.evitadb.externalApi.g" + + "rpc.generated.GrpcCurrencyH\000\022d\n\031facetSta" + + "tisticsDepthValue\030\r \001(\0162?.io.evitadb.ext" + + "ernalApi.grpc.generated.GrpcFacetStatist" + + "icsDepthH\000\022Y\n\024queryPriceModelValue\030\016 \001(\016" + + "29.io.evitadb.externalApi.grpc.generated" + + ".GrpcQueryPriceModeH\000\022\\\n\025priceContentMod" + + "eValue\030\017 \001(\0162;.io.evitadb.externalApi.gr" + + "pc.generated.GrpcPriceContentModeH\000\022a\n\025a" + + "ttributeSpecialValue\030\020 \001(\0162@.io.evitadb." + + "externalApi.grpc.generated.GrpcAttribute" + + "SpecialValueH\000\022X\n\023orderDirectionValue\030\021 " + + "\001(\01629.io.evitadb.externalApi.grpc.genera" + + "ted.GrpcOrderDirectionH\000\022w\n emptyHierarc" + + "hicalEntityBehaviour\030\022 \001(\0162K.io.evitadb." + + "externalApi.grpc.generated.GrpcEmptyHier" + + "archicalEntityBehaviourH\000\022S\n\016statisticsB" + + "ase\030\023 \001(\01629.io.evitadb.externalApi.grpc." + + "generated.GrpcStatisticsBaseH\000\022S\n\016statis" + + "ticsType\030\024 \001(\01629.io.evitadb.externalApi." + + "grpc.generated.GrpcStatisticsTypeH\000\022Y\n\021h" + + "istogramBehavior\030\025 \001(\0162<.io.evitadb.exte" + + "rnalApi.grpc.generated.GrpcHistogramBeha" + + "viorH\000\022R\n\020stringArrayValue\030e \001(\01326.io.ev" + + "itadb.externalApi.grpc.generated.GrpcStr" + + "ingArrayH\000\022T\n\021integerArrayValue\030f \001(\01327." + "io.evitadb.externalApi.grpc.generated.Gr" + - "pcUuid\"\311\035\n\016GrpcQueryParam\022\025\n\013stringValue" + - "\030\001 \001(\tH\000\022\026\n\014integerValue\030\002 \001(\005H\000\022\023\n\tlong" + - "Value\030\003 \001(\003H\000\022\026\n\014booleanValue\030\004 \001(\010H\000\022P\n" + - "\017bigDecimalValue\030\005 \001(\01325.io.evitadb.exte" + - "rnalApi.grpc.generated.GrpcBigDecimalH\000\022" + - "V\n\022dateTimeRangeValue\030\006 \001(\01328.io.evitadb" + + "pcIntegerArrayH\000\022N\n\016longArrayValue\030g \001(\013" + + "24.io.evitadb.externalApi.grpc.generated" + + ".GrpcLongArrayH\000\022T\n\021booleanArrayValue\030h " + + "\001(\01327.io.evitadb.externalApi.grpc.genera" + + "ted.GrpcBooleanArrayH\000\022Z\n\024bigDecimalArra" + + "yValue\030i \001(\0132:.io.evitadb.externalApi.gr" + + "pc.generated.GrpcBigDecimalArrayH\000\022`\n\027da" + + "teTimeRangeArrayValue\030j \001(\0132=.io.evitadb" + ".externalApi.grpc.generated.GrpcDateTime" + - "RangeH\000\022`\n\027integerNumberRangeValue\030\007 \001(\013" + - "2=.io.evitadb.externalApi.grpc.generated" + - ".GrpcIntegerNumberRangeH\000\022Z\n\024longNumberR" + - "angeValue\030\010 \001(\0132:.io.evitadb.externalApi" + - ".grpc.generated.GrpcLongNumberRangeH\000\022f\n" + - "\032bigDecimalNumberRangeValue\030\t \001(\0132@.io.e" + - "vitadb.externalApi.grpc.generated.GrpcBi" + - "gDecimalNumberRangeH\000\022X\n\023offsetDateTimeV" + - "alue\030\n \001(\01329.io.evitadb.externalApi.grpc" + - ".generated.GrpcOffsetDateTimeH\000\022H\n\013local" + - "eValue\030\013 \001(\01321.io.evitadb.externalApi.gr" + - "pc.generated.GrpcLocaleH\000\022L\n\rcurrencyVal" + - "ue\030\014 \001(\01323.io.evitadb.externalApi.grpc.g" + - "enerated.GrpcCurrencyH\000\022d\n\031facetStatisti" + - "csDepthValue\030\r \001(\0162?.io.evitadb.external" + - "Api.grpc.generated.GrpcFacetStatisticsDe" + - "pthH\000\022Y\n\024queryPriceModelValue\030\016 \001(\01629.io" + + "RangeArrayH\000\022j\n\034integerNumberRangeArrayV" + + "alue\030k \001(\0132B.io.evitadb.externalApi.grpc" + + ".generated.GrpcIntegerNumberRangeArrayH\000" + + "\022d\n\031longNumberRangeArrayValue\030l \001(\0132?.io" + ".evitadb.externalApi.grpc.generated.Grpc" + - "QueryPriceModeH\000\022\\\n\025priceContentModeValu" + - "e\030\017 \001(\0162;.io.evitadb.externalApi.grpc.ge" + - "nerated.GrpcPriceContentModeH\000\022a\n\025attrib" + - "uteSpecialValue\030\020 \001(\0162@.io.evitadb.exter" + - "nalApi.grpc.generated.GrpcAttributeSpeci" + - "alValueH\000\022X\n\023orderDirectionValue\030\021 \001(\01629" + - ".io.evitadb.externalApi.grpc.generated.G" + - "rpcOrderDirectionH\000\022w\n emptyHierarchical" + - "EntityBehaviour\030\022 \001(\0162K.io.evitadb.exter" + - "nalApi.grpc.generated.GrpcEmptyHierarchi" + - "calEntityBehaviourH\000\022S\n\016statisticsBase\030\023" + - " \001(\01629.io.evitadb.externalApi.grpc.gener" + - "ated.GrpcStatisticsBaseH\000\022S\n\016statisticsT" + - "ype\030\024 \001(\01629.io.evitadb.externalApi.grpc." + - "generated.GrpcStatisticsTypeH\000\022Y\n\021histog" + - "ramBehavior\030\025 \001(\0162<.io.evitadb.externalA" + - "pi.grpc.generated.GrpcHistogramBehaviorH" + - "\000\022R\n\020stringArrayValue\030e \001(\01326.io.evitadb" + - ".externalApi.grpc.generated.GrpcStringAr" + - "rayH\000\022T\n\021integerArrayValue\030f \001(\01327.io.ev" + - "itadb.externalApi.grpc.generated.GrpcInt" + - "egerArrayH\000\022N\n\016longArrayValue\030g \001(\01324.io" + + "LongNumberRangeArrayH\000\022p\n\037bigDecimalNumb" + + "erRangeArrayValue\030m \001(\0132E.io.evitadb.ext" + + "ernalApi.grpc.generated.GrpcBigDecimalNu" + + "mberRangeArrayH\000\022b\n\030offsetDateTimeArrayV" + + "alue\030n \001(\0132>.io.evitadb.externalApi.grpc" + + ".generated.GrpcOffsetDateTimeArrayH\000\022R\n\020" + + "localeArrayValue\030o \001(\01326.io.evitadb.exte" + + "rnalApi.grpc.generated.GrpcLocaleArrayH\000" + + "\022V\n\022currencyArrayValue\030p \001(\01328.io.evitad" + + "b.externalApi.grpc.generated.GrpcCurrenc" + + "yArrayH\000\022n\n\036facetStatisticsDepthArrayVal" + + "ue\030q \001(\0132D.io.evitadb.externalApi.grpc.g" + + "enerated.GrpcFacetStatisticsDepthArrayH\000" + + "\022c\n\031queryPriceModelArrayValue\030r \001(\0132>.io" + ".evitadb.externalApi.grpc.generated.Grpc" + - "LongArrayH\000\022T\n\021booleanArrayValue\030h \001(\01327" + - ".io.evitadb.externalApi.grpc.generated.G" + - "rpcBooleanArrayH\000\022Z\n\024bigDecimalArrayValu" + - "e\030i \001(\0132:.io.evitadb.externalApi.grpc.ge" + - "nerated.GrpcBigDecimalArrayH\000\022`\n\027dateTim" + - "eRangeArrayValue\030j \001(\0132=.io.evitadb.exte" + - "rnalApi.grpc.generated.GrpcDateTimeRange" + - "ArrayH\000\022j\n\034integerNumberRangeArrayValue\030" + - "k \001(\0132B.io.evitadb.externalApi.grpc.gene" + - "rated.GrpcIntegerNumberRangeArrayH\000\022d\n\031l" + - "ongNumberRangeArrayValue\030l \001(\0132?.io.evit" + - "adb.externalApi.grpc.generated.GrpcLongN" + - "umberRangeArrayH\000\022p\n\037bigDecimalNumberRan" + - "geArrayValue\030m \001(\0132E.io.evitadb.external" + - "Api.grpc.generated.GrpcBigDecimalNumberR" + - "angeArrayH\000\022b\n\030offsetDateTimeArrayValue\030" + - "n \001(\0132>.io.evitadb.externalApi.grpc.gene" + - "rated.GrpcOffsetDateTimeArrayH\000\022R\n\020local" + - "eArrayValue\030o \001(\01326.io.evitadb.externalA" + - "pi.grpc.generated.GrpcLocaleArrayH\000\022V\n\022c" + - "urrencyArrayValue\030p \001(\01328.io.evitadb.ext" + - "ernalApi.grpc.generated.GrpcCurrencyArra" + - "yH\000\022n\n\036facetStatisticsDepthArrayValue\030q " + - "\001(\0132D.io.evitadb.externalApi.grpc.genera" + - "ted.GrpcFacetStatisticsDepthArrayH\000\022c\n\031q" + - "ueryPriceModelArrayValue\030r \001(\0132>.io.evit" + - "adb.externalApi.grpc.generated.GrpcQuery" + - "PriceModeArrayH\000\022f\n\032priceContentModeArra" + - "yValue\030s \001(\0132@.io.evitadb.externalApi.gr" + - "pc.generated.GrpcPriceContentModeArrayH\000" + - "\022k\n\032attributeSpecialArrayValue\030t \001(\0132E.i" + - "o.evitadb.externalApi.grpc.generated.Grp" + - "cAttributeSpecialValueArrayH\000\022b\n\030orderDi" + - "rectionArrayValue\030u \001(\0132>.io.evitadb.ext" + - "ernalApi.grpc.generated.GrpcOrderDirecti" + - "onArrayH\000\022\206\001\n*emptyHierarchicalEntityBeh" + - "aviourArrayValue\030v \001(\0132P.io.evitadb.exte" + - "rnalApi.grpc.generated.GrpcEmptyHierarch" + - "icalEntityBehaviourArrayH\000\022b\n\030statistics" + - "BaseArrayValue\030w \001(\0132>.io.evitadb.extern" + - "alApi.grpc.generated.GrpcStatisticsBaseA" + - "rrayH\000\022b\n\030statisticsTypeArrayValue\030x \001(\013" + - "2>.io.evitadb.externalApi.grpc.generated" + - ".GrpcStatisticsTypeArrayH\000\022p\n\037histogramB" + - "ehaviorTypeArrayValue\030y \001(\0132E.io.evitadb" + - ".externalApi.grpc.generated.GrpcHistogra" + - "mBehaviorTypeArrayH\000B\014\n\nqueryParam2\210\034\n\023E" + - "vitaSessionService\022l\n\020GetCatalogSchema\022\026" + - ".google.protobuf.Empty\032@.io.evitadb.exte" + - "rnalApi.grpc.generated.GrpcCatalogSchema" + - "Response\022j\n\017GetCatalogState\022\026.google.pro" + - "tobuf.Empty\032?.io.evitadb.externalApi.grp" + - "c.generated.GrpcCatalogStateResponse\022\222\001\n" + - "\017GetEntitySchema\022>.io.evitadb.externalAp" + - "i.grpc.generated.GrpcEntitySchemaRequest" + - "\032?.io.evitadb.externalApi.grpc.generated" + - ".GrpcEntitySchemaResponse\022k\n\021GetAllEntit" + - "yTypes\022\026.google.protobuf.Empty\032>.io.evit" + - "adb.externalApi.grpc.generated.GrpcEntit" + - "yTypesResponse\022k\n\016GoLiveAndClose\022\026.googl" + - "e.protobuf.Empty\032A.io.evitadb.externalAp" + - "i.grpc.generated.GrpcGoLiveAndCloseRespo" + - "nse\022i\n\rBackupCatalog\022\026.google.protobuf.E" + - "mpty\032@.io.evitadb.externalApi.grpc.gener" + - "ated.GrpcBackupCatalogResponse\022z\n\005Close\022" + - "7.io.evitadb.externalApi.grpc.generated." + - "GrpcCloseRequest\0328.io.evitadb.externalAp" + - "i.grpc.generated.GrpcCloseResponse\022\200\001\n\010Q" + - "ueryOne\0227.io.evitadb.externalApi.grpc.ge" + - "nerated.GrpcQueryRequest\032;.io.evitadb.ex" + - "ternalApi.grpc.generated.GrpcQueryOneRes" + - "ponse\022\202\001\n\tQueryList\0227.io.evitadb.externa" + - "lApi.grpc.generated.GrpcQueryRequest\032<.i" + - "o.evitadb.externalApi.grpc.generated.Grp" + - "cQueryListResponse\022z\n\005Query\0227.io.evitadb" + - ".externalApi.grpc.generated.GrpcQueryReq" + - "uest\0328.io.evitadb.externalApi.grpc.gener" + - "ated.GrpcQueryResponse\022\200\001\n\tGetEntity\0228.i" + - "o.evitadb.externalApi.grpc.generated.Grp" + - "cEntityRequest\0329.io.evitadb.externalApi." + - "grpc.generated.GrpcEntityResponse\022\244\001\n\023Up" + - "dateCatalogSchema\022E.io.evitadb.externalA" + - "pi.grpc.generated.GrpcUpdateCatalogSchem" + - "aRequest\032F.io.evitadb.externalApi.grpc.g" + - "enerated.GrpcUpdateCatalogSchemaResponse" + - "\022\264\001\n\033UpdateAndFetchCatalogSchema\022E.io.ev" + - "itadb.externalApi.grpc.generated.GrpcUpd" + - "ateCatalogSchemaRequest\032N.io.evitadb.ext" + - "ernalApi.grpc.generated.GrpcUpdateAndFet" + - "chCatalogSchemaResponse\022\241\001\n\022DefineEntity" + - "Schema\022D.io.evitadb.externalApi.grpc.gen" + - "erated.GrpcDefineEntitySchemaRequest\032E.i" + - "o.evitadb.externalApi.grpc.generated.Grp" + - "cDefineEntitySchemaResponse\022\241\001\n\022UpdateEn" + - "titySchema\022D.io.evitadb.externalApi.grpc" + - ".generated.GrpcUpdateEntitySchemaRequest" + - "\032E.io.evitadb.externalApi.grpc.generated" + - ".GrpcUpdateEntitySchemaResponse\022\261\001\n\032Upda" + - "teAndFetchEntitySchema\022D.io.evitadb.exte" + - "rnalApi.grpc.generated.GrpcUpdateEntityS" + - "chemaRequest\032M.io.evitadb.externalApi.gr" + - "pc.generated.GrpcUpdateAndFetchEntitySch" + - "emaResponse\022\233\001\n\020DeleteCollection\022B.io.ev" + - "itadb.externalApi.grpc.generated.GrpcDel" + - "eteCollectionRequest\032C.io.evitadb.extern" + - "alApi.grpc.generated.GrpcDeleteCollectio" + - "nResponse\022\233\001\n\020RenameCollection\022B.io.evit" + - "adb.externalApi.grpc.generated.GrpcRenam" + - "eCollectionRequest\032C.io.evitadb.external" + - "Api.grpc.generated.GrpcRenameCollectionR" + - "esponse\022\236\001\n\021ReplaceCollection\022C.io.evita" + - "db.externalApi.grpc.generated.GrpcReplac" + - "eCollectionRequest\032D.io.evitadb.external" + - "Api.grpc.generated.GrpcReplaceCollection" + - "Response\022\252\001\n\027GetEntityCollectionSize\022F.i" + - "o.evitadb.externalApi.grpc.generated.Grp" + - "cEntityCollectionSizeRequest\032G.io.evitad" + - "b.externalApi.grpc.generated.GrpcEntityC" + - "ollectionSizeResponse\022\217\001\n\014UpsertEntity\022>" + - ".io.evitadb.externalApi.grpc.generated.G" + - "rpcUpsertEntityRequest\032?.io.evitadb.exte" + - "rnalApi.grpc.generated.GrpcUpsertEntityR" + - "esponse\022\217\001\n\014DeleteEntity\022>.io.evitadb.ex" + - "ternalApi.grpc.generated.GrpcDeleteEntit" + - "yRequest\032?.io.evitadb.externalApi.grpc.g" + - "enerated.GrpcDeleteEntityResponse\022\255\001\n\033De" + - "leteEntityAndItsHierarchy\022>.io.evitadb.e" + - "xternalApi.grpc.generated.GrpcDeleteEnti" + - "tyRequest\032N.io.evitadb.externalApi.grpc." + - "generated.GrpcDeleteEntityAndItsHierarch" + - "yResponse\022\225\001\n\016DeleteEntities\022@.io.evitad" + - "b.externalApi.grpc.generated.GrpcDeleteE" + - "ntitiesRequest\032A.io.evitadb.externalApi." + - "grpc.generated.GrpcDeleteEntitiesRespons" + - "e\022j\n\020GetTransactionId\022\026.google.protobuf." + - "Empty\032>.io.evitadb.externalApi.grpc.gene" + - "rated.GrpcTransactionResponseB\014P\001\252\002\007Evit" + - "aDBb\006proto3" + "QueryPriceModeArrayH\000\022f\n\032priceContentMod" + + "eArrayValue\030s \001(\0132@.io.evitadb.externalA" + + "pi.grpc.generated.GrpcPriceContentModeAr" + + "rayH\000\022k\n\032attributeSpecialArrayValue\030t \001(" + + "\0132E.io.evitadb.externalApi.grpc.generate" + + "d.GrpcAttributeSpecialValueArrayH\000\022b\n\030or" + + "derDirectionArrayValue\030u \001(\0132>.io.evitad" + + "b.externalApi.grpc.generated.GrpcOrderDi" + + "rectionArrayH\000\022\206\001\n*emptyHierarchicalEnti" + + "tyBehaviourArrayValue\030v \001(\0132P.io.evitadb" + + ".externalApi.grpc.generated.GrpcEmptyHie" + + "rarchicalEntityBehaviourArrayH\000\022b\n\030stati" + + "sticsBaseArrayValue\030w \001(\0132>.io.evitadb.e" + + "xternalApi.grpc.generated.GrpcStatistics" + + "BaseArrayH\000\022b\n\030statisticsTypeArrayValue\030" + + "x \001(\0132>.io.evitadb.externalApi.grpc.gene" + + "rated.GrpcStatisticsTypeArrayH\000\022p\n\037histo" + + "gramBehaviorTypeArrayValue\030y \001(\0132E.io.ev" + + "itadb.externalApi.grpc.generated.GrpcHis" + + "togramBehaviorTypeArrayH\000B\014\n\nqueryParam2" + + "\210\034\n\023EvitaSessionService\022l\n\020GetCatalogSch" + + "ema\022\026.google.protobuf.Empty\032@.io.evitadb" + + ".externalApi.grpc.generated.GrpcCatalogS" + + "chemaResponse\022j\n\017GetCatalogState\022\026.googl" + + "e.protobuf.Empty\032?.io.evitadb.externalAp" + + "i.grpc.generated.GrpcCatalogStateRespons" + + "e\022\222\001\n\017GetEntitySchema\022>.io.evitadb.exter" + + "nalApi.grpc.generated.GrpcEntitySchemaRe" + + "quest\032?.io.evitadb.externalApi.grpc.gene" + + "rated.GrpcEntitySchemaResponse\022k\n\021GetAll" + + "EntityTypes\022\026.google.protobuf.Empty\032>.io" + + ".evitadb.externalApi.grpc.generated.Grpc" + + "EntityTypesResponse\022k\n\016GoLiveAndClose\022\026." + + "google.protobuf.Empty\032A.io.evitadb.exter" + + "nalApi.grpc.generated.GrpcGoLiveAndClose" + + "Response\022i\n\rBackupCatalog\022\026.google.proto" + + "buf.Empty\032@.io.evitadb.externalApi.grpc." + + "generated.GrpcBackupCatalogResponse\022z\n\005C" + + "lose\0227.io.evitadb.externalApi.grpc.gener" + + "ated.GrpcCloseRequest\0328.io.evitadb.exter" + + "nalApi.grpc.generated.GrpcCloseResponse\022" + + "\200\001\n\010QueryOne\0227.io.evitadb.externalApi.gr" + + "pc.generated.GrpcQueryRequest\032;.io.evita" + + "db.externalApi.grpc.generated.GrpcQueryO" + + "neResponse\022\202\001\n\tQueryList\0227.io.evitadb.ex" + + "ternalApi.grpc.generated.GrpcQueryReques" + + "t\032<.io.evitadb.externalApi.grpc.generate" + + "d.GrpcQueryListResponse\022z\n\005Query\0227.io.ev" + + "itadb.externalApi.grpc.generated.GrpcQue" + + "ryRequest\0328.io.evitadb.externalApi.grpc." + + "generated.GrpcQueryResponse\022\200\001\n\tGetEntit" + + "y\0228.io.evitadb.externalApi.grpc.generate" + + "d.GrpcEntityRequest\0329.io.evitadb.externa" + + "lApi.grpc.generated.GrpcEntityResponse\022\244" + + "\001\n\023UpdateCatalogSchema\022E.io.evitadb.exte" + + "rnalApi.grpc.generated.GrpcUpdateCatalog" + + "SchemaRequest\032F.io.evitadb.externalApi.g" + + "rpc.generated.GrpcUpdateCatalogSchemaRes" + + "ponse\022\264\001\n\033UpdateAndFetchCatalogSchema\022E." + + "io.evitadb.externalApi.grpc.generated.Gr" + + "pcUpdateCatalogSchemaRequest\032N.io.evitad" + + "b.externalApi.grpc.generated.GrpcUpdateA" + + "ndFetchCatalogSchemaResponse\022\241\001\n\022DefineE" + + "ntitySchema\022D.io.evitadb.externalApi.grp" + + "c.generated.GrpcDefineEntitySchemaReques" + + "t\032E.io.evitadb.externalApi.grpc.generate" + + "d.GrpcDefineEntitySchemaResponse\022\241\001\n\022Upd" + + "ateEntitySchema\022D.io.evitadb.externalApi" + + ".grpc.generated.GrpcUpdateEntitySchemaRe" + + "quest\032E.io.evitadb.externalApi.grpc.gene" + + "rated.GrpcUpdateEntitySchemaResponse\022\261\001\n" + + "\032UpdateAndFetchEntitySchema\022D.io.evitadb" + + ".externalApi.grpc.generated.GrpcUpdateEn" + + "titySchemaRequest\032M.io.evitadb.externalA" + + "pi.grpc.generated.GrpcUpdateAndFetchEnti" + + "tySchemaResponse\022\233\001\n\020DeleteCollection\022B." + + "io.evitadb.externalApi.grpc.generated.Gr" + + "pcDeleteCollectionRequest\032C.io.evitadb.e" + + "xternalApi.grpc.generated.GrpcDeleteColl" + + "ectionResponse\022\233\001\n\020RenameCollection\022B.io" + + ".evitadb.externalApi.grpc.generated.Grpc" + + "RenameCollectionRequest\032C.io.evitadb.ext" + + "ernalApi.grpc.generated.GrpcRenameCollec" + + "tionResponse\022\236\001\n\021ReplaceCollection\022C.io." + + "evitadb.externalApi.grpc.generated.GrpcR" + + "eplaceCollectionRequest\032D.io.evitadb.ext" + + "ernalApi.grpc.generated.GrpcReplaceColle" + + "ctionResponse\022\252\001\n\027GetEntityCollectionSiz" + + "e\022F.io.evitadb.externalApi.grpc.generate" + + "d.GrpcEntityCollectionSizeRequest\032G.io.e" + + "vitadb.externalApi.grpc.generated.GrpcEn" + + "tityCollectionSizeResponse\022\217\001\n\014UpsertEnt" + + "ity\022>.io.evitadb.externalApi.grpc.genera" + + "ted.GrpcUpsertEntityRequest\032?.io.evitadb" + + ".externalApi.grpc.generated.GrpcUpsertEn" + + "tityResponse\022\217\001\n\014DeleteEntity\022>.io.evita" + + "db.externalApi.grpc.generated.GrpcDelete" + + "EntityRequest\032?.io.evitadb.externalApi.g" + + "rpc.generated.GrpcDeleteEntityResponse\022\255" + + "\001\n\033DeleteEntityAndItsHierarchy\022>.io.evit" + + "adb.externalApi.grpc.generated.GrpcDelet" + + "eEntityRequest\032N.io.evitadb.externalApi." + + "grpc.generated.GrpcDeleteEntityAndItsHie" + + "rarchyResponse\022\225\001\n\016DeleteEntities\022@.io.e" + + "vitadb.externalApi.grpc.generated.GrpcDe" + + "leteEntitiesRequest\032A.io.evitadb.externa" + + "lApi.grpc.generated.GrpcDeleteEntitiesRe" + + "sponse\022j\n\020GetTransactionId\022\026.google.prot" + + "obuf.Empty\032>.io.evitadb.externalApi.grpc" + + ".generated.GrpcTransactionResponseB\014P\001\252\002" + + "\007EvitaDBb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -833,7 +834,7 @@ public static void registerAllExtensions( internal_static_io_evitadb_externalApi_grpc_generated_GrpcBackupCatalogResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_io_evitadb_externalApi_grpc_generated_GrpcBackupCatalogResponse_descriptor, - new java.lang.String[] { "BackupFile", }); + new java.lang.String[] { "TaskId", }); internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityTypesResponse_descriptor = getDescriptor().getMessageTypes().get(29); internal_static_io_evitadb_externalApi_grpc_generated_GrpcEntityTypesResponse_fieldAccessorTable = new diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileRequest.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileRequest.java new file mode 100644 index 000000000..f3c1c84b5 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileRequest.java @@ -0,0 +1,686 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Request to get single file by id
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest} + */ +public final class GrpcFetchFileRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest) + GrpcFetchFileRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcFetchFileRequest.newBuilder() to construct. + private GrpcFetchFileRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcFetchFileRequest() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcFetchFileRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcFetchFileRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder subBuilder = null; + if (fileId_ != null) { + subBuilder = fileId_.toBuilder(); + } + fileId_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcUuid.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(fileId_); + fileId_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest.class, io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest.Builder.class); + } + + public static final int FILEID_FIELD_NUMBER = 1; + private io.evitadb.externalApi.grpc.generated.GrpcUuid fileId_; + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return Whether the fileId field is set. + */ + @java.lang.Override + public boolean hasFileId() { + return fileId_ != null; + } + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return The fileId. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuid getFileId() { + return fileId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : fileId_; + } + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getFileIdOrBuilder() { + return getFileId(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (fileId_ != null) { + output.writeMessage(1, getFileId()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (fileId_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getFileId()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest other = (io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest) obj; + + if (hasFileId() != other.hasFileId()) return false; + if (hasFileId()) { + if (!getFileId() + .equals(other.getFileId())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasFileId()) { + hash = (37 * hash) + FILEID_FIELD_NUMBER; + hash = (53 * hash) + getFileId().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Request to get single file by id
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest) + io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest.class, io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (fileIdBuilder_ == null) { + fileId_ = null; + } else { + fileId_ = null; + fileIdBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileRequest_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest build() { + io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest result = new io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest(this); + if (fileIdBuilder_ == null) { + result.fileId_ = fileId_; + } else { + result.fileId_ = fileIdBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest.getDefaultInstance()) return this; + if (other.hasFileId()) { + mergeFileId(other.getFileId()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private io.evitadb.externalApi.grpc.generated.GrpcUuid fileId_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> fileIdBuilder_; + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return Whether the fileId field is set. + */ + public boolean hasFileId() { + return fileIdBuilder_ != null || fileId_ != null; + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return The fileId. + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid getFileId() { + if (fileIdBuilder_ == null) { + return fileId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : fileId_; + } else { + return fileIdBuilder_.getMessage(); + } + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public Builder setFileId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (fileIdBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + fileId_ = value; + onChanged(); + } else { + fileIdBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public Builder setFileId( + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder builderForValue) { + if (fileIdBuilder_ == null) { + fileId_ = builderForValue.build(); + onChanged(); + } else { + fileIdBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public Builder mergeFileId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (fileIdBuilder_ == null) { + if (fileId_ != null) { + fileId_ = + io.evitadb.externalApi.grpc.generated.GrpcUuid.newBuilder(fileId_).mergeFrom(value).buildPartial(); + } else { + fileId_ = value; + } + onChanged(); + } else { + fileIdBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public Builder clearFileId() { + if (fileIdBuilder_ == null) { + fileId_ = null; + onChanged(); + } else { + fileId_ = null; + fileIdBuilder_ = null; + } + + return this; + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder getFileIdBuilder() { + + onChanged(); + return getFileIdFieldBuilder().getBuilder(); + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getFileIdOrBuilder() { + if (fileIdBuilder_ != null) { + return fileIdBuilder_.getMessageOrBuilder(); + } else { + return fileId_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : fileId_; + } + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> + getFileIdFieldBuilder() { + if (fileIdBuilder_ == null) { + fileIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder>( + getFileId(), + getParentForChildren(), + isClean()); + fileId_ = null; + } + return fileIdBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest) + private static final io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcFetchFileRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcFetchFileRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileRequestOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileRequestOrBuilder.java new file mode 100644 index 000000000..210c20e0f --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileRequestOrBuilder.java @@ -0,0 +1,59 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +public interface GrpcFetchFileRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcFetchFileRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return Whether the fileId field is set. + */ + boolean hasFileId(); + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return The fileId. + */ + io.evitadb.externalApi.grpc.generated.GrpcUuid getFileId(); + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getFileIdOrBuilder(); +} diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileResponse.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileResponse.java new file mode 100644 index 000000000..672185bce --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileResponse.java @@ -0,0 +1,615 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Response to a task status request.
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse} + */ +public final class GrpcFetchFileResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse) + GrpcFetchFileResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcFetchFileResponse.newBuilder() to construct. + private GrpcFetchFileResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcFetchFileResponse() { + fileContents_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcFetchFileResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcFetchFileResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + + fileContents_ = input.readBytes(); + break; + } + case 16: { + + totalSizeInBytes_ = input.readInt64(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse.class, io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse.Builder.class); + } + + public static final int FILECONTENTS_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString fileContents_; + /** + *
+   * chunk of the file content
+   * 
+ * + * bytes fileContents = 1; + * @return The fileContents. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFileContents() { + return fileContents_; + } + + public static final int TOTALSIZEINBYTES_FIELD_NUMBER = 2; + private long totalSizeInBytes_; + /** + *
+   * total size of the file
+   * 
+ * + * int64 totalSizeInBytes = 2; + * @return The totalSizeInBytes. + */ + @java.lang.Override + public long getTotalSizeInBytes() { + return totalSizeInBytes_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!fileContents_.isEmpty()) { + output.writeBytes(1, fileContents_); + } + if (totalSizeInBytes_ != 0L) { + output.writeInt64(2, totalSizeInBytes_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!fileContents_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, fileContents_); + } + if (totalSizeInBytes_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, totalSizeInBytes_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse other = (io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse) obj; + + if (!getFileContents() + .equals(other.getFileContents())) return false; + if (getTotalSizeInBytes() + != other.getTotalSizeInBytes()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + FILECONTENTS_FIELD_NUMBER; + hash = (53 * hash) + getFileContents().hashCode(); + hash = (37 * hash) + TOTALSIZEINBYTES_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalSizeInBytes()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Response to a task status request.
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse) + io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse.class, io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + fileContents_ = com.google.protobuf.ByteString.EMPTY; + + totalSizeInBytes_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFetchFileResponse_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse build() { + io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse result = new io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse(this); + result.fileContents_ = fileContents_; + result.totalSizeInBytes_ = totalSizeInBytes_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse.getDefaultInstance()) return this; + if (other.getFileContents() != com.google.protobuf.ByteString.EMPTY) { + setFileContents(other.getFileContents()); + } + if (other.getTotalSizeInBytes() != 0L) { + setTotalSizeInBytes(other.getTotalSizeInBytes()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.ByteString fileContents_ = com.google.protobuf.ByteString.EMPTY; + /** + *
+     * chunk of the file content
+     * 
+ * + * bytes fileContents = 1; + * @return The fileContents. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFileContents() { + return fileContents_; + } + /** + *
+     * chunk of the file content
+     * 
+ * + * bytes fileContents = 1; + * @param value The fileContents to set. + * @return This builder for chaining. + */ + public Builder setFileContents(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + fileContents_ = value; + onChanged(); + return this; + } + /** + *
+     * chunk of the file content
+     * 
+ * + * bytes fileContents = 1; + * @return This builder for chaining. + */ + public Builder clearFileContents() { + + fileContents_ = getDefaultInstance().getFileContents(); + onChanged(); + return this; + } + + private long totalSizeInBytes_ ; + /** + *
+     * total size of the file
+     * 
+ * + * int64 totalSizeInBytes = 2; + * @return The totalSizeInBytes. + */ + @java.lang.Override + public long getTotalSizeInBytes() { + return totalSizeInBytes_; + } + /** + *
+     * total size of the file
+     * 
+ * + * int64 totalSizeInBytes = 2; + * @param value The totalSizeInBytes to set. + * @return This builder for chaining. + */ + public Builder setTotalSizeInBytes(long value) { + + totalSizeInBytes_ = value; + onChanged(); + return this; + } + /** + *
+     * total size of the file
+     * 
+ * + * int64 totalSizeInBytes = 2; + * @return This builder for chaining. + */ + public Builder clearTotalSizeInBytes() { + + totalSizeInBytes_ = 0L; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse) + private static final io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcFetchFileResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcFetchFileResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileResponseOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileResponseOrBuilder.java new file mode 100644 index 000000000..b3317c2b4 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFetchFileResponseOrBuilder.java @@ -0,0 +1,52 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +public interface GrpcFetchFileResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcFetchFileResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * chunk of the file content
+   * 
+ * + * bytes fileContents = 1; + * @return The fileContents. + */ + com.google.protobuf.ByteString getFileContents(); + + /** + *
+   * total size of the file
+   * 
+ * + * int64 totalSizeInBytes = 2; + * @return The totalSizeInBytes. + */ + long getTotalSizeInBytes(); +} diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFile.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFile.java new file mode 100644 index 000000000..cfa800df6 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFile.java @@ -0,0 +1,1571 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * identification of the file available for fetching
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcFile} + */ +public final class GrpcFile extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcFile) + GrpcFileOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcFile.newBuilder() to construct. + private GrpcFile(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcFile() { + name_ = ""; + contentType_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcFile(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcFile( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder subBuilder = null; + if (fileId_ != null) { + subBuilder = fileId_.toBuilder(); + } + fileId_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcUuid.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(fileId_); + fileId_ = subBuilder.buildPartial(); + } + + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 26: { + com.google.protobuf.StringValue.Builder subBuilder = null; + if (description_ != null) { + subBuilder = description_.toBuilder(); + } + description_ = input.readMessage(com.google.protobuf.StringValue.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(description_); + description_ = subBuilder.buildPartial(); + } + + break; + } + case 34: { + java.lang.String s = input.readStringRequireUtf8(); + + contentType_ = s; + break; + } + case 40: { + + totalSizeInBytes_ = input.readInt64(); + break; + } + case 50: { + com.google.protobuf.StringValue.Builder subBuilder = null; + if (origin_ != null) { + subBuilder = origin_.toBuilder(); + } + origin_ = input.readMessage(com.google.protobuf.StringValue.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(origin_); + origin_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFile_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFile_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcFile.class, io.evitadb.externalApi.grpc.generated.GrpcFile.Builder.class); + } + + public static final int FILEID_FIELD_NUMBER = 1; + private io.evitadb.externalApi.grpc.generated.GrpcUuid fileId_; + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return Whether the fileId field is set. + */ + @java.lang.Override + public boolean hasFileId() { + return fileId_ != null; + } + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return The fileId. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuid getFileId() { + return fileId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : fileId_; + } + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getFileIdOrBuilder() { + return getFileId(); + } + + public static final int NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object name_; + /** + *
+   * File name
+   * 
+ * + * string name = 2; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * File name
+   * 
+ * + * string name = 2; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 3; + private com.google.protobuf.StringValue description_; + /** + *
+   * Detailed description of the file
+   * 
+ * + * .google.protobuf.StringValue description = 3; + * @return Whether the description field is set. + */ + @java.lang.Override + public boolean hasDescription() { + return description_ != null; + } + /** + *
+   * Detailed description of the file
+   * 
+ * + * .google.protobuf.StringValue description = 3; + * @return The description. + */ + @java.lang.Override + public com.google.protobuf.StringValue getDescription() { + return description_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : description_; + } + /** + *
+   * Detailed description of the file
+   * 
+ * + * .google.protobuf.StringValue description = 3; + */ + @java.lang.Override + public com.google.protobuf.StringValueOrBuilder getDescriptionOrBuilder() { + return getDescription(); + } + + public static final int CONTENTTYPE_FIELD_NUMBER = 4; + private volatile java.lang.Object contentType_; + /** + *
+   * Content type of the file
+   * 
+ * + * string contentType = 4; + * @return The contentType. + */ + @java.lang.Override + public java.lang.String getContentType() { + java.lang.Object ref = contentType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contentType_ = s; + return s; + } + } + /** + *
+   * Content type of the file
+   * 
+ * + * string contentType = 4; + * @return The bytes for contentType. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getContentTypeBytes() { + java.lang.Object ref = contentType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contentType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TOTALSIZEINBYTES_FIELD_NUMBER = 5; + private long totalSizeInBytes_; + /** + *
+   * Size of the file in bytes
+   * 
+ * + * int64 totalSizeInBytes = 5; + * @return The totalSizeInBytes. + */ + @java.lang.Override + public long getTotalSizeInBytes() { + return totalSizeInBytes_; + } + + public static final int ORIGIN_FIELD_NUMBER = 6; + private com.google.protobuf.StringValue origin_; + /** + *
+   * Origin of the file (usually the taskType)
+   * 
+ * + * .google.protobuf.StringValue origin = 6; + * @return Whether the origin field is set. + */ + @java.lang.Override + public boolean hasOrigin() { + return origin_ != null; + } + /** + *
+   * Origin of the file (usually the taskType)
+   * 
+ * + * .google.protobuf.StringValue origin = 6; + * @return The origin. + */ + @java.lang.Override + public com.google.protobuf.StringValue getOrigin() { + return origin_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : origin_; + } + /** + *
+   * Origin of the file (usually the taskType)
+   * 
+ * + * .google.protobuf.StringValue origin = 6; + */ + @java.lang.Override + public com.google.protobuf.StringValueOrBuilder getOriginOrBuilder() { + return getOrigin(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (fileId_ != null) { + output.writeMessage(1, getFileId()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_); + } + if (description_ != null) { + output.writeMessage(3, getDescription()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(contentType_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, contentType_); + } + if (totalSizeInBytes_ != 0L) { + output.writeInt64(5, totalSizeInBytes_); + } + if (origin_ != null) { + output.writeMessage(6, getOrigin()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (fileId_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getFileId()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_); + } + if (description_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getDescription()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(contentType_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, contentType_); + } + if (totalSizeInBytes_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(5, totalSizeInBytes_); + } + if (origin_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getOrigin()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcFile)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcFile other = (io.evitadb.externalApi.grpc.generated.GrpcFile) obj; + + if (hasFileId() != other.hasFileId()) return false; + if (hasFileId()) { + if (!getFileId() + .equals(other.getFileId())) return false; + } + if (!getName() + .equals(other.getName())) return false; + if (hasDescription() != other.hasDescription()) return false; + if (hasDescription()) { + if (!getDescription() + .equals(other.getDescription())) return false; + } + if (!getContentType() + .equals(other.getContentType())) return false; + if (getTotalSizeInBytes() + != other.getTotalSizeInBytes()) return false; + if (hasOrigin() != other.hasOrigin()) return false; + if (hasOrigin()) { + if (!getOrigin() + .equals(other.getOrigin())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasFileId()) { + hash = (37 * hash) + FILEID_FIELD_NUMBER; + hash = (53 * hash) + getFileId().hashCode(); + } + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasDescription()) { + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + } + hash = (37 * hash) + CONTENTTYPE_FIELD_NUMBER; + hash = (53 * hash) + getContentType().hashCode(); + hash = (37 * hash) + TOTALSIZEINBYTES_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalSizeInBytes()); + if (hasOrigin()) { + hash = (37 * hash) + ORIGIN_FIELD_NUMBER; + hash = (53 * hash) + getOrigin().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFile parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcFile prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * identification of the file available for fetching
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcFile} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcFile) + io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFile_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFile_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcFile.class, io.evitadb.externalApi.grpc.generated.GrpcFile.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcFile.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (fileIdBuilder_ == null) { + fileId_ = null; + } else { + fileId_ = null; + fileIdBuilder_ = null; + } + name_ = ""; + + if (descriptionBuilder_ == null) { + description_ = null; + } else { + description_ = null; + descriptionBuilder_ = null; + } + contentType_ = ""; + + totalSizeInBytes_ = 0L; + + if (originBuilder_ == null) { + origin_ = null; + } else { + origin_ = null; + originBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFile_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFile getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcFile.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFile build() { + io.evitadb.externalApi.grpc.generated.GrpcFile result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFile buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcFile result = new io.evitadb.externalApi.grpc.generated.GrpcFile(this); + if (fileIdBuilder_ == null) { + result.fileId_ = fileId_; + } else { + result.fileId_ = fileIdBuilder_.build(); + } + result.name_ = name_; + if (descriptionBuilder_ == null) { + result.description_ = description_; + } else { + result.description_ = descriptionBuilder_.build(); + } + result.contentType_ = contentType_; + result.totalSizeInBytes_ = totalSizeInBytes_; + if (originBuilder_ == null) { + result.origin_ = origin_; + } else { + result.origin_ = originBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcFile) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcFile)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcFile other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcFile.getDefaultInstance()) return this; + if (other.hasFileId()) { + mergeFileId(other.getFileId()); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.hasDescription()) { + mergeDescription(other.getDescription()); + } + if (!other.getContentType().isEmpty()) { + contentType_ = other.contentType_; + onChanged(); + } + if (other.getTotalSizeInBytes() != 0L) { + setTotalSizeInBytes(other.getTotalSizeInBytes()); + } + if (other.hasOrigin()) { + mergeOrigin(other.getOrigin()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcFile parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcFile) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private io.evitadb.externalApi.grpc.generated.GrpcUuid fileId_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> fileIdBuilder_; + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return Whether the fileId field is set. + */ + public boolean hasFileId() { + return fileIdBuilder_ != null || fileId_ != null; + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return The fileId. + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid getFileId() { + if (fileIdBuilder_ == null) { + return fileId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : fileId_; + } else { + return fileIdBuilder_.getMessage(); + } + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public Builder setFileId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (fileIdBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + fileId_ = value; + onChanged(); + } else { + fileIdBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public Builder setFileId( + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder builderForValue) { + if (fileIdBuilder_ == null) { + fileId_ = builderForValue.build(); + onChanged(); + } else { + fileIdBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public Builder mergeFileId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (fileIdBuilder_ == null) { + if (fileId_ != null) { + fileId_ = + io.evitadb.externalApi.grpc.generated.GrpcUuid.newBuilder(fileId_).mergeFrom(value).buildPartial(); + } else { + fileId_ = value; + } + onChanged(); + } else { + fileIdBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public Builder clearFileId() { + if (fileIdBuilder_ == null) { + fileId_ = null; + onChanged(); + } else { + fileId_ = null; + fileIdBuilder_ = null; + } + + return this; + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder getFileIdBuilder() { + + onChanged(); + return getFileIdFieldBuilder().getBuilder(); + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getFileIdOrBuilder() { + if (fileIdBuilder_ != null) { + return fileIdBuilder_.getMessageOrBuilder(); + } else { + return fileId_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : fileId_; + } + } + /** + *
+     * Identification of the file
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> + getFileIdFieldBuilder() { + if (fileIdBuilder_ == null) { + fileIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder>( + getFileId(), + getParentForChildren(), + isClean()); + fileId_ = null; + } + return fileIdBuilder_; + } + + private java.lang.Object name_ = ""; + /** + *
+     * File name
+     * 
+ * + * string name = 2; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * File name
+     * 
+ * + * string name = 2; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * File name
+     * 
+ * + * string name = 2; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * File name
+     * 
+ * + * string name = 2; + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * File name
+     * 
+ * + * string name = 2; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.StringValue description_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> descriptionBuilder_; + /** + *
+     * Detailed description of the file
+     * 
+ * + * .google.protobuf.StringValue description = 3; + * @return Whether the description field is set. + */ + public boolean hasDescription() { + return descriptionBuilder_ != null || description_ != null; + } + /** + *
+     * Detailed description of the file
+     * 
+ * + * .google.protobuf.StringValue description = 3; + * @return The description. + */ + public com.google.protobuf.StringValue getDescription() { + if (descriptionBuilder_ == null) { + return description_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : description_; + } else { + return descriptionBuilder_.getMessage(); + } + } + /** + *
+     * Detailed description of the file
+     * 
+ * + * .google.protobuf.StringValue description = 3; + */ + public Builder setDescription(com.google.protobuf.StringValue value) { + if (descriptionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + description_ = value; + onChanged(); + } else { + descriptionBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Detailed description of the file
+     * 
+ * + * .google.protobuf.StringValue description = 3; + */ + public Builder setDescription( + com.google.protobuf.StringValue.Builder builderForValue) { + if (descriptionBuilder_ == null) { + description_ = builderForValue.build(); + onChanged(); + } else { + descriptionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Detailed description of the file
+     * 
+ * + * .google.protobuf.StringValue description = 3; + */ + public Builder mergeDescription(com.google.protobuf.StringValue value) { + if (descriptionBuilder_ == null) { + if (description_ != null) { + description_ = + com.google.protobuf.StringValue.newBuilder(description_).mergeFrom(value).buildPartial(); + } else { + description_ = value; + } + onChanged(); + } else { + descriptionBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Detailed description of the file
+     * 
+ * + * .google.protobuf.StringValue description = 3; + */ + public Builder clearDescription() { + if (descriptionBuilder_ == null) { + description_ = null; + onChanged(); + } else { + description_ = null; + descriptionBuilder_ = null; + } + + return this; + } + /** + *
+     * Detailed description of the file
+     * 
+ * + * .google.protobuf.StringValue description = 3; + */ + public com.google.protobuf.StringValue.Builder getDescriptionBuilder() { + + onChanged(); + return getDescriptionFieldBuilder().getBuilder(); + } + /** + *
+     * Detailed description of the file
+     * 
+ * + * .google.protobuf.StringValue description = 3; + */ + public com.google.protobuf.StringValueOrBuilder getDescriptionOrBuilder() { + if (descriptionBuilder_ != null) { + return descriptionBuilder_.getMessageOrBuilder(); + } else { + return description_ == null ? + com.google.protobuf.StringValue.getDefaultInstance() : description_; + } + } + /** + *
+     * Detailed description of the file
+     * 
+ * + * .google.protobuf.StringValue description = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> + getDescriptionFieldBuilder() { + if (descriptionBuilder_ == null) { + descriptionBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder>( + getDescription(), + getParentForChildren(), + isClean()); + description_ = null; + } + return descriptionBuilder_; + } + + private java.lang.Object contentType_ = ""; + /** + *
+     * Content type of the file
+     * 
+ * + * string contentType = 4; + * @return The contentType. + */ + public java.lang.String getContentType() { + java.lang.Object ref = contentType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contentType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Content type of the file
+     * 
+ * + * string contentType = 4; + * @return The bytes for contentType. + */ + public com.google.protobuf.ByteString + getContentTypeBytes() { + java.lang.Object ref = contentType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contentType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Content type of the file
+     * 
+ * + * string contentType = 4; + * @param value The contentType to set. + * @return This builder for chaining. + */ + public Builder setContentType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + contentType_ = value; + onChanged(); + return this; + } + /** + *
+     * Content type of the file
+     * 
+ * + * string contentType = 4; + * @return This builder for chaining. + */ + public Builder clearContentType() { + + contentType_ = getDefaultInstance().getContentType(); + onChanged(); + return this; + } + /** + *
+     * Content type of the file
+     * 
+ * + * string contentType = 4; + * @param value The bytes for contentType to set. + * @return This builder for chaining. + */ + public Builder setContentTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + contentType_ = value; + onChanged(); + return this; + } + + private long totalSizeInBytes_ ; + /** + *
+     * Size of the file in bytes
+     * 
+ * + * int64 totalSizeInBytes = 5; + * @return The totalSizeInBytes. + */ + @java.lang.Override + public long getTotalSizeInBytes() { + return totalSizeInBytes_; + } + /** + *
+     * Size of the file in bytes
+     * 
+ * + * int64 totalSizeInBytes = 5; + * @param value The totalSizeInBytes to set. + * @return This builder for chaining. + */ + public Builder setTotalSizeInBytes(long value) { + + totalSizeInBytes_ = value; + onChanged(); + return this; + } + /** + *
+     * Size of the file in bytes
+     * 
+ * + * int64 totalSizeInBytes = 5; + * @return This builder for chaining. + */ + public Builder clearTotalSizeInBytes() { + + totalSizeInBytes_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.StringValue origin_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> originBuilder_; + /** + *
+     * Origin of the file (usually the taskType)
+     * 
+ * + * .google.protobuf.StringValue origin = 6; + * @return Whether the origin field is set. + */ + public boolean hasOrigin() { + return originBuilder_ != null || origin_ != null; + } + /** + *
+     * Origin of the file (usually the taskType)
+     * 
+ * + * .google.protobuf.StringValue origin = 6; + * @return The origin. + */ + public com.google.protobuf.StringValue getOrigin() { + if (originBuilder_ == null) { + return origin_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : origin_; + } else { + return originBuilder_.getMessage(); + } + } + /** + *
+     * Origin of the file (usually the taskType)
+     * 
+ * + * .google.protobuf.StringValue origin = 6; + */ + public Builder setOrigin(com.google.protobuf.StringValue value) { + if (originBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + origin_ = value; + onChanged(); + } else { + originBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Origin of the file (usually the taskType)
+     * 
+ * + * .google.protobuf.StringValue origin = 6; + */ + public Builder setOrigin( + com.google.protobuf.StringValue.Builder builderForValue) { + if (originBuilder_ == null) { + origin_ = builderForValue.build(); + onChanged(); + } else { + originBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Origin of the file (usually the taskType)
+     * 
+ * + * .google.protobuf.StringValue origin = 6; + */ + public Builder mergeOrigin(com.google.protobuf.StringValue value) { + if (originBuilder_ == null) { + if (origin_ != null) { + origin_ = + com.google.protobuf.StringValue.newBuilder(origin_).mergeFrom(value).buildPartial(); + } else { + origin_ = value; + } + onChanged(); + } else { + originBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Origin of the file (usually the taskType)
+     * 
+ * + * .google.protobuf.StringValue origin = 6; + */ + public Builder clearOrigin() { + if (originBuilder_ == null) { + origin_ = null; + onChanged(); + } else { + origin_ = null; + originBuilder_ = null; + } + + return this; + } + /** + *
+     * Origin of the file (usually the taskType)
+     * 
+ * + * .google.protobuf.StringValue origin = 6; + */ + public com.google.protobuf.StringValue.Builder getOriginBuilder() { + + onChanged(); + return getOriginFieldBuilder().getBuilder(); + } + /** + *
+     * Origin of the file (usually the taskType)
+     * 
+ * + * .google.protobuf.StringValue origin = 6; + */ + public com.google.protobuf.StringValueOrBuilder getOriginOrBuilder() { + if (originBuilder_ != null) { + return originBuilder_.getMessageOrBuilder(); + } else { + return origin_ == null ? + com.google.protobuf.StringValue.getDefaultInstance() : origin_; + } + } + /** + *
+     * Origin of the file (usually the taskType)
+     * 
+ * + * .google.protobuf.StringValue origin = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> + getOriginFieldBuilder() { + if (originBuilder_ == null) { + originBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder>( + getOrigin(), + getParentForChildren(), + isClean()); + origin_ = null; + } + return originBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcFile) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcFile) + private static final io.evitadb.externalApi.grpc.generated.GrpcFile DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcFile(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcFile getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcFile parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcFile(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFile getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFileOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFileOrBuilder.java new file mode 100644 index 000000000..f93b2ab83 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFileOrBuilder.java @@ -0,0 +1,163 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +public interface GrpcFileOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcFile) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return Whether the fileId field is set. + */ + boolean hasFileId(); + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + * @return The fileId. + */ + io.evitadb.externalApi.grpc.generated.GrpcUuid getFileId(); + /** + *
+   * Identification of the file
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 1; + */ + io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getFileIdOrBuilder(); + + /** + *
+   * File name
+   * 
+ * + * string name = 2; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * File name
+   * 
+ * + * string name = 2; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * Detailed description of the file
+   * 
+ * + * .google.protobuf.StringValue description = 3; + * @return Whether the description field is set. + */ + boolean hasDescription(); + /** + *
+   * Detailed description of the file
+   * 
+ * + * .google.protobuf.StringValue description = 3; + * @return The description. + */ + com.google.protobuf.StringValue getDescription(); + /** + *
+   * Detailed description of the file
+   * 
+ * + * .google.protobuf.StringValue description = 3; + */ + com.google.protobuf.StringValueOrBuilder getDescriptionOrBuilder(); + + /** + *
+   * Content type of the file
+   * 
+ * + * string contentType = 4; + * @return The contentType. + */ + java.lang.String getContentType(); + /** + *
+   * Content type of the file
+   * 
+ * + * string contentType = 4; + * @return The bytes for contentType. + */ + com.google.protobuf.ByteString + getContentTypeBytes(); + + /** + *
+   * Size of the file in bytes
+   * 
+ * + * int64 totalSizeInBytes = 5; + * @return The totalSizeInBytes. + */ + long getTotalSizeInBytes(); + + /** + *
+   * Origin of the file (usually the taskType)
+   * 
+ * + * .google.protobuf.StringValue origin = 6; + * @return Whether the origin field is set. + */ + boolean hasOrigin(); + /** + *
+   * Origin of the file (usually the taskType)
+   * 
+ * + * .google.protobuf.StringValue origin = 6; + * @return The origin. + */ + com.google.protobuf.StringValue getOrigin(); + /** + *
+   * Origin of the file (usually the taskType)
+   * 
+ * + * .google.protobuf.StringValue origin = 6; + */ + com.google.protobuf.StringValueOrBuilder getOriginOrBuilder(); +} diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchRequest.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchRequest.java new file mode 100644 index 000000000..d53e62d09 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchRequest.java @@ -0,0 +1,858 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Request to list task statuses in paginated form.
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest} + */ +public final class GrpcFilesToFetchRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest) + GrpcFilesToFetchRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcFilesToFetchRequest.newBuilder() to construct. + private GrpcFilesToFetchRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcFilesToFetchRequest() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcFilesToFetchRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcFilesToFetchRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + pageNumber_ = input.readInt32(); + break; + } + case 16: { + + pageSize_ = input.readInt32(); + break; + } + case 26: { + com.google.protobuf.StringValue.Builder subBuilder = null; + if (origin_ != null) { + subBuilder = origin_.toBuilder(); + } + origin_ = input.readMessage(com.google.protobuf.StringValue.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(origin_); + origin_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest.class, io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest.Builder.class); + } + + public static final int PAGENUMBER_FIELD_NUMBER = 1; + private int pageNumber_; + /** + *
+   * Page number of the task statuses to be listed.
+   * 
+ * + * int32 pageNumber = 1; + * @return The pageNumber. + */ + @java.lang.Override + public int getPageNumber() { + return pageNumber_; + } + + public static final int PAGESIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + *
+   * Number of task statuses per page.
+   * 
+ * + * int32 pageSize = 2; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int ORIGIN_FIELD_NUMBER = 3; + private com.google.protobuf.StringValue origin_; + /** + *
+   * Optional origin of the files (derived from taskType), passing non-null value
+   * in this argument filters the returned files to only those that are related to the specified origin
+   * 
+ * + * .google.protobuf.StringValue origin = 3; + * @return Whether the origin field is set. + */ + @java.lang.Override + public boolean hasOrigin() { + return origin_ != null; + } + /** + *
+   * Optional origin of the files (derived from taskType), passing non-null value
+   * in this argument filters the returned files to only those that are related to the specified origin
+   * 
+ * + * .google.protobuf.StringValue origin = 3; + * @return The origin. + */ + @java.lang.Override + public com.google.protobuf.StringValue getOrigin() { + return origin_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : origin_; + } + /** + *
+   * Optional origin of the files (derived from taskType), passing non-null value
+   * in this argument filters the returned files to only those that are related to the specified origin
+   * 
+ * + * .google.protobuf.StringValue origin = 3; + */ + @java.lang.Override + public com.google.protobuf.StringValueOrBuilder getOriginOrBuilder() { + return getOrigin(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (pageNumber_ != 0) { + output.writeInt32(1, pageNumber_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (origin_ != null) { + output.writeMessage(3, getOrigin()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (pageNumber_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, pageNumber_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, pageSize_); + } + if (origin_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getOrigin()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest other = (io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest) obj; + + if (getPageNumber() + != other.getPageNumber()) return false; + if (getPageSize() + != other.getPageSize()) return false; + if (hasOrigin() != other.hasOrigin()) return false; + if (hasOrigin()) { + if (!getOrigin() + .equals(other.getOrigin())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PAGENUMBER_FIELD_NUMBER; + hash = (53 * hash) + getPageNumber(); + hash = (37 * hash) + PAGESIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + if (hasOrigin()) { + hash = (37 * hash) + ORIGIN_FIELD_NUMBER; + hash = (53 * hash) + getOrigin().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Request to list task statuses in paginated form.
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest) + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest.class, io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + pageNumber_ = 0; + + pageSize_ = 0; + + if (originBuilder_ == null) { + origin_ = null; + } else { + origin_ = null; + originBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchRequest_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest build() { + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest result = new io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest(this); + result.pageNumber_ = pageNumber_; + result.pageSize_ = pageSize_; + if (originBuilder_ == null) { + result.origin_ = origin_; + } else { + result.origin_ = originBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest.getDefaultInstance()) return this; + if (other.getPageNumber() != 0) { + setPageNumber(other.getPageNumber()); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (other.hasOrigin()) { + mergeOrigin(other.getOrigin()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int pageNumber_ ; + /** + *
+     * Page number of the task statuses to be listed.
+     * 
+ * + * int32 pageNumber = 1; + * @return The pageNumber. + */ + @java.lang.Override + public int getPageNumber() { + return pageNumber_; + } + /** + *
+     * Page number of the task statuses to be listed.
+     * 
+ * + * int32 pageNumber = 1; + * @param value The pageNumber to set. + * @return This builder for chaining. + */ + public Builder setPageNumber(int value) { + + pageNumber_ = value; + onChanged(); + return this; + } + /** + *
+     * Page number of the task statuses to be listed.
+     * 
+ * + * int32 pageNumber = 1; + * @return This builder for chaining. + */ + public Builder clearPageNumber() { + + pageNumber_ = 0; + onChanged(); + return this; + } + + private int pageSize_ ; + /** + *
+     * Number of task statuses per page.
+     * 
+ * + * int32 pageSize = 2; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + *
+     * Number of task statuses per page.
+     * 
+ * + * int32 pageSize = 2; + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + *
+     * Number of task statuses per page.
+     * 
+ * + * int32 pageSize = 2; + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.StringValue origin_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> originBuilder_; + /** + *
+     * Optional origin of the files (derived from taskType), passing non-null value
+     * in this argument filters the returned files to only those that are related to the specified origin
+     * 
+ * + * .google.protobuf.StringValue origin = 3; + * @return Whether the origin field is set. + */ + public boolean hasOrigin() { + return originBuilder_ != null || origin_ != null; + } + /** + *
+     * Optional origin of the files (derived from taskType), passing non-null value
+     * in this argument filters the returned files to only those that are related to the specified origin
+     * 
+ * + * .google.protobuf.StringValue origin = 3; + * @return The origin. + */ + public com.google.protobuf.StringValue getOrigin() { + if (originBuilder_ == null) { + return origin_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : origin_; + } else { + return originBuilder_.getMessage(); + } + } + /** + *
+     * Optional origin of the files (derived from taskType), passing non-null value
+     * in this argument filters the returned files to only those that are related to the specified origin
+     * 
+ * + * .google.protobuf.StringValue origin = 3; + */ + public Builder setOrigin(com.google.protobuf.StringValue value) { + if (originBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + origin_ = value; + onChanged(); + } else { + originBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Optional origin of the files (derived from taskType), passing non-null value
+     * in this argument filters the returned files to only those that are related to the specified origin
+     * 
+ * + * .google.protobuf.StringValue origin = 3; + */ + public Builder setOrigin( + com.google.protobuf.StringValue.Builder builderForValue) { + if (originBuilder_ == null) { + origin_ = builderForValue.build(); + onChanged(); + } else { + originBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Optional origin of the files (derived from taskType), passing non-null value
+     * in this argument filters the returned files to only those that are related to the specified origin
+     * 
+ * + * .google.protobuf.StringValue origin = 3; + */ + public Builder mergeOrigin(com.google.protobuf.StringValue value) { + if (originBuilder_ == null) { + if (origin_ != null) { + origin_ = + com.google.protobuf.StringValue.newBuilder(origin_).mergeFrom(value).buildPartial(); + } else { + origin_ = value; + } + onChanged(); + } else { + originBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Optional origin of the files (derived from taskType), passing non-null value
+     * in this argument filters the returned files to only those that are related to the specified origin
+     * 
+ * + * .google.protobuf.StringValue origin = 3; + */ + public Builder clearOrigin() { + if (originBuilder_ == null) { + origin_ = null; + onChanged(); + } else { + origin_ = null; + originBuilder_ = null; + } + + return this; + } + /** + *
+     * Optional origin of the files (derived from taskType), passing non-null value
+     * in this argument filters the returned files to only those that are related to the specified origin
+     * 
+ * + * .google.protobuf.StringValue origin = 3; + */ + public com.google.protobuf.StringValue.Builder getOriginBuilder() { + + onChanged(); + return getOriginFieldBuilder().getBuilder(); + } + /** + *
+     * Optional origin of the files (derived from taskType), passing non-null value
+     * in this argument filters the returned files to only those that are related to the specified origin
+     * 
+ * + * .google.protobuf.StringValue origin = 3; + */ + public com.google.protobuf.StringValueOrBuilder getOriginOrBuilder() { + if (originBuilder_ != null) { + return originBuilder_.getMessageOrBuilder(); + } else { + return origin_ == null ? + com.google.protobuf.StringValue.getDefaultInstance() : origin_; + } + } + /** + *
+     * Optional origin of the files (derived from taskType), passing non-null value
+     * in this argument filters the returned files to only those that are related to the specified origin
+     * 
+ * + * .google.protobuf.StringValue origin = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> + getOriginFieldBuilder() { + if (originBuilder_ == null) { + originBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder>( + getOrigin(), + getParentForChildren(), + isClean()); + origin_ = null; + } + return originBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest) + private static final io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcFilesToFetchRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcFilesToFetchRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchRequestOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchRequestOrBuilder.java new file mode 100644 index 000000000..b22f02e66 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchRequestOrBuilder.java @@ -0,0 +1,82 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +public interface GrpcFilesToFetchRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Page number of the task statuses to be listed.
+   * 
+ * + * int32 pageNumber = 1; + * @return The pageNumber. + */ + int getPageNumber(); + + /** + *
+   * Number of task statuses per page.
+   * 
+ * + * int32 pageSize = 2; + * @return The pageSize. + */ + int getPageSize(); + + /** + *
+   * Optional origin of the files (derived from taskType), passing non-null value
+   * in this argument filters the returned files to only those that are related to the specified origin
+   * 
+ * + * .google.protobuf.StringValue origin = 3; + * @return Whether the origin field is set. + */ + boolean hasOrigin(); + /** + *
+   * Optional origin of the files (derived from taskType), passing non-null value
+   * in this argument filters the returned files to only those that are related to the specified origin
+   * 
+ * + * .google.protobuf.StringValue origin = 3; + * @return The origin. + */ + com.google.protobuf.StringValue getOrigin(); + /** + *
+   * Optional origin of the files (derived from taskType), passing non-null value
+   * in this argument filters the returned files to only those that are related to the specified origin
+   * 
+ * + * .google.protobuf.StringValue origin = 3; + */ + com.google.protobuf.StringValueOrBuilder getOriginOrBuilder(); +} diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchResponse.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchResponse.java new file mode 100644 index 000000000..a60d4fd6c --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchResponse.java @@ -0,0 +1,1133 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Response to a task statuses request.
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse} + */ +public final class GrpcFilesToFetchResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse) + GrpcFilesToFetchResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcFilesToFetchResponse.newBuilder() to construct. + private GrpcFilesToFetchResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcFilesToFetchResponse() { + filesToFetch_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcFilesToFetchResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcFilesToFetchResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + pageSize_ = input.readInt32(); + break; + } + case 16: { + + pageNumber_ = input.readInt32(); + break; + } + case 26: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + filesToFetch_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + filesToFetch_.add( + input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcFile.parser(), extensionRegistry)); + break; + } + case 32: { + + totalNumberOfRecords_ = input.readInt32(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + filesToFetch_ = java.util.Collections.unmodifiableList(filesToFetch_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse.class, io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse.Builder.class); + } + + public static final int PAGESIZE_FIELD_NUMBER = 1; + private int pageSize_; + /** + *
+   * The size of the page.
+   * 
+ * + * int32 pageSize = 1; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGENUMBER_FIELD_NUMBER = 2; + private int pageNumber_; + /** + *
+   * The number of the page.
+   * 
+ * + * int32 pageNumber = 2; + * @return The pageNumber. + */ + @java.lang.Override + public int getPageNumber() { + return pageNumber_; + } + + public static final int FILESTOFETCH_FIELD_NUMBER = 3; + private java.util.List filesToFetch_; + /** + *
+   * Collection of files to fetch.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + @java.lang.Override + public java.util.List getFilesToFetchList() { + return filesToFetch_; + } + /** + *
+   * Collection of files to fetch.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + @java.lang.Override + public java.util.List + getFilesToFetchOrBuilderList() { + return filesToFetch_; + } + /** + *
+   * Collection of files to fetch.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + @java.lang.Override + public int getFilesToFetchCount() { + return filesToFetch_.size(); + } + /** + *
+   * Collection of files to fetch.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFile getFilesToFetch(int index) { + return filesToFetch_.get(index); + } + /** + *
+   * Collection of files to fetch.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder getFilesToFetchOrBuilder( + int index) { + return filesToFetch_.get(index); + } + + public static final int TOTALNUMBEROFRECORDS_FIELD_NUMBER = 4; + private int totalNumberOfRecords_; + /** + *
+   * Total number of files to fetch.
+   * 
+ * + * int32 totalNumberOfRecords = 4; + * @return The totalNumberOfRecords. + */ + @java.lang.Override + public int getTotalNumberOfRecords() { + return totalNumberOfRecords_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (pageSize_ != 0) { + output.writeInt32(1, pageSize_); + } + if (pageNumber_ != 0) { + output.writeInt32(2, pageNumber_); + } + for (int i = 0; i < filesToFetch_.size(); i++) { + output.writeMessage(3, filesToFetch_.get(i)); + } + if (totalNumberOfRecords_ != 0) { + output.writeInt32(4, totalNumberOfRecords_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, pageSize_); + } + if (pageNumber_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, pageNumber_); + } + for (int i = 0; i < filesToFetch_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, filesToFetch_.get(i)); + } + if (totalNumberOfRecords_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, totalNumberOfRecords_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse other = (io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse) obj; + + if (getPageSize() + != other.getPageSize()) return false; + if (getPageNumber() + != other.getPageNumber()) return false; + if (!getFilesToFetchList() + .equals(other.getFilesToFetchList())) return false; + if (getTotalNumberOfRecords() + != other.getTotalNumberOfRecords()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PAGESIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGENUMBER_FIELD_NUMBER; + hash = (53 * hash) + getPageNumber(); + if (getFilesToFetchCount() > 0) { + hash = (37 * hash) + FILESTOFETCH_FIELD_NUMBER; + hash = (53 * hash) + getFilesToFetchList().hashCode(); + } + hash = (37 * hash) + TOTALNUMBEROFRECORDS_FIELD_NUMBER; + hash = (53 * hash) + getTotalNumberOfRecords(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Response to a task statuses request.
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse) + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse.class, io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getFilesToFetchFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + pageSize_ = 0; + + pageNumber_ = 0; + + if (filesToFetchBuilder_ == null) { + filesToFetch_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + filesToFetchBuilder_.clear(); + } + totalNumberOfRecords_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcFilesToFetchResponse_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse build() { + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse result = new io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse(this); + int from_bitField0_ = bitField0_; + result.pageSize_ = pageSize_; + result.pageNumber_ = pageNumber_; + if (filesToFetchBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + filesToFetch_ = java.util.Collections.unmodifiableList(filesToFetch_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.filesToFetch_ = filesToFetch_; + } else { + result.filesToFetch_ = filesToFetchBuilder_.build(); + } + result.totalNumberOfRecords_ = totalNumberOfRecords_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse.getDefaultInstance()) return this; + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (other.getPageNumber() != 0) { + setPageNumber(other.getPageNumber()); + } + if (filesToFetchBuilder_ == null) { + if (!other.filesToFetch_.isEmpty()) { + if (filesToFetch_.isEmpty()) { + filesToFetch_ = other.filesToFetch_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureFilesToFetchIsMutable(); + filesToFetch_.addAll(other.filesToFetch_); + } + onChanged(); + } + } else { + if (!other.filesToFetch_.isEmpty()) { + if (filesToFetchBuilder_.isEmpty()) { + filesToFetchBuilder_.dispose(); + filesToFetchBuilder_ = null; + filesToFetch_ = other.filesToFetch_; + bitField0_ = (bitField0_ & ~0x00000001); + filesToFetchBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getFilesToFetchFieldBuilder() : null; + } else { + filesToFetchBuilder_.addAllMessages(other.filesToFetch_); + } + } + } + if (other.getTotalNumberOfRecords() != 0) { + setTotalNumberOfRecords(other.getTotalNumberOfRecords()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private int pageSize_ ; + /** + *
+     * The size of the page.
+     * 
+ * + * int32 pageSize = 1; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + *
+     * The size of the page.
+     * 
+ * + * int32 pageSize = 1; + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + *
+     * The size of the page.
+     * 
+ * + * int32 pageSize = 1; + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private int pageNumber_ ; + /** + *
+     * The number of the page.
+     * 
+ * + * int32 pageNumber = 2; + * @return The pageNumber. + */ + @java.lang.Override + public int getPageNumber() { + return pageNumber_; + } + /** + *
+     * The number of the page.
+     * 
+ * + * int32 pageNumber = 2; + * @param value The pageNumber to set. + * @return This builder for chaining. + */ + public Builder setPageNumber(int value) { + + pageNumber_ = value; + onChanged(); + return this; + } + /** + *
+     * The number of the page.
+     * 
+ * + * int32 pageNumber = 2; + * @return This builder for chaining. + */ + public Builder clearPageNumber() { + + pageNumber_ = 0; + onChanged(); + return this; + } + + private java.util.List filesToFetch_ = + java.util.Collections.emptyList(); + private void ensureFilesToFetchIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + filesToFetch_ = new java.util.ArrayList(filesToFetch_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcFile, io.evitadb.externalApi.grpc.generated.GrpcFile.Builder, io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder> filesToFetchBuilder_; + + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public java.util.List getFilesToFetchList() { + if (filesToFetchBuilder_ == null) { + return java.util.Collections.unmodifiableList(filesToFetch_); + } else { + return filesToFetchBuilder_.getMessageList(); + } + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public int getFilesToFetchCount() { + if (filesToFetchBuilder_ == null) { + return filesToFetch_.size(); + } else { + return filesToFetchBuilder_.getCount(); + } + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcFile getFilesToFetch(int index) { + if (filesToFetchBuilder_ == null) { + return filesToFetch_.get(index); + } else { + return filesToFetchBuilder_.getMessage(index); + } + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public Builder setFilesToFetch( + int index, io.evitadb.externalApi.grpc.generated.GrpcFile value) { + if (filesToFetchBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilesToFetchIsMutable(); + filesToFetch_.set(index, value); + onChanged(); + } else { + filesToFetchBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public Builder setFilesToFetch( + int index, io.evitadb.externalApi.grpc.generated.GrpcFile.Builder builderForValue) { + if (filesToFetchBuilder_ == null) { + ensureFilesToFetchIsMutable(); + filesToFetch_.set(index, builderForValue.build()); + onChanged(); + } else { + filesToFetchBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public Builder addFilesToFetch(io.evitadb.externalApi.grpc.generated.GrpcFile value) { + if (filesToFetchBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilesToFetchIsMutable(); + filesToFetch_.add(value); + onChanged(); + } else { + filesToFetchBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public Builder addFilesToFetch( + int index, io.evitadb.externalApi.grpc.generated.GrpcFile value) { + if (filesToFetchBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilesToFetchIsMutable(); + filesToFetch_.add(index, value); + onChanged(); + } else { + filesToFetchBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public Builder addFilesToFetch( + io.evitadb.externalApi.grpc.generated.GrpcFile.Builder builderForValue) { + if (filesToFetchBuilder_ == null) { + ensureFilesToFetchIsMutable(); + filesToFetch_.add(builderForValue.build()); + onChanged(); + } else { + filesToFetchBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public Builder addFilesToFetch( + int index, io.evitadb.externalApi.grpc.generated.GrpcFile.Builder builderForValue) { + if (filesToFetchBuilder_ == null) { + ensureFilesToFetchIsMutable(); + filesToFetch_.add(index, builderForValue.build()); + onChanged(); + } else { + filesToFetchBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public Builder addAllFilesToFetch( + java.lang.Iterable values) { + if (filesToFetchBuilder_ == null) { + ensureFilesToFetchIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, filesToFetch_); + onChanged(); + } else { + filesToFetchBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public Builder clearFilesToFetch() { + if (filesToFetchBuilder_ == null) { + filesToFetch_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + filesToFetchBuilder_.clear(); + } + return this; + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public Builder removeFilesToFetch(int index) { + if (filesToFetchBuilder_ == null) { + ensureFilesToFetchIsMutable(); + filesToFetch_.remove(index); + onChanged(); + } else { + filesToFetchBuilder_.remove(index); + } + return this; + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcFile.Builder getFilesToFetchBuilder( + int index) { + return getFilesToFetchFieldBuilder().getBuilder(index); + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder getFilesToFetchOrBuilder( + int index) { + if (filesToFetchBuilder_ == null) { + return filesToFetch_.get(index); } else { + return filesToFetchBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public java.util.List + getFilesToFetchOrBuilderList() { + if (filesToFetchBuilder_ != null) { + return filesToFetchBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(filesToFetch_); + } + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcFile.Builder addFilesToFetchBuilder() { + return getFilesToFetchFieldBuilder().addBuilder( + io.evitadb.externalApi.grpc.generated.GrpcFile.getDefaultInstance()); + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcFile.Builder addFilesToFetchBuilder( + int index) { + return getFilesToFetchFieldBuilder().addBuilder( + index, io.evitadb.externalApi.grpc.generated.GrpcFile.getDefaultInstance()); + } + /** + *
+     * Collection of files to fetch.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + public java.util.List + getFilesToFetchBuilderList() { + return getFilesToFetchFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcFile, io.evitadb.externalApi.grpc.generated.GrpcFile.Builder, io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder> + getFilesToFetchFieldBuilder() { + if (filesToFetchBuilder_ == null) { + filesToFetchBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcFile, io.evitadb.externalApi.grpc.generated.GrpcFile.Builder, io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder>( + filesToFetch_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + filesToFetch_ = null; + } + return filesToFetchBuilder_; + } + + private int totalNumberOfRecords_ ; + /** + *
+     * Total number of files to fetch.
+     * 
+ * + * int32 totalNumberOfRecords = 4; + * @return The totalNumberOfRecords. + */ + @java.lang.Override + public int getTotalNumberOfRecords() { + return totalNumberOfRecords_; + } + /** + *
+     * Total number of files to fetch.
+     * 
+ * + * int32 totalNumberOfRecords = 4; + * @param value The totalNumberOfRecords to set. + * @return This builder for chaining. + */ + public Builder setTotalNumberOfRecords(int value) { + + totalNumberOfRecords_ = value; + onChanged(); + return this; + } + /** + *
+     * Total number of files to fetch.
+     * 
+ * + * int32 totalNumberOfRecords = 4; + * @return This builder for chaining. + */ + public Builder clearTotalNumberOfRecords() { + + totalNumberOfRecords_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse) + private static final io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcFilesToFetchResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcFilesToFetchResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchResponseOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchResponseOrBuilder.java new file mode 100644 index 000000000..2b1f234c4 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcFilesToFetchResponseOrBuilder.java @@ -0,0 +1,106 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +public interface GrpcFilesToFetchResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcFilesToFetchResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The size of the page.
+   * 
+ * + * int32 pageSize = 1; + * @return The pageSize. + */ + int getPageSize(); + + /** + *
+   * The number of the page.
+   * 
+ * + * int32 pageNumber = 2; + * @return The pageNumber. + */ + int getPageNumber(); + + /** + *
+   * Collection of files to fetch.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + java.util.List + getFilesToFetchList(); + /** + *
+   * Collection of files to fetch.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + io.evitadb.externalApi.grpc.generated.GrpcFile getFilesToFetch(int index); + /** + *
+   * Collection of files to fetch.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + int getFilesToFetchCount(); + /** + *
+   * Collection of files to fetch.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + java.util.List + getFilesToFetchOrBuilderList(); + /** + *
+   * Collection of files to fetch.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcFile filesToFetch = 3; + */ + io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder getFilesToFetchOrBuilder( + int index); + + /** + *
+   * Total number of files to fetch.
+   * 
+ * + * int32 totalNumberOfRecords = 4; + * @return The totalNumberOfRecords. + */ + int getTotalNumberOfRecords(); +} diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogFromServerFileRequest.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogFromServerFileRequest.java new file mode 100644 index 000000000..c217f6dc2 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogFromServerFileRequest.java @@ -0,0 +1,859 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Request to restore a catalog.
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest} + */ +public final class GrpcRestoreCatalogFromServerFileRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest) + GrpcRestoreCatalogFromServerFileRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcRestoreCatalogFromServerFileRequest.newBuilder() to construct. + private GrpcRestoreCatalogFromServerFileRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcRestoreCatalogFromServerFileRequest() { + catalogName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcRestoreCatalogFromServerFileRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcRestoreCatalogFromServerFileRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + catalogName_ = s; + break; + } + case 18: { + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder subBuilder = null; + if (fileId_ != null) { + subBuilder = fileId_.toBuilder(); + } + fileId_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcUuid.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(fileId_); + fileId_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogFromServerFileRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogFromServerFileRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest.class, io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest.Builder.class); + } + + public static final int CATALOGNAME_FIELD_NUMBER = 1; + private volatile java.lang.Object catalogName_; + /** + *
+   * Name of the catalog where the backup will be restored
+   * The name must not clash with any of existing catalogs
+   * 
+ * + * string catalogName = 1; + * @return The catalogName. + */ + @java.lang.Override + public java.lang.String getCatalogName() { + java.lang.Object ref = catalogName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + catalogName_ = s; + return s; + } + } + /** + *
+   * Name of the catalog where the backup will be restored
+   * The name must not clash with any of existing catalogs
+   * 
+ * + * string catalogName = 1; + * @return The bytes for catalogName. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getCatalogNameBytes() { + java.lang.Object ref = catalogName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + catalogName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILEID_FIELD_NUMBER = 2; + private io.evitadb.externalApi.grpc.generated.GrpcUuid fileId_; + /** + *
+   * The identification of the file on the server that should be restored
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + * @return Whether the fileId field is set. + */ + @java.lang.Override + public boolean hasFileId() { + return fileId_ != null; + } + /** + *
+   * The identification of the file on the server that should be restored
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + * @return The fileId. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuid getFileId() { + return fileId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : fileId_; + } + /** + *
+   * The identification of the file on the server that should be restored
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getFileIdOrBuilder() { + return getFileId(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(catalogName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, catalogName_); + } + if (fileId_ != null) { + output.writeMessage(2, getFileId()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(catalogName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, catalogName_); + } + if (fileId_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getFileId()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest other = (io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest) obj; + + if (!getCatalogName() + .equals(other.getCatalogName())) return false; + if (hasFileId() != other.hasFileId()) return false; + if (hasFileId()) { + if (!getFileId() + .equals(other.getFileId())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + CATALOGNAME_FIELD_NUMBER; + hash = (53 * hash) + getCatalogName().hashCode(); + if (hasFileId()) { + hash = (37 * hash) + FILEID_FIELD_NUMBER; + hash = (53 * hash) + getFileId().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Request to restore a catalog.
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest) + io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogFromServerFileRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogFromServerFileRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest.class, io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + catalogName_ = ""; + + if (fileIdBuilder_ == null) { + fileId_ = null; + } else { + fileId_ = null; + fileIdBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcRestoreCatalogFromServerFileRequest_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest build() { + io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest result = new io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest(this); + result.catalogName_ = catalogName_; + if (fileIdBuilder_ == null) { + result.fileId_ = fileId_; + } else { + result.fileId_ = fileIdBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest.getDefaultInstance()) return this; + if (!other.getCatalogName().isEmpty()) { + catalogName_ = other.catalogName_; + onChanged(); + } + if (other.hasFileId()) { + mergeFileId(other.getFileId()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object catalogName_ = ""; + /** + *
+     * Name of the catalog where the backup will be restored
+     * The name must not clash with any of existing catalogs
+     * 
+ * + * string catalogName = 1; + * @return The catalogName. + */ + public java.lang.String getCatalogName() { + java.lang.Object ref = catalogName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + catalogName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Name of the catalog where the backup will be restored
+     * The name must not clash with any of existing catalogs
+     * 
+ * + * string catalogName = 1; + * @return The bytes for catalogName. + */ + public com.google.protobuf.ByteString + getCatalogNameBytes() { + java.lang.Object ref = catalogName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + catalogName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Name of the catalog where the backup will be restored
+     * The name must not clash with any of existing catalogs
+     * 
+ * + * string catalogName = 1; + * @param value The catalogName to set. + * @return This builder for chaining. + */ + public Builder setCatalogName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + catalogName_ = value; + onChanged(); + return this; + } + /** + *
+     * Name of the catalog where the backup will be restored
+     * The name must not clash with any of existing catalogs
+     * 
+ * + * string catalogName = 1; + * @return This builder for chaining. + */ + public Builder clearCatalogName() { + + catalogName_ = getDefaultInstance().getCatalogName(); + onChanged(); + return this; + } + /** + *
+     * Name of the catalog where the backup will be restored
+     * The name must not clash with any of existing catalogs
+     * 
+ * + * string catalogName = 1; + * @param value The bytes for catalogName to set. + * @return This builder for chaining. + */ + public Builder setCatalogNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + catalogName_ = value; + onChanged(); + return this; + } + + private io.evitadb.externalApi.grpc.generated.GrpcUuid fileId_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> fileIdBuilder_; + /** + *
+     * The identification of the file on the server that should be restored
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + * @return Whether the fileId field is set. + */ + public boolean hasFileId() { + return fileIdBuilder_ != null || fileId_ != null; + } + /** + *
+     * The identification of the file on the server that should be restored
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + * @return The fileId. + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid getFileId() { + if (fileIdBuilder_ == null) { + return fileId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : fileId_; + } else { + return fileIdBuilder_.getMessage(); + } + } + /** + *
+     * The identification of the file on the server that should be restored
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + */ + public Builder setFileId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (fileIdBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + fileId_ = value; + onChanged(); + } else { + fileIdBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * The identification of the file on the server that should be restored
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + */ + public Builder setFileId( + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder builderForValue) { + if (fileIdBuilder_ == null) { + fileId_ = builderForValue.build(); + onChanged(); + } else { + fileIdBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * The identification of the file on the server that should be restored
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + */ + public Builder mergeFileId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (fileIdBuilder_ == null) { + if (fileId_ != null) { + fileId_ = + io.evitadb.externalApi.grpc.generated.GrpcUuid.newBuilder(fileId_).mergeFrom(value).buildPartial(); + } else { + fileId_ = value; + } + onChanged(); + } else { + fileIdBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * The identification of the file on the server that should be restored
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + */ + public Builder clearFileId() { + if (fileIdBuilder_ == null) { + fileId_ = null; + onChanged(); + } else { + fileId_ = null; + fileIdBuilder_ = null; + } + + return this; + } + /** + *
+     * The identification of the file on the server that should be restored
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder getFileIdBuilder() { + + onChanged(); + return getFileIdFieldBuilder().getBuilder(); + } + /** + *
+     * The identification of the file on the server that should be restored
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getFileIdOrBuilder() { + if (fileIdBuilder_ != null) { + return fileIdBuilder_.getMessageOrBuilder(); + } else { + return fileId_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : fileId_; + } + } + /** + *
+     * The identification of the file on the server that should be restored
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> + getFileIdFieldBuilder() { + if (fileIdBuilder_ == null) { + fileIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder>( + getFileId(), + getParentForChildren(), + isClean()); + fileId_ = null; + } + return fileIdBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest) + private static final io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcRestoreCatalogFromServerFileRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcRestoreCatalogFromServerFileRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogFromServerFileRequestOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogFromServerFileRequestOrBuilder.java new file mode 100644 index 000000000..87f07e3ff --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogFromServerFileRequestOrBuilder.java @@ -0,0 +1,81 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +public interface GrpcRestoreCatalogFromServerFileRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogFromServerFileRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Name of the catalog where the backup will be restored
+   * The name must not clash with any of existing catalogs
+   * 
+ * + * string catalogName = 1; + * @return The catalogName. + */ + java.lang.String getCatalogName(); + /** + *
+   * Name of the catalog where the backup will be restored
+   * The name must not clash with any of existing catalogs
+   * 
+ * + * string catalogName = 1; + * @return The bytes for catalogName. + */ + com.google.protobuf.ByteString + getCatalogNameBytes(); + + /** + *
+   * The identification of the file on the server that should be restored
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + * @return Whether the fileId field is set. + */ + boolean hasFileId(); + /** + *
+   * The identification of the file on the server that should be restored
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + * @return The fileId. + */ + io.evitadb.externalApi.grpc.generated.GrpcUuid getFileId(); + /** + *
+   * The identification of the file on the server that should be restored
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid fileId = 2; + */ + io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getFileIdOrBuilder(); +} diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogResponse.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogResponse.java index f831a802c..538e388a1 100644 --- a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogResponse.java +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogResponse.java @@ -80,6 +80,19 @@ private GrpcRestoreCatalogResponse( read_ = input.readInt64(); break; } + case 18: { + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder subBuilder = null; + if (taskId_ != null) { + subBuilder = taskId_.toBuilder(); + } + taskId_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcUuid.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(taskId_); + taskId_ = subBuilder.buildPartial(); + } + + break; + } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { @@ -127,6 +140,44 @@ public long getRead() { return read_; } + public static final int TASKID_FIELD_NUMBER = 2; + private io.evitadb.externalApi.grpc.generated.GrpcUuid taskId_; + /** + *
+   * the id of the task that is used to restore the catalog and getting its progress
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + * @return Whether the taskId field is set. + */ + @java.lang.Override + public boolean hasTaskId() { + return taskId_ != null; + } + /** + *
+   * the id of the task that is used to restore the catalog and getting its progress
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + * @return The taskId. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId() { + return taskId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } + /** + *
+   * the id of the task that is used to restore the catalog and getting its progress
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder() { + return getTaskId(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -144,6 +195,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (read_ != 0L) { output.writeInt64(1, read_); } + if (taskId_ != null) { + output.writeMessage(2, getTaskId()); + } unknownFields.writeTo(output); } @@ -157,6 +211,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeInt64Size(1, read_); } + if (taskId_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getTaskId()); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -174,6 +232,11 @@ public boolean equals(final java.lang.Object obj) { if (getRead() != other.getRead()) return false; + if (hasTaskId() != other.hasTaskId()) return false; + if (hasTaskId()) { + if (!getTaskId() + .equals(other.getTaskId())) return false; + } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -188,6 +251,10 @@ public int hashCode() { hash = (37 * hash) + READ_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getRead()); + if (hasTaskId()) { + hash = (37 * hash) + TASKID_FIELD_NUMBER; + hash = (53 * hash) + getTaskId().hashCode(); + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -327,6 +394,12 @@ public Builder clear() { super.clear(); read_ = 0L; + if (taskIdBuilder_ == null) { + taskId_ = null; + } else { + taskId_ = null; + taskIdBuilder_ = null; + } return this; } @@ -354,6 +427,11 @@ public io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogResponse build() public io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogResponse buildPartial() { io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogResponse result = new io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalogResponse(this); result.read_ = read_; + if (taskIdBuilder_ == null) { + result.taskId_ = taskId_; + } else { + result.taskId_ = taskIdBuilder_.build(); + } onBuilt(); return result; } @@ -405,6 +483,9 @@ public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcRestoreCatalo if (other.getRead() != 0L) { setRead(other.getRead()); } + if (other.hasTaskId()) { + mergeTaskId(other.getTaskId()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -476,6 +557,161 @@ public Builder clearRead() { onChanged(); return this; } + + private io.evitadb.externalApi.grpc.generated.GrpcUuid taskId_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> taskIdBuilder_; + /** + *
+     * the id of the task that is used to restore the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + * @return Whether the taskId field is set. + */ + public boolean hasTaskId() { + return taskIdBuilder_ != null || taskId_ != null; + } + /** + *
+     * the id of the task that is used to restore the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + * @return The taskId. + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId() { + if (taskIdBuilder_ == null) { + return taskId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } else { + return taskIdBuilder_.getMessage(); + } + } + /** + *
+     * the id of the task that is used to restore the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + */ + public Builder setTaskId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (taskIdBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + taskId_ = value; + onChanged(); + } else { + taskIdBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * the id of the task that is used to restore the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + */ + public Builder setTaskId( + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder builderForValue) { + if (taskIdBuilder_ == null) { + taskId_ = builderForValue.build(); + onChanged(); + } else { + taskIdBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * the id of the task that is used to restore the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + */ + public Builder mergeTaskId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (taskIdBuilder_ == null) { + if (taskId_ != null) { + taskId_ = + io.evitadb.externalApi.grpc.generated.GrpcUuid.newBuilder(taskId_).mergeFrom(value).buildPartial(); + } else { + taskId_ = value; + } + onChanged(); + } else { + taskIdBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * the id of the task that is used to restore the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + */ + public Builder clearTaskId() { + if (taskIdBuilder_ == null) { + taskId_ = null; + onChanged(); + } else { + taskId_ = null; + taskIdBuilder_ = null; + } + + return this; + } + /** + *
+     * the id of the task that is used to restore the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder getTaskIdBuilder() { + + onChanged(); + return getTaskIdFieldBuilder().getBuilder(); + } + /** + *
+     * the id of the task that is used to restore the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder() { + if (taskIdBuilder_ != null) { + return taskIdBuilder_.getMessageOrBuilder(); + } else { + return taskId_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } + } + /** + *
+     * the id of the task that is used to restore the catalog and getting its progress
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> + getTaskIdFieldBuilder() { + if (taskIdBuilder_ == null) { + taskIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder>( + getTaskId(), + getParentForChildren(), + isClean()); + taskId_ = null; + } + return taskIdBuilder_; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogResponseOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogResponseOrBuilder.java index 04937663f..bdafbcb86 100644 --- a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogResponseOrBuilder.java +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcRestoreCatalogResponseOrBuilder.java @@ -39,4 +39,31 @@ public interface GrpcRestoreCatalogResponseOrBuilder extends * @return The read. */ long getRead(); + + /** + *
+   * the id of the task that is used to restore the catalog and getting its progress
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + * @return Whether the taskId field is set. + */ + boolean hasTaskId(); + /** + *
+   * the id of the task that is used to restore the catalog and getting its progress
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + * @return The taskId. + */ + io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId(); + /** + *
+   * the id of the task that is used to restore the catalog and getting its progress
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 2; + */ + io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder(); } diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatus.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatus.java new file mode 100644 index 000000000..a3619611a --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatus.java @@ -0,0 +1,2603 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Record representing status of particular asynchronous task
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcTaskStatus} + */ +public final class GrpcTaskStatus extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcTaskStatus) + GrpcTaskStatusOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcTaskStatus.newBuilder() to construct. + private GrpcTaskStatus(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcTaskStatus() { + taskType_ = ""; + taskName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcTaskStatus(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcTaskStatus( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + taskType_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + taskName_ = s; + break; + } + case 26: { + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder subBuilder = null; + if (taskId_ != null) { + subBuilder = taskId_.toBuilder(); + } + taskId_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcUuid.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(taskId_); + taskId_ = subBuilder.buildPartial(); + } + + break; + } + case 34: { + com.google.protobuf.StringValue.Builder subBuilder = null; + if (catalogName_ != null) { + subBuilder = catalogName_.toBuilder(); + } + catalogName_ = input.readMessage(com.google.protobuf.StringValue.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(catalogName_); + catalogName_ = subBuilder.buildPartial(); + } + + break; + } + case 42: { + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder subBuilder = null; + if (issued_ != null) { + subBuilder = issued_.toBuilder(); + } + issued_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(issued_); + issued_ = subBuilder.buildPartial(); + } + + break; + } + case 50: { + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder subBuilder = null; + if (started_ != null) { + subBuilder = started_.toBuilder(); + } + started_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(started_); + started_ = subBuilder.buildPartial(); + } + + break; + } + case 58: { + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder subBuilder = null; + if (finished_ != null) { + subBuilder = finished_.toBuilder(); + } + finished_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(finished_); + finished_ = subBuilder.buildPartial(); + } + + break; + } + case 64: { + + progress_ = input.readInt32(); + break; + } + case 74: { + com.google.protobuf.StringValue.Builder subBuilder = null; + if (settings_ != null) { + subBuilder = settings_.toBuilder(); + } + settings_ = input.readMessage(com.google.protobuf.StringValue.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(settings_); + settings_ = subBuilder.buildPartial(); + } + + break; + } + case 82: { + com.google.protobuf.StringValue.Builder subBuilder = null; + if (resultCase_ == 10) { + subBuilder = ((com.google.protobuf.StringValue) result_).toBuilder(); + } + result_ = + input.readMessage(com.google.protobuf.StringValue.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.protobuf.StringValue) result_); + result_ = subBuilder.buildPartial(); + } + resultCase_ = 10; + break; + } + case 90: { + io.evitadb.externalApi.grpc.generated.GrpcFile.Builder subBuilder = null; + if (resultCase_ == 11) { + subBuilder = ((io.evitadb.externalApi.grpc.generated.GrpcFile) result_).toBuilder(); + } + result_ = + input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcFile.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcFile) result_); + result_ = subBuilder.buildPartial(); + } + resultCase_ = 11; + break; + } + case 98: { + com.google.protobuf.StringValue.Builder subBuilder = null; + if (exception_ != null) { + subBuilder = exception_.toBuilder(); + } + exception_ = input.readMessage(com.google.protobuf.StringValue.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(exception_); + exception_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.class, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder.class); + } + + private int resultCase_ = 0; + private java.lang.Object result_; + public enum ResultCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + TEXT(10), + FILE(11), + RESULT_NOT_SET(0); + private final int value; + private ResultCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ResultCase valueOf(int value) { + return forNumber(value); + } + + public static ResultCase forNumber(int value) { + switch (value) { + case 10: return TEXT; + case 11: return FILE; + case 0: return RESULT_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public ResultCase + getResultCase() { + return ResultCase.forNumber( + resultCase_); + } + + public static final int TASKTYPE_FIELD_NUMBER = 1; + private volatile java.lang.Object taskType_; + /** + * string taskType = 1; + * @return The taskType. + */ + @java.lang.Override + public java.lang.String getTaskType() { + java.lang.Object ref = taskType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskType_ = s; + return s; + } + } + /** + * string taskType = 1; + * @return The bytes for taskType. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTaskTypeBytes() { + java.lang.Object ref = taskType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TASKNAME_FIELD_NUMBER = 2; + private volatile java.lang.Object taskName_; + /** + * string taskName = 2; + * @return The taskName. + */ + @java.lang.Override + public java.lang.String getTaskName() { + java.lang.Object ref = taskName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskName_ = s; + return s; + } + } + /** + * string taskName = 2; + * @return The bytes for taskName. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTaskNameBytes() { + java.lang.Object ref = taskName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TASKID_FIELD_NUMBER = 3; + private io.evitadb.externalApi.grpc.generated.GrpcUuid taskId_; + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + * @return Whether the taskId field is set. + */ + @java.lang.Override + public boolean hasTaskId() { + return taskId_ != null; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + * @return The taskId. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId() { + return taskId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder() { + return getTaskId(); + } + + public static final int CATALOGNAME_FIELD_NUMBER = 4; + private com.google.protobuf.StringValue catalogName_; + /** + * .google.protobuf.StringValue catalogName = 4; + * @return Whether the catalogName field is set. + */ + @java.lang.Override + public boolean hasCatalogName() { + return catalogName_ != null; + } + /** + * .google.protobuf.StringValue catalogName = 4; + * @return The catalogName. + */ + @java.lang.Override + public com.google.protobuf.StringValue getCatalogName() { + return catalogName_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : catalogName_; + } + /** + * .google.protobuf.StringValue catalogName = 4; + */ + @java.lang.Override + public com.google.protobuf.StringValueOrBuilder getCatalogNameOrBuilder() { + return getCatalogName(); + } + + public static final int ISSUED_FIELD_NUMBER = 5; + private io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued_; + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + * @return Whether the issued field is set. + */ + @java.lang.Override + public boolean hasIssued() { + return issued_ != null; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + * @return The issued. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime getIssued() { + return issued_ == null ? io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.getDefaultInstance() : issued_; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder getIssuedOrBuilder() { + return getIssued(); + } + + public static final int STARTED_FIELD_NUMBER = 6; + private io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started_; + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + * @return Whether the started field is set. + */ + @java.lang.Override + public boolean hasStarted() { + return started_ != null; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + * @return The started. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime getStarted() { + return started_ == null ? io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.getDefaultInstance() : started_; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder getStartedOrBuilder() { + return getStarted(); + } + + public static final int FINISHED_FIELD_NUMBER = 7; + private io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished_; + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + * @return Whether the finished field is set. + */ + @java.lang.Override + public boolean hasFinished() { + return finished_ != null; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + * @return The finished. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime getFinished() { + return finished_ == null ? io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.getDefaultInstance() : finished_; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder getFinishedOrBuilder() { + return getFinished(); + } + + public static final int PROGRESS_FIELD_NUMBER = 8; + private int progress_; + /** + * int32 progress = 8; + * @return The progress. + */ + @java.lang.Override + public int getProgress() { + return progress_; + } + + public static final int SETTINGS_FIELD_NUMBER = 9; + private com.google.protobuf.StringValue settings_; + /** + * .google.protobuf.StringValue settings = 9; + * @return Whether the settings field is set. + */ + @java.lang.Override + public boolean hasSettings() { + return settings_ != null; + } + /** + * .google.protobuf.StringValue settings = 9; + * @return The settings. + */ + @java.lang.Override + public com.google.protobuf.StringValue getSettings() { + return settings_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : settings_; + } + /** + * .google.protobuf.StringValue settings = 9; + */ + @java.lang.Override + public com.google.protobuf.StringValueOrBuilder getSettingsOrBuilder() { + return getSettings(); + } + + public static final int TEXT_FIELD_NUMBER = 10; + /** + * .google.protobuf.StringValue text = 10; + * @return Whether the text field is set. + */ + @java.lang.Override + public boolean hasText() { + return resultCase_ == 10; + } + /** + * .google.protobuf.StringValue text = 10; + * @return The text. + */ + @java.lang.Override + public com.google.protobuf.StringValue getText() { + if (resultCase_ == 10) { + return (com.google.protobuf.StringValue) result_; + } + return com.google.protobuf.StringValue.getDefaultInstance(); + } + /** + * .google.protobuf.StringValue text = 10; + */ + @java.lang.Override + public com.google.protobuf.StringValueOrBuilder getTextOrBuilder() { + if (resultCase_ == 10) { + return (com.google.protobuf.StringValue) result_; + } + return com.google.protobuf.StringValue.getDefaultInstance(); + } + + public static final int FILE_FIELD_NUMBER = 11; + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + * @return Whether the file field is set. + */ + @java.lang.Override + public boolean hasFile() { + return resultCase_ == 11; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + * @return The file. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFile getFile() { + if (resultCase_ == 11) { + return (io.evitadb.externalApi.grpc.generated.GrpcFile) result_; + } + return io.evitadb.externalApi.grpc.generated.GrpcFile.getDefaultInstance(); + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder getFileOrBuilder() { + if (resultCase_ == 11) { + return (io.evitadb.externalApi.grpc.generated.GrpcFile) result_; + } + return io.evitadb.externalApi.grpc.generated.GrpcFile.getDefaultInstance(); + } + + public static final int EXCEPTION_FIELD_NUMBER = 12; + private com.google.protobuf.StringValue exception_; + /** + * .google.protobuf.StringValue exception = 12; + * @return Whether the exception field is set. + */ + @java.lang.Override + public boolean hasException() { + return exception_ != null; + } + /** + * .google.protobuf.StringValue exception = 12; + * @return The exception. + */ + @java.lang.Override + public com.google.protobuf.StringValue getException() { + return exception_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : exception_; + } + /** + * .google.protobuf.StringValue exception = 12; + */ + @java.lang.Override + public com.google.protobuf.StringValueOrBuilder getExceptionOrBuilder() { + return getException(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(taskType_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, taskType_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(taskName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, taskName_); + } + if (taskId_ != null) { + output.writeMessage(3, getTaskId()); + } + if (catalogName_ != null) { + output.writeMessage(4, getCatalogName()); + } + if (issued_ != null) { + output.writeMessage(5, getIssued()); + } + if (started_ != null) { + output.writeMessage(6, getStarted()); + } + if (finished_ != null) { + output.writeMessage(7, getFinished()); + } + if (progress_ != 0) { + output.writeInt32(8, progress_); + } + if (settings_ != null) { + output.writeMessage(9, getSettings()); + } + if (resultCase_ == 10) { + output.writeMessage(10, (com.google.protobuf.StringValue) result_); + } + if (resultCase_ == 11) { + output.writeMessage(11, (io.evitadb.externalApi.grpc.generated.GrpcFile) result_); + } + if (exception_ != null) { + output.writeMessage(12, getException()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(taskType_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, taskType_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(taskName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, taskName_); + } + if (taskId_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getTaskId()); + } + if (catalogName_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getCatalogName()); + } + if (issued_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, getIssued()); + } + if (started_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getStarted()); + } + if (finished_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, getFinished()); + } + if (progress_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, progress_); + } + if (settings_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(9, getSettings()); + } + if (resultCase_ == 10) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(10, (com.google.protobuf.StringValue) result_); + } + if (resultCase_ == 11) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(11, (io.evitadb.externalApi.grpc.generated.GrpcFile) result_); + } + if (exception_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(12, getException()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcTaskStatus)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus other = (io.evitadb.externalApi.grpc.generated.GrpcTaskStatus) obj; + + if (!getTaskType() + .equals(other.getTaskType())) return false; + if (!getTaskName() + .equals(other.getTaskName())) return false; + if (hasTaskId() != other.hasTaskId()) return false; + if (hasTaskId()) { + if (!getTaskId() + .equals(other.getTaskId())) return false; + } + if (hasCatalogName() != other.hasCatalogName()) return false; + if (hasCatalogName()) { + if (!getCatalogName() + .equals(other.getCatalogName())) return false; + } + if (hasIssued() != other.hasIssued()) return false; + if (hasIssued()) { + if (!getIssued() + .equals(other.getIssued())) return false; + } + if (hasStarted() != other.hasStarted()) return false; + if (hasStarted()) { + if (!getStarted() + .equals(other.getStarted())) return false; + } + if (hasFinished() != other.hasFinished()) return false; + if (hasFinished()) { + if (!getFinished() + .equals(other.getFinished())) return false; + } + if (getProgress() + != other.getProgress()) return false; + if (hasSettings() != other.hasSettings()) return false; + if (hasSettings()) { + if (!getSettings() + .equals(other.getSettings())) return false; + } + if (hasException() != other.hasException()) return false; + if (hasException()) { + if (!getException() + .equals(other.getException())) return false; + } + if (!getResultCase().equals(other.getResultCase())) return false; + switch (resultCase_) { + case 10: + if (!getText() + .equals(other.getText())) return false; + break; + case 11: + if (!getFile() + .equals(other.getFile())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TASKTYPE_FIELD_NUMBER; + hash = (53 * hash) + getTaskType().hashCode(); + hash = (37 * hash) + TASKNAME_FIELD_NUMBER; + hash = (53 * hash) + getTaskName().hashCode(); + if (hasTaskId()) { + hash = (37 * hash) + TASKID_FIELD_NUMBER; + hash = (53 * hash) + getTaskId().hashCode(); + } + if (hasCatalogName()) { + hash = (37 * hash) + CATALOGNAME_FIELD_NUMBER; + hash = (53 * hash) + getCatalogName().hashCode(); + } + if (hasIssued()) { + hash = (37 * hash) + ISSUED_FIELD_NUMBER; + hash = (53 * hash) + getIssued().hashCode(); + } + if (hasStarted()) { + hash = (37 * hash) + STARTED_FIELD_NUMBER; + hash = (53 * hash) + getStarted().hashCode(); + } + if (hasFinished()) { + hash = (37 * hash) + FINISHED_FIELD_NUMBER; + hash = (53 * hash) + getFinished().hashCode(); + } + hash = (37 * hash) + PROGRESS_FIELD_NUMBER; + hash = (53 * hash) + getProgress(); + if (hasSettings()) { + hash = (37 * hash) + SETTINGS_FIELD_NUMBER; + hash = (53 * hash) + getSettings().hashCode(); + } + if (hasException()) { + hash = (37 * hash) + EXCEPTION_FIELD_NUMBER; + hash = (53 * hash) + getException().hashCode(); + } + switch (resultCase_) { + case 10: + hash = (37 * hash) + TEXT_FIELD_NUMBER; + hash = (53 * hash) + getText().hashCode(); + break; + case 11: + hash = (37 * hash) + FILE_FIELD_NUMBER; + hash = (53 * hash) + getFile().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcTaskStatus prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Record representing status of particular asynchronous task
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcTaskStatus} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcTaskStatus) + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.class, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + taskType_ = ""; + + taskName_ = ""; + + if (taskIdBuilder_ == null) { + taskId_ = null; + } else { + taskId_ = null; + taskIdBuilder_ = null; + } + if (catalogNameBuilder_ == null) { + catalogName_ = null; + } else { + catalogName_ = null; + catalogNameBuilder_ = null; + } + if (issuedBuilder_ == null) { + issued_ = null; + } else { + issued_ = null; + issuedBuilder_ = null; + } + if (startedBuilder_ == null) { + started_ = null; + } else { + started_ = null; + startedBuilder_ = null; + } + if (finishedBuilder_ == null) { + finished_ = null; + } else { + finished_ = null; + finishedBuilder_ = null; + } + progress_ = 0; + + if (settingsBuilder_ == null) { + settings_ = null; + } else { + settings_ = null; + settingsBuilder_ = null; + } + if (exceptionBuilder_ == null) { + exception_ = null; + } else { + exception_ = null; + exceptionBuilder_ = null; + } + resultCase_ = 0; + result_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatus_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus build() { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus result = new io.evitadb.externalApi.grpc.generated.GrpcTaskStatus(this); + result.taskType_ = taskType_; + result.taskName_ = taskName_; + if (taskIdBuilder_ == null) { + result.taskId_ = taskId_; + } else { + result.taskId_ = taskIdBuilder_.build(); + } + if (catalogNameBuilder_ == null) { + result.catalogName_ = catalogName_; + } else { + result.catalogName_ = catalogNameBuilder_.build(); + } + if (issuedBuilder_ == null) { + result.issued_ = issued_; + } else { + result.issued_ = issuedBuilder_.build(); + } + if (startedBuilder_ == null) { + result.started_ = started_; + } else { + result.started_ = startedBuilder_.build(); + } + if (finishedBuilder_ == null) { + result.finished_ = finished_; + } else { + result.finished_ = finishedBuilder_.build(); + } + result.progress_ = progress_; + if (settingsBuilder_ == null) { + result.settings_ = settings_; + } else { + result.settings_ = settingsBuilder_.build(); + } + if (resultCase_ == 10) { + if (textBuilder_ == null) { + result.result_ = result_; + } else { + result.result_ = textBuilder_.build(); + } + } + if (resultCase_ == 11) { + if (fileBuilder_ == null) { + result.result_ = result_; + } else { + result.result_ = fileBuilder_.build(); + } + } + if (exceptionBuilder_ == null) { + result.exception_ = exception_; + } else { + result.exception_ = exceptionBuilder_.build(); + } + result.resultCase_ = resultCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcTaskStatus) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcTaskStatus)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcTaskStatus other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.getDefaultInstance()) return this; + if (!other.getTaskType().isEmpty()) { + taskType_ = other.taskType_; + onChanged(); + } + if (!other.getTaskName().isEmpty()) { + taskName_ = other.taskName_; + onChanged(); + } + if (other.hasTaskId()) { + mergeTaskId(other.getTaskId()); + } + if (other.hasCatalogName()) { + mergeCatalogName(other.getCatalogName()); + } + if (other.hasIssued()) { + mergeIssued(other.getIssued()); + } + if (other.hasStarted()) { + mergeStarted(other.getStarted()); + } + if (other.hasFinished()) { + mergeFinished(other.getFinished()); + } + if (other.getProgress() != 0) { + setProgress(other.getProgress()); + } + if (other.hasSettings()) { + mergeSettings(other.getSettings()); + } + if (other.hasException()) { + mergeException(other.getException()); + } + switch (other.getResultCase()) { + case TEXT: { + mergeText(other.getText()); + break; + } + case FILE: { + mergeFile(other.getFile()); + break; + } + case RESULT_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcTaskStatus) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int resultCase_ = 0; + private java.lang.Object result_; + public ResultCase + getResultCase() { + return ResultCase.forNumber( + resultCase_); + } + + public Builder clearResult() { + resultCase_ = 0; + result_ = null; + onChanged(); + return this; + } + + + private java.lang.Object taskType_ = ""; + /** + * string taskType = 1; + * @return The taskType. + */ + public java.lang.String getTaskType() { + java.lang.Object ref = taskType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string taskType = 1; + * @return The bytes for taskType. + */ + public com.google.protobuf.ByteString + getTaskTypeBytes() { + java.lang.Object ref = taskType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string taskType = 1; + * @param value The taskType to set. + * @return This builder for chaining. + */ + public Builder setTaskType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + taskType_ = value; + onChanged(); + return this; + } + /** + * string taskType = 1; + * @return This builder for chaining. + */ + public Builder clearTaskType() { + + taskType_ = getDefaultInstance().getTaskType(); + onChanged(); + return this; + } + /** + * string taskType = 1; + * @param value The bytes for taskType to set. + * @return This builder for chaining. + */ + public Builder setTaskTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + taskType_ = value; + onChanged(); + return this; + } + + private java.lang.Object taskName_ = ""; + /** + * string taskName = 2; + * @return The taskName. + */ + public java.lang.String getTaskName() { + java.lang.Object ref = taskName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string taskName = 2; + * @return The bytes for taskName. + */ + public com.google.protobuf.ByteString + getTaskNameBytes() { + java.lang.Object ref = taskName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string taskName = 2; + * @param value The taskName to set. + * @return This builder for chaining. + */ + public Builder setTaskName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + taskName_ = value; + onChanged(); + return this; + } + /** + * string taskName = 2; + * @return This builder for chaining. + */ + public Builder clearTaskName() { + + taskName_ = getDefaultInstance().getTaskName(); + onChanged(); + return this; + } + /** + * string taskName = 2; + * @param value The bytes for taskName to set. + * @return This builder for chaining. + */ + public Builder setTaskNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + taskName_ = value; + onChanged(); + return this; + } + + private io.evitadb.externalApi.grpc.generated.GrpcUuid taskId_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> taskIdBuilder_; + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + * @return Whether the taskId field is set. + */ + public boolean hasTaskId() { + return taskIdBuilder_ != null || taskId_ != null; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + * @return The taskId. + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId() { + if (taskIdBuilder_ == null) { + return taskId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } else { + return taskIdBuilder_.getMessage(); + } + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + */ + public Builder setTaskId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (taskIdBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + taskId_ = value; + onChanged(); + } else { + taskIdBuilder_.setMessage(value); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + */ + public Builder setTaskId( + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder builderForValue) { + if (taskIdBuilder_ == null) { + taskId_ = builderForValue.build(); + onChanged(); + } else { + taskIdBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + */ + public Builder mergeTaskId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (taskIdBuilder_ == null) { + if (taskId_ != null) { + taskId_ = + io.evitadb.externalApi.grpc.generated.GrpcUuid.newBuilder(taskId_).mergeFrom(value).buildPartial(); + } else { + taskId_ = value; + } + onChanged(); + } else { + taskIdBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + */ + public Builder clearTaskId() { + if (taskIdBuilder_ == null) { + taskId_ = null; + onChanged(); + } else { + taskId_ = null; + taskIdBuilder_ = null; + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder getTaskIdBuilder() { + + onChanged(); + return getTaskIdFieldBuilder().getBuilder(); + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder() { + if (taskIdBuilder_ != null) { + return taskIdBuilder_.getMessageOrBuilder(); + } else { + return taskId_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> + getTaskIdFieldBuilder() { + if (taskIdBuilder_ == null) { + taskIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder>( + getTaskId(), + getParentForChildren(), + isClean()); + taskId_ = null; + } + return taskIdBuilder_; + } + + private com.google.protobuf.StringValue catalogName_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> catalogNameBuilder_; + /** + * .google.protobuf.StringValue catalogName = 4; + * @return Whether the catalogName field is set. + */ + public boolean hasCatalogName() { + return catalogNameBuilder_ != null || catalogName_ != null; + } + /** + * .google.protobuf.StringValue catalogName = 4; + * @return The catalogName. + */ + public com.google.protobuf.StringValue getCatalogName() { + if (catalogNameBuilder_ == null) { + return catalogName_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : catalogName_; + } else { + return catalogNameBuilder_.getMessage(); + } + } + /** + * .google.protobuf.StringValue catalogName = 4; + */ + public Builder setCatalogName(com.google.protobuf.StringValue value) { + if (catalogNameBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + catalogName_ = value; + onChanged(); + } else { + catalogNameBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.StringValue catalogName = 4; + */ + public Builder setCatalogName( + com.google.protobuf.StringValue.Builder builderForValue) { + if (catalogNameBuilder_ == null) { + catalogName_ = builderForValue.build(); + onChanged(); + } else { + catalogNameBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.StringValue catalogName = 4; + */ + public Builder mergeCatalogName(com.google.protobuf.StringValue value) { + if (catalogNameBuilder_ == null) { + if (catalogName_ != null) { + catalogName_ = + com.google.protobuf.StringValue.newBuilder(catalogName_).mergeFrom(value).buildPartial(); + } else { + catalogName_ = value; + } + onChanged(); + } else { + catalogNameBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.StringValue catalogName = 4; + */ + public Builder clearCatalogName() { + if (catalogNameBuilder_ == null) { + catalogName_ = null; + onChanged(); + } else { + catalogName_ = null; + catalogNameBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.StringValue catalogName = 4; + */ + public com.google.protobuf.StringValue.Builder getCatalogNameBuilder() { + + onChanged(); + return getCatalogNameFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.StringValue catalogName = 4; + */ + public com.google.protobuf.StringValueOrBuilder getCatalogNameOrBuilder() { + if (catalogNameBuilder_ != null) { + return catalogNameBuilder_.getMessageOrBuilder(); + } else { + return catalogName_ == null ? + com.google.protobuf.StringValue.getDefaultInstance() : catalogName_; + } + } + /** + * .google.protobuf.StringValue catalogName = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> + getCatalogNameFieldBuilder() { + if (catalogNameBuilder_ == null) { + catalogNameBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder>( + getCatalogName(), + getParentForChildren(), + isClean()); + catalogName_ = null; + } + return catalogNameBuilder_; + } + + private io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder> issuedBuilder_; + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + * @return Whether the issued field is set. + */ + public boolean hasIssued() { + return issuedBuilder_ != null || issued_ != null; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + * @return The issued. + */ + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime getIssued() { + if (issuedBuilder_ == null) { + return issued_ == null ? io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.getDefaultInstance() : issued_; + } else { + return issuedBuilder_.getMessage(); + } + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + */ + public Builder setIssued(io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime value) { + if (issuedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + issued_ = value; + onChanged(); + } else { + issuedBuilder_.setMessage(value); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + */ + public Builder setIssued( + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder builderForValue) { + if (issuedBuilder_ == null) { + issued_ = builderForValue.build(); + onChanged(); + } else { + issuedBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + */ + public Builder mergeIssued(io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime value) { + if (issuedBuilder_ == null) { + if (issued_ != null) { + issued_ = + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.newBuilder(issued_).mergeFrom(value).buildPartial(); + } else { + issued_ = value; + } + onChanged(); + } else { + issuedBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + */ + public Builder clearIssued() { + if (issuedBuilder_ == null) { + issued_ = null; + onChanged(); + } else { + issued_ = null; + issuedBuilder_ = null; + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + */ + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder getIssuedBuilder() { + + onChanged(); + return getIssuedFieldBuilder().getBuilder(); + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + */ + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder getIssuedOrBuilder() { + if (issuedBuilder_ != null) { + return issuedBuilder_.getMessageOrBuilder(); + } else { + return issued_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.getDefaultInstance() : issued_; + } + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder> + getIssuedFieldBuilder() { + if (issuedBuilder_ == null) { + issuedBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder>( + getIssued(), + getParentForChildren(), + isClean()); + issued_ = null; + } + return issuedBuilder_; + } + + private io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder> startedBuilder_; + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + * @return Whether the started field is set. + */ + public boolean hasStarted() { + return startedBuilder_ != null || started_ != null; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + * @return The started. + */ + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime getStarted() { + if (startedBuilder_ == null) { + return started_ == null ? io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.getDefaultInstance() : started_; + } else { + return startedBuilder_.getMessage(); + } + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + */ + public Builder setStarted(io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime value) { + if (startedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + started_ = value; + onChanged(); + } else { + startedBuilder_.setMessage(value); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + */ + public Builder setStarted( + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder builderForValue) { + if (startedBuilder_ == null) { + started_ = builderForValue.build(); + onChanged(); + } else { + startedBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + */ + public Builder mergeStarted(io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime value) { + if (startedBuilder_ == null) { + if (started_ != null) { + started_ = + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.newBuilder(started_).mergeFrom(value).buildPartial(); + } else { + started_ = value; + } + onChanged(); + } else { + startedBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + */ + public Builder clearStarted() { + if (startedBuilder_ == null) { + started_ = null; + onChanged(); + } else { + started_ = null; + startedBuilder_ = null; + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + */ + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder getStartedBuilder() { + + onChanged(); + return getStartedFieldBuilder().getBuilder(); + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + */ + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder getStartedOrBuilder() { + if (startedBuilder_ != null) { + return startedBuilder_.getMessageOrBuilder(); + } else { + return started_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.getDefaultInstance() : started_; + } + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder> + getStartedFieldBuilder() { + if (startedBuilder_ == null) { + startedBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder>( + getStarted(), + getParentForChildren(), + isClean()); + started_ = null; + } + return startedBuilder_; + } + + private io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder> finishedBuilder_; + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + * @return Whether the finished field is set. + */ + public boolean hasFinished() { + return finishedBuilder_ != null || finished_ != null; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + * @return The finished. + */ + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime getFinished() { + if (finishedBuilder_ == null) { + return finished_ == null ? io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.getDefaultInstance() : finished_; + } else { + return finishedBuilder_.getMessage(); + } + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + */ + public Builder setFinished(io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime value) { + if (finishedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + finished_ = value; + onChanged(); + } else { + finishedBuilder_.setMessage(value); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + */ + public Builder setFinished( + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder builderForValue) { + if (finishedBuilder_ == null) { + finished_ = builderForValue.build(); + onChanged(); + } else { + finishedBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + */ + public Builder mergeFinished(io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime value) { + if (finishedBuilder_ == null) { + if (finished_ != null) { + finished_ = + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.newBuilder(finished_).mergeFrom(value).buildPartial(); + } else { + finished_ = value; + } + onChanged(); + } else { + finishedBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + */ + public Builder clearFinished() { + if (finishedBuilder_ == null) { + finished_ = null; + onChanged(); + } else { + finished_ = null; + finishedBuilder_ = null; + } + + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + */ + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder getFinishedBuilder() { + + onChanged(); + return getFinishedFieldBuilder().getBuilder(); + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + */ + public io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder getFinishedOrBuilder() { + if (finishedBuilder_ != null) { + return finishedBuilder_.getMessageOrBuilder(); + } else { + return finished_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.getDefaultInstance() : finished_; + } + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder> + getFinishedFieldBuilder() { + if (finishedBuilder_ == null) { + finishedBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime.Builder, io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder>( + getFinished(), + getParentForChildren(), + isClean()); + finished_ = null; + } + return finishedBuilder_; + } + + private int progress_ ; + /** + * int32 progress = 8; + * @return The progress. + */ + @java.lang.Override + public int getProgress() { + return progress_; + } + /** + * int32 progress = 8; + * @param value The progress to set. + * @return This builder for chaining. + */ + public Builder setProgress(int value) { + + progress_ = value; + onChanged(); + return this; + } + /** + * int32 progress = 8; + * @return This builder for chaining. + */ + public Builder clearProgress() { + + progress_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.StringValue settings_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> settingsBuilder_; + /** + * .google.protobuf.StringValue settings = 9; + * @return Whether the settings field is set. + */ + public boolean hasSettings() { + return settingsBuilder_ != null || settings_ != null; + } + /** + * .google.protobuf.StringValue settings = 9; + * @return The settings. + */ + public com.google.protobuf.StringValue getSettings() { + if (settingsBuilder_ == null) { + return settings_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : settings_; + } else { + return settingsBuilder_.getMessage(); + } + } + /** + * .google.protobuf.StringValue settings = 9; + */ + public Builder setSettings(com.google.protobuf.StringValue value) { + if (settingsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + settings_ = value; + onChanged(); + } else { + settingsBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.StringValue settings = 9; + */ + public Builder setSettings( + com.google.protobuf.StringValue.Builder builderForValue) { + if (settingsBuilder_ == null) { + settings_ = builderForValue.build(); + onChanged(); + } else { + settingsBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.StringValue settings = 9; + */ + public Builder mergeSettings(com.google.protobuf.StringValue value) { + if (settingsBuilder_ == null) { + if (settings_ != null) { + settings_ = + com.google.protobuf.StringValue.newBuilder(settings_).mergeFrom(value).buildPartial(); + } else { + settings_ = value; + } + onChanged(); + } else { + settingsBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.StringValue settings = 9; + */ + public Builder clearSettings() { + if (settingsBuilder_ == null) { + settings_ = null; + onChanged(); + } else { + settings_ = null; + settingsBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.StringValue settings = 9; + */ + public com.google.protobuf.StringValue.Builder getSettingsBuilder() { + + onChanged(); + return getSettingsFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.StringValue settings = 9; + */ + public com.google.protobuf.StringValueOrBuilder getSettingsOrBuilder() { + if (settingsBuilder_ != null) { + return settingsBuilder_.getMessageOrBuilder(); + } else { + return settings_ == null ? + com.google.protobuf.StringValue.getDefaultInstance() : settings_; + } + } + /** + * .google.protobuf.StringValue settings = 9; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> + getSettingsFieldBuilder() { + if (settingsBuilder_ == null) { + settingsBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder>( + getSettings(), + getParentForChildren(), + isClean()); + settings_ = null; + } + return settingsBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> textBuilder_; + /** + * .google.protobuf.StringValue text = 10; + * @return Whether the text field is set. + */ + @java.lang.Override + public boolean hasText() { + return resultCase_ == 10; + } + /** + * .google.protobuf.StringValue text = 10; + * @return The text. + */ + @java.lang.Override + public com.google.protobuf.StringValue getText() { + if (textBuilder_ == null) { + if (resultCase_ == 10) { + return (com.google.protobuf.StringValue) result_; + } + return com.google.protobuf.StringValue.getDefaultInstance(); + } else { + if (resultCase_ == 10) { + return textBuilder_.getMessage(); + } + return com.google.protobuf.StringValue.getDefaultInstance(); + } + } + /** + * .google.protobuf.StringValue text = 10; + */ + public Builder setText(com.google.protobuf.StringValue value) { + if (textBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + result_ = value; + onChanged(); + } else { + textBuilder_.setMessage(value); + } + resultCase_ = 10; + return this; + } + /** + * .google.protobuf.StringValue text = 10; + */ + public Builder setText( + com.google.protobuf.StringValue.Builder builderForValue) { + if (textBuilder_ == null) { + result_ = builderForValue.build(); + onChanged(); + } else { + textBuilder_.setMessage(builderForValue.build()); + } + resultCase_ = 10; + return this; + } + /** + * .google.protobuf.StringValue text = 10; + */ + public Builder mergeText(com.google.protobuf.StringValue value) { + if (textBuilder_ == null) { + if (resultCase_ == 10 && + result_ != com.google.protobuf.StringValue.getDefaultInstance()) { + result_ = com.google.protobuf.StringValue.newBuilder((com.google.protobuf.StringValue) result_) + .mergeFrom(value).buildPartial(); + } else { + result_ = value; + } + onChanged(); + } else { + if (resultCase_ == 10) { + textBuilder_.mergeFrom(value); + } + textBuilder_.setMessage(value); + } + resultCase_ = 10; + return this; + } + /** + * .google.protobuf.StringValue text = 10; + */ + public Builder clearText() { + if (textBuilder_ == null) { + if (resultCase_ == 10) { + resultCase_ = 0; + result_ = null; + onChanged(); + } + } else { + if (resultCase_ == 10) { + resultCase_ = 0; + result_ = null; + } + textBuilder_.clear(); + } + return this; + } + /** + * .google.protobuf.StringValue text = 10; + */ + public com.google.protobuf.StringValue.Builder getTextBuilder() { + return getTextFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.StringValue text = 10; + */ + @java.lang.Override + public com.google.protobuf.StringValueOrBuilder getTextOrBuilder() { + if ((resultCase_ == 10) && (textBuilder_ != null)) { + return textBuilder_.getMessageOrBuilder(); + } else { + if (resultCase_ == 10) { + return (com.google.protobuf.StringValue) result_; + } + return com.google.protobuf.StringValue.getDefaultInstance(); + } + } + /** + * .google.protobuf.StringValue text = 10; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> + getTextFieldBuilder() { + if (textBuilder_ == null) { + if (!(resultCase_ == 10)) { + result_ = com.google.protobuf.StringValue.getDefaultInstance(); + } + textBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder>( + (com.google.protobuf.StringValue) result_, + getParentForChildren(), + isClean()); + result_ = null; + } + resultCase_ = 10; + onChanged();; + return textBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcFile, io.evitadb.externalApi.grpc.generated.GrpcFile.Builder, io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder> fileBuilder_; + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + * @return Whether the file field is set. + */ + @java.lang.Override + public boolean hasFile() { + return resultCase_ == 11; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + * @return The file. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFile getFile() { + if (fileBuilder_ == null) { + if (resultCase_ == 11) { + return (io.evitadb.externalApi.grpc.generated.GrpcFile) result_; + } + return io.evitadb.externalApi.grpc.generated.GrpcFile.getDefaultInstance(); + } else { + if (resultCase_ == 11) { + return fileBuilder_.getMessage(); + } + return io.evitadb.externalApi.grpc.generated.GrpcFile.getDefaultInstance(); + } + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + */ + public Builder setFile(io.evitadb.externalApi.grpc.generated.GrpcFile value) { + if (fileBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + result_ = value; + onChanged(); + } else { + fileBuilder_.setMessage(value); + } + resultCase_ = 11; + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + */ + public Builder setFile( + io.evitadb.externalApi.grpc.generated.GrpcFile.Builder builderForValue) { + if (fileBuilder_ == null) { + result_ = builderForValue.build(); + onChanged(); + } else { + fileBuilder_.setMessage(builderForValue.build()); + } + resultCase_ = 11; + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + */ + public Builder mergeFile(io.evitadb.externalApi.grpc.generated.GrpcFile value) { + if (fileBuilder_ == null) { + if (resultCase_ == 11 && + result_ != io.evitadb.externalApi.grpc.generated.GrpcFile.getDefaultInstance()) { + result_ = io.evitadb.externalApi.grpc.generated.GrpcFile.newBuilder((io.evitadb.externalApi.grpc.generated.GrpcFile) result_) + .mergeFrom(value).buildPartial(); + } else { + result_ = value; + } + onChanged(); + } else { + if (resultCase_ == 11) { + fileBuilder_.mergeFrom(value); + } + fileBuilder_.setMessage(value); + } + resultCase_ = 11; + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + */ + public Builder clearFile() { + if (fileBuilder_ == null) { + if (resultCase_ == 11) { + resultCase_ = 0; + result_ = null; + onChanged(); + } + } else { + if (resultCase_ == 11) { + resultCase_ = 0; + result_ = null; + } + fileBuilder_.clear(); + } + return this; + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + */ + public io.evitadb.externalApi.grpc.generated.GrpcFile.Builder getFileBuilder() { + return getFileFieldBuilder().getBuilder(); + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder getFileOrBuilder() { + if ((resultCase_ == 11) && (fileBuilder_ != null)) { + return fileBuilder_.getMessageOrBuilder(); + } else { + if (resultCase_ == 11) { + return (io.evitadb.externalApi.grpc.generated.GrpcFile) result_; + } + return io.evitadb.externalApi.grpc.generated.GrpcFile.getDefaultInstance(); + } + } + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcFile, io.evitadb.externalApi.grpc.generated.GrpcFile.Builder, io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder> + getFileFieldBuilder() { + if (fileBuilder_ == null) { + if (!(resultCase_ == 11)) { + result_ = io.evitadb.externalApi.grpc.generated.GrpcFile.getDefaultInstance(); + } + fileBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcFile, io.evitadb.externalApi.grpc.generated.GrpcFile.Builder, io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder>( + (io.evitadb.externalApi.grpc.generated.GrpcFile) result_, + getParentForChildren(), + isClean()); + result_ = null; + } + resultCase_ = 11; + onChanged();; + return fileBuilder_; + } + + private com.google.protobuf.StringValue exception_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> exceptionBuilder_; + /** + * .google.protobuf.StringValue exception = 12; + * @return Whether the exception field is set. + */ + public boolean hasException() { + return exceptionBuilder_ != null || exception_ != null; + } + /** + * .google.protobuf.StringValue exception = 12; + * @return The exception. + */ + public com.google.protobuf.StringValue getException() { + if (exceptionBuilder_ == null) { + return exception_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : exception_; + } else { + return exceptionBuilder_.getMessage(); + } + } + /** + * .google.protobuf.StringValue exception = 12; + */ + public Builder setException(com.google.protobuf.StringValue value) { + if (exceptionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + exception_ = value; + onChanged(); + } else { + exceptionBuilder_.setMessage(value); + } + + return this; + } + /** + * .google.protobuf.StringValue exception = 12; + */ + public Builder setException( + com.google.protobuf.StringValue.Builder builderForValue) { + if (exceptionBuilder_ == null) { + exception_ = builderForValue.build(); + onChanged(); + } else { + exceptionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .google.protobuf.StringValue exception = 12; + */ + public Builder mergeException(com.google.protobuf.StringValue value) { + if (exceptionBuilder_ == null) { + if (exception_ != null) { + exception_ = + com.google.protobuf.StringValue.newBuilder(exception_).mergeFrom(value).buildPartial(); + } else { + exception_ = value; + } + onChanged(); + } else { + exceptionBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .google.protobuf.StringValue exception = 12; + */ + public Builder clearException() { + if (exceptionBuilder_ == null) { + exception_ = null; + onChanged(); + } else { + exception_ = null; + exceptionBuilder_ = null; + } + + return this; + } + /** + * .google.protobuf.StringValue exception = 12; + */ + public com.google.protobuf.StringValue.Builder getExceptionBuilder() { + + onChanged(); + return getExceptionFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.StringValue exception = 12; + */ + public com.google.protobuf.StringValueOrBuilder getExceptionOrBuilder() { + if (exceptionBuilder_ != null) { + return exceptionBuilder_.getMessageOrBuilder(); + } else { + return exception_ == null ? + com.google.protobuf.StringValue.getDefaultInstance() : exception_; + } + } + /** + * .google.protobuf.StringValue exception = 12; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> + getExceptionFieldBuilder() { + if (exceptionBuilder_ == null) { + exceptionBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder>( + getException(), + getParentForChildren(), + isClean()); + exception_ = null; + } + return exceptionBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcTaskStatus) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcTaskStatus) + private static final io.evitadb.externalApi.grpc.generated.GrpcTaskStatus DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcTaskStatus(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatus getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcTaskStatus parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcTaskStatus(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusOrBuilder.java new file mode 100644 index 000000000..c946f4f6d --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusOrBuilder.java @@ -0,0 +1,199 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +public interface GrpcTaskStatusOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcTaskStatus) + com.google.protobuf.MessageOrBuilder { + + /** + * string taskType = 1; + * @return The taskType. + */ + java.lang.String getTaskType(); + /** + * string taskType = 1; + * @return The bytes for taskType. + */ + com.google.protobuf.ByteString + getTaskTypeBytes(); + + /** + * string taskName = 2; + * @return The taskName. + */ + java.lang.String getTaskName(); + /** + * string taskName = 2; + * @return The bytes for taskName. + */ + com.google.protobuf.ByteString + getTaskNameBytes(); + + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + * @return Whether the taskId field is set. + */ + boolean hasTaskId(); + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + * @return The taskId. + */ + io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId(); + /** + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 3; + */ + io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder(); + + /** + * .google.protobuf.StringValue catalogName = 4; + * @return Whether the catalogName field is set. + */ + boolean hasCatalogName(); + /** + * .google.protobuf.StringValue catalogName = 4; + * @return The catalogName. + */ + com.google.protobuf.StringValue getCatalogName(); + /** + * .google.protobuf.StringValue catalogName = 4; + */ + com.google.protobuf.StringValueOrBuilder getCatalogNameOrBuilder(); + + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + * @return Whether the issued field is set. + */ + boolean hasIssued(); + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + * @return The issued. + */ + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime getIssued(); + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime issued = 5; + */ + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder getIssuedOrBuilder(); + + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + * @return Whether the started field is set. + */ + boolean hasStarted(); + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + * @return The started. + */ + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime getStarted(); + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime started = 6; + */ + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder getStartedOrBuilder(); + + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + * @return Whether the finished field is set. + */ + boolean hasFinished(); + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + * @return The finished. + */ + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime getFinished(); + /** + * .io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTime finished = 7; + */ + io.evitadb.externalApi.grpc.generated.GrpcOffsetDateTimeOrBuilder getFinishedOrBuilder(); + + /** + * int32 progress = 8; + * @return The progress. + */ + int getProgress(); + + /** + * .google.protobuf.StringValue settings = 9; + * @return Whether the settings field is set. + */ + boolean hasSettings(); + /** + * .google.protobuf.StringValue settings = 9; + * @return The settings. + */ + com.google.protobuf.StringValue getSettings(); + /** + * .google.protobuf.StringValue settings = 9; + */ + com.google.protobuf.StringValueOrBuilder getSettingsOrBuilder(); + + /** + * .google.protobuf.StringValue text = 10; + * @return Whether the text field is set. + */ + boolean hasText(); + /** + * .google.protobuf.StringValue text = 10; + * @return The text. + */ + com.google.protobuf.StringValue getText(); + /** + * .google.protobuf.StringValue text = 10; + */ + com.google.protobuf.StringValueOrBuilder getTextOrBuilder(); + + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + * @return Whether the file field is set. + */ + boolean hasFile(); + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + * @return The file. + */ + io.evitadb.externalApi.grpc.generated.GrpcFile getFile(); + /** + * .io.evitadb.externalApi.grpc.generated.GrpcFile file = 11; + */ + io.evitadb.externalApi.grpc.generated.GrpcFileOrBuilder getFileOrBuilder(); + + /** + * .google.protobuf.StringValue exception = 12; + * @return Whether the exception field is set. + */ + boolean hasException(); + /** + * .google.protobuf.StringValue exception = 12; + * @return The exception. + */ + com.google.protobuf.StringValue getException(); + /** + * .google.protobuf.StringValue exception = 12; + */ + com.google.protobuf.StringValueOrBuilder getExceptionOrBuilder(); + + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.ResultCase getResultCase(); +} diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusRequest.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusRequest.java new file mode 100644 index 000000000..39efdf479 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusRequest.java @@ -0,0 +1,686 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Request to get single task status by id
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest} + */ +public final class GrpcTaskStatusRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest) + GrpcTaskStatusRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcTaskStatusRequest.newBuilder() to construct. + private GrpcTaskStatusRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcTaskStatusRequest() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcTaskStatusRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcTaskStatusRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder subBuilder = null; + if (taskId_ != null) { + subBuilder = taskId_.toBuilder(); + } + taskId_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcUuid.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(taskId_); + taskId_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest.class, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest.Builder.class); + } + + public static final int TASKID_FIELD_NUMBER = 1; + private io.evitadb.externalApi.grpc.generated.GrpcUuid taskId_; + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return Whether the taskId field is set. + */ + @java.lang.Override + public boolean hasTaskId() { + return taskId_ != null; + } + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return The taskId. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId() { + return taskId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder() { + return getTaskId(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (taskId_ != null) { + output.writeMessage(1, getTaskId()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (taskId_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getTaskId()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest other = (io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest) obj; + + if (hasTaskId() != other.hasTaskId()) return false; + if (hasTaskId()) { + if (!getTaskId() + .equals(other.getTaskId())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasTaskId()) { + hash = (37 * hash) + TASKID_FIELD_NUMBER; + hash = (53 * hash) + getTaskId().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Request to get single task status by id
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest) + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest.class, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (taskIdBuilder_ == null) { + taskId_ = null; + } else { + taskId_ = null; + taskIdBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusRequest_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest build() { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest result = new io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest(this); + if (taskIdBuilder_ == null) { + result.taskId_ = taskId_; + } else { + result.taskId_ = taskIdBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest.getDefaultInstance()) return this; + if (other.hasTaskId()) { + mergeTaskId(other.getTaskId()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private io.evitadb.externalApi.grpc.generated.GrpcUuid taskId_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> taskIdBuilder_; + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return Whether the taskId field is set. + */ + public boolean hasTaskId() { + return taskIdBuilder_ != null || taskId_ != null; + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return The taskId. + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId() { + if (taskIdBuilder_ == null) { + return taskId_ == null ? io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } else { + return taskIdBuilder_.getMessage(); + } + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public Builder setTaskId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (taskIdBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + taskId_ = value; + onChanged(); + } else { + taskIdBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public Builder setTaskId( + io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder builderForValue) { + if (taskIdBuilder_ == null) { + taskId_ = builderForValue.build(); + onChanged(); + } else { + taskIdBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public Builder mergeTaskId(io.evitadb.externalApi.grpc.generated.GrpcUuid value) { + if (taskIdBuilder_ == null) { + if (taskId_ != null) { + taskId_ = + io.evitadb.externalApi.grpc.generated.GrpcUuid.newBuilder(taskId_).mergeFrom(value).buildPartial(); + } else { + taskId_ = value; + } + onChanged(); + } else { + taskIdBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public Builder clearTaskId() { + if (taskIdBuilder_ == null) { + taskId_ = null; + onChanged(); + } else { + taskId_ = null; + taskIdBuilder_ = null; + } + + return this; + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder getTaskIdBuilder() { + + onChanged(); + return getTaskIdFieldBuilder().getBuilder(); + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder() { + if (taskIdBuilder_ != null) { + return taskIdBuilder_.getMessageOrBuilder(); + } else { + return taskId_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcUuid.getDefaultInstance() : taskId_; + } + } + /** + *
+     * Identification of the task
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder> + getTaskIdFieldBuilder() { + if (taskIdBuilder_ == null) { + taskIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcUuid, io.evitadb.externalApi.grpc.generated.GrpcUuid.Builder, io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder>( + getTaskId(), + getParentForChildren(), + isClean()); + taskId_ = null; + } + return taskIdBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest) + private static final io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcTaskStatusRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcTaskStatusRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusRequestOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusRequestOrBuilder.java new file mode 100644 index 000000000..0942ace31 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusRequestOrBuilder.java @@ -0,0 +1,59 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +public interface GrpcTaskStatusRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return Whether the taskId field is set. + */ + boolean hasTaskId(); + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + * @return The taskId. + */ + io.evitadb.externalApi.grpc.generated.GrpcUuid getTaskId(); + /** + *
+   * Identification of the task
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcUuid taskId = 1; + */ + io.evitadb.externalApi.grpc.generated.GrpcUuidOrBuilder getTaskIdOrBuilder(); +} diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusResponse.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusResponse.java new file mode 100644 index 000000000..ca3988108 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusResponse.java @@ -0,0 +1,686 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Response to a task status request.
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse} + */ +public final class GrpcTaskStatusResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse) + GrpcTaskStatusResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcTaskStatusResponse.newBuilder() to construct. + private GrpcTaskStatusResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcTaskStatusResponse() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcTaskStatusResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcTaskStatusResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder subBuilder = null; + if (taskStatus_ != null) { + subBuilder = taskStatus_.toBuilder(); + } + taskStatus_ = input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(taskStatus_); + taskStatus_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse.class, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse.Builder.class); + } + + public static final int TASKSTATUS_FIELD_NUMBER = 1; + private io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus_; + /** + *
+   * Task status if found
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + * @return Whether the taskStatus field is set. + */ + @java.lang.Override + public boolean hasTaskStatus() { + return taskStatus_ != null; + } + /** + *
+   * Task status if found
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + * @return The taskStatus. + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus getTaskStatus() { + return taskStatus_ == null ? io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.getDefaultInstance() : taskStatus_; + } + /** + *
+   * Task status if found
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder getTaskStatusOrBuilder() { + return getTaskStatus(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (taskStatus_ != null) { + output.writeMessage(1, getTaskStatus()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (taskStatus_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getTaskStatus()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse other = (io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse) obj; + + if (hasTaskStatus() != other.hasTaskStatus()) return false; + if (hasTaskStatus()) { + if (!getTaskStatus() + .equals(other.getTaskStatus())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasTaskStatus()) { + hash = (37 * hash) + TASKSTATUS_FIELD_NUMBER; + hash = (53 * hash) + getTaskStatus().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Response to a task status request.
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse) + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse.class, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (taskStatusBuilder_ == null) { + taskStatus_ = null; + } else { + taskStatus_ = null; + taskStatusBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusResponse_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse build() { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse result = new io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse(this); + if (taskStatusBuilder_ == null) { + result.taskStatus_ = taskStatus_; + } else { + result.taskStatus_ = taskStatusBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse.getDefaultInstance()) return this; + if (other.hasTaskStatus()) { + mergeTaskStatus(other.getTaskStatus()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus_; + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder> taskStatusBuilder_; + /** + *
+     * Task status if found
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + * @return Whether the taskStatus field is set. + */ + public boolean hasTaskStatus() { + return taskStatusBuilder_ != null || taskStatus_ != null; + } + /** + *
+     * Task status if found
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + * @return The taskStatus. + */ + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus getTaskStatus() { + if (taskStatusBuilder_ == null) { + return taskStatus_ == null ? io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.getDefaultInstance() : taskStatus_; + } else { + return taskStatusBuilder_.getMessage(); + } + } + /** + *
+     * Task status if found
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + */ + public Builder setTaskStatus(io.evitadb.externalApi.grpc.generated.GrpcTaskStatus value) { + if (taskStatusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + taskStatus_ = value; + onChanged(); + } else { + taskStatusBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Task status if found
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + */ + public Builder setTaskStatus( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder builderForValue) { + if (taskStatusBuilder_ == null) { + taskStatus_ = builderForValue.build(); + onChanged(); + } else { + taskStatusBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Task status if found
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + */ + public Builder mergeTaskStatus(io.evitadb.externalApi.grpc.generated.GrpcTaskStatus value) { + if (taskStatusBuilder_ == null) { + if (taskStatus_ != null) { + taskStatus_ = + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.newBuilder(taskStatus_).mergeFrom(value).buildPartial(); + } else { + taskStatus_ = value; + } + onChanged(); + } else { + taskStatusBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Task status if found
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + */ + public Builder clearTaskStatus() { + if (taskStatusBuilder_ == null) { + taskStatus_ = null; + onChanged(); + } else { + taskStatus_ = null; + taskStatusBuilder_ = null; + } + + return this; + } + /** + *
+     * Task status if found
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder getTaskStatusBuilder() { + + onChanged(); + return getTaskStatusFieldBuilder().getBuilder(); + } + /** + *
+     * Task status if found
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + */ + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder getTaskStatusOrBuilder() { + if (taskStatusBuilder_ != null) { + return taskStatusBuilder_.getMessageOrBuilder(); + } else { + return taskStatus_ == null ? + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.getDefaultInstance() : taskStatus_; + } + } + /** + *
+     * Task status if found
+     * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder> + getTaskStatusFieldBuilder() { + if (taskStatusBuilder_ == null) { + taskStatusBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder>( + getTaskStatus(), + getParentForChildren(), + isClean()); + taskStatus_ = null; + } + return taskStatusBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse) + private static final io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcTaskStatusResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcTaskStatusResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusResponseOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusResponseOrBuilder.java new file mode 100644 index 000000000..d871582fb --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusResponseOrBuilder.java @@ -0,0 +1,59 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +public interface GrpcTaskStatusResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Task status if found
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + * @return Whether the taskStatus field is set. + */ + boolean hasTaskStatus(); + /** + *
+   * Task status if found
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + * @return The taskStatus. + */ + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus getTaskStatus(); + /** + *
+   * Task status if found
+   * 
+ * + * .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatus = 1; + */ + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder getTaskStatusOrBuilder(); +} diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesRequest.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesRequest.java new file mode 100644 index 000000000..d0f880798 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesRequest.java @@ -0,0 +1,610 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Request to list task statuses in paginated form.
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest} + */ +public final class GrpcTaskStatusesRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest) + GrpcTaskStatusesRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcTaskStatusesRequest.newBuilder() to construct. + private GrpcTaskStatusesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcTaskStatusesRequest() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcTaskStatusesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcTaskStatusesRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + pageNumber_ = input.readInt32(); + break; + } + case 16: { + + pageSize_ = input.readInt32(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest.class, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest.Builder.class); + } + + public static final int PAGENUMBER_FIELD_NUMBER = 1; + private int pageNumber_; + /** + *
+   * Page number of the task statuses to be listed.
+   * 
+ * + * int32 pageNumber = 1; + * @return The pageNumber. + */ + @java.lang.Override + public int getPageNumber() { + return pageNumber_; + } + + public static final int PAGESIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + *
+   * Number of task statuses per page.
+   * 
+ * + * int32 pageSize = 2; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (pageNumber_ != 0) { + output.writeInt32(1, pageNumber_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (pageNumber_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, pageNumber_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, pageSize_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest other = (io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest) obj; + + if (getPageNumber() + != other.getPageNumber()) return false; + if (getPageSize() + != other.getPageSize()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PAGENUMBER_FIELD_NUMBER; + hash = (53 * hash) + getPageNumber(); + hash = (37 * hash) + PAGESIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Request to list task statuses in paginated form.
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest) + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest.class, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + pageNumber_ = 0; + + pageSize_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesRequest_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest build() { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest result = new io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest(this); + result.pageNumber_ = pageNumber_; + result.pageSize_ = pageSize_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest.getDefaultInstance()) return this; + if (other.getPageNumber() != 0) { + setPageNumber(other.getPageNumber()); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int pageNumber_ ; + /** + *
+     * Page number of the task statuses to be listed.
+     * 
+ * + * int32 pageNumber = 1; + * @return The pageNumber. + */ + @java.lang.Override + public int getPageNumber() { + return pageNumber_; + } + /** + *
+     * Page number of the task statuses to be listed.
+     * 
+ * + * int32 pageNumber = 1; + * @param value The pageNumber to set. + * @return This builder for chaining. + */ + public Builder setPageNumber(int value) { + + pageNumber_ = value; + onChanged(); + return this; + } + /** + *
+     * Page number of the task statuses to be listed.
+     * 
+ * + * int32 pageNumber = 1; + * @return This builder for chaining. + */ + public Builder clearPageNumber() { + + pageNumber_ = 0; + onChanged(); + return this; + } + + private int pageSize_ ; + /** + *
+     * Number of task statuses per page.
+     * 
+ * + * int32 pageSize = 2; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + *
+     * Number of task statuses per page.
+     * 
+ * + * int32 pageSize = 2; + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + *
+     * Number of task statuses per page.
+     * 
+ * + * int32 pageSize = 2; + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest) + private static final io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcTaskStatusesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcTaskStatusesRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_api/src/main/java/io/evitadb/api/task/JobStatus.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesRequestOrBuilder.java similarity index 54% rename from evita_api/src/main/java/io/evitadb/api/task/JobStatus.java rename to evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesRequestOrBuilder.java index 98140cd2c..2dfa35f00 100644 --- a/evita_api/src/main/java/io/evitadb/api/task/JobStatus.java +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesRequestOrBuilder.java @@ -6,7 +6,7 @@ * | __/\ V /| | || (_| | |_| | |_) | * \___| \_/ |_|\__\__,_|____/|____/ * - * Copyright (c) 2024 + * Copyright (c) 2023-2024 * * Licensed under the Business Source License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -21,23 +21,32 @@ * limitations under the License. */ -package io.evitadb.api.task; +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto -import java.io.Serializable; -import java.time.OffsetDateTime; +package io.evitadb.externalApi.grpc.generated; -/** - * TODO JNO - document me - * - * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 - */ -public record JobStatus( - JobType jobType, - OffsetDateTime issued, - OffsetDateTime started, - OffsetDateTime finished, - int progress, - S settings, - T result -) implements Serializable { +public interface GrpcTaskStatusesRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Page number of the task statuses to be listed.
+   * 
+ * + * int32 pageNumber = 1; + * @return The pageNumber. + */ + int getPageNumber(); + + /** + *
+   * Number of task statuses per page.
+   * 
+ * + * int32 pageSize = 2; + * @return The pageSize. + */ + int getPageSize(); } diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesResponse.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesResponse.java new file mode 100644 index 000000000..daf780cd8 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesResponse.java @@ -0,0 +1,1133 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +/** + *
+ * Response to a task statuses request.
+ * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse} + */ +public final class GrpcTaskStatusesResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse) + GrpcTaskStatusesResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use GrpcTaskStatusesResponse.newBuilder() to construct. + private GrpcTaskStatusesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GrpcTaskStatusesResponse() { + taskStatuses_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new GrpcTaskStatusesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GrpcTaskStatusesResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + pageSize_ = input.readInt32(); + break; + } + case 16: { + + pageNumber_ = input.readInt32(); + break; + } + case 26: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + taskStatuses_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + taskStatuses_.add( + input.readMessage(io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.parser(), extensionRegistry)); + break; + } + case 32: { + + totalNumberOfRecords_ = input.readInt32(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + taskStatuses_ = java.util.Collections.unmodifiableList(taskStatuses_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse.class, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse.Builder.class); + } + + public static final int PAGESIZE_FIELD_NUMBER = 1; + private int pageSize_; + /** + *
+   * The size of the page.
+   * 
+ * + * int32 pageSize = 1; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGENUMBER_FIELD_NUMBER = 2; + private int pageNumber_; + /** + *
+   * The number of the page.
+   * 
+ * + * int32 pageNumber = 2; + * @return The pageNumber. + */ + @java.lang.Override + public int getPageNumber() { + return pageNumber_; + } + + public static final int TASKSTATUSES_FIELD_NUMBER = 3; + private java.util.List taskStatuses_; + /** + *
+   * Collection of task statuses.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + @java.lang.Override + public java.util.List getTaskStatusesList() { + return taskStatuses_; + } + /** + *
+   * Collection of task statuses.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + @java.lang.Override + public java.util.List + getTaskStatusesOrBuilderList() { + return taskStatuses_; + } + /** + *
+   * Collection of task statuses.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + @java.lang.Override + public int getTaskStatusesCount() { + return taskStatuses_.size(); + } + /** + *
+   * Collection of task statuses.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus getTaskStatuses(int index) { + return taskStatuses_.get(index); + } + /** + *
+   * Collection of task statuses.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder getTaskStatusesOrBuilder( + int index) { + return taskStatuses_.get(index); + } + + public static final int TOTALNUMBEROFRECORDS_FIELD_NUMBER = 4; + private int totalNumberOfRecords_; + /** + *
+   * Total number of task statuses.
+   * 
+ * + * int32 totalNumberOfRecords = 4; + * @return The totalNumberOfRecords. + */ + @java.lang.Override + public int getTotalNumberOfRecords() { + return totalNumberOfRecords_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (pageSize_ != 0) { + output.writeInt32(1, pageSize_); + } + if (pageNumber_ != 0) { + output.writeInt32(2, pageNumber_); + } + for (int i = 0; i < taskStatuses_.size(); i++) { + output.writeMessage(3, taskStatuses_.get(i)); + } + if (totalNumberOfRecords_ != 0) { + output.writeInt32(4, totalNumberOfRecords_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, pageSize_); + } + if (pageNumber_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, pageNumber_); + } + for (int i = 0; i < taskStatuses_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, taskStatuses_.get(i)); + } + if (totalNumberOfRecords_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, totalNumberOfRecords_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse)) { + return super.equals(obj); + } + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse other = (io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse) obj; + + if (getPageSize() + != other.getPageSize()) return false; + if (getPageNumber() + != other.getPageNumber()) return false; + if (!getTaskStatusesList() + .equals(other.getTaskStatusesList())) return false; + if (getTotalNumberOfRecords() + != other.getTotalNumberOfRecords()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PAGESIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGENUMBER_FIELD_NUMBER; + hash = (53 * hash) + getPageNumber(); + if (getTaskStatusesCount() > 0) { + hash = (37 * hash) + TASKSTATUSES_FIELD_NUMBER; + hash = (53 * hash) + getTaskStatusesList().hashCode(); + } + hash = (37 * hash) + TOTALNUMBEROFRECORDS_FIELD_NUMBER; + hash = (53 * hash) + getTotalNumberOfRecords(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Response to a task statuses request.
+   * 
+ * + * Protobuf type {@code io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse) + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse.class, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse.Builder.class); + } + + // Construct using io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getTaskStatusesFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + pageSize_ = 0; + + pageNumber_ = 0; + + if (taskStatusesBuilder_ == null) { + taskStatuses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + taskStatusesBuilder_.clear(); + } + totalNumberOfRecords_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.evitadb.externalApi.grpc.generated.GrpcEvitaAPI.internal_static_io_evitadb_externalApi_grpc_generated_GrpcTaskStatusesResponse_descriptor; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse getDefaultInstanceForType() { + return io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse.getDefaultInstance(); + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse build() { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse buildPartial() { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse result = new io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse(this); + int from_bitField0_ = bitField0_; + result.pageSize_ = pageSize_; + result.pageNumber_ = pageNumber_; + if (taskStatusesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + taskStatuses_ = java.util.Collections.unmodifiableList(taskStatuses_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.taskStatuses_ = taskStatuses_; + } else { + result.taskStatuses_ = taskStatusesBuilder_.build(); + } + result.totalNumberOfRecords_ = totalNumberOfRecords_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse) { + return mergeFrom((io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse other) { + if (other == io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse.getDefaultInstance()) return this; + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (other.getPageNumber() != 0) { + setPageNumber(other.getPageNumber()); + } + if (taskStatusesBuilder_ == null) { + if (!other.taskStatuses_.isEmpty()) { + if (taskStatuses_.isEmpty()) { + taskStatuses_ = other.taskStatuses_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTaskStatusesIsMutable(); + taskStatuses_.addAll(other.taskStatuses_); + } + onChanged(); + } + } else { + if (!other.taskStatuses_.isEmpty()) { + if (taskStatusesBuilder_.isEmpty()) { + taskStatusesBuilder_.dispose(); + taskStatusesBuilder_ = null; + taskStatuses_ = other.taskStatuses_; + bitField0_ = (bitField0_ & ~0x00000001); + taskStatusesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getTaskStatusesFieldBuilder() : null; + } else { + taskStatusesBuilder_.addAllMessages(other.taskStatuses_); + } + } + } + if (other.getTotalNumberOfRecords() != 0) { + setTotalNumberOfRecords(other.getTotalNumberOfRecords()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private int pageSize_ ; + /** + *
+     * The size of the page.
+     * 
+ * + * int32 pageSize = 1; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + *
+     * The size of the page.
+     * 
+ * + * int32 pageSize = 1; + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + *
+     * The size of the page.
+     * 
+ * + * int32 pageSize = 1; + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private int pageNumber_ ; + /** + *
+     * The number of the page.
+     * 
+ * + * int32 pageNumber = 2; + * @return The pageNumber. + */ + @java.lang.Override + public int getPageNumber() { + return pageNumber_; + } + /** + *
+     * The number of the page.
+     * 
+ * + * int32 pageNumber = 2; + * @param value The pageNumber to set. + * @return This builder for chaining. + */ + public Builder setPageNumber(int value) { + + pageNumber_ = value; + onChanged(); + return this; + } + /** + *
+     * The number of the page.
+     * 
+ * + * int32 pageNumber = 2; + * @return This builder for chaining. + */ + public Builder clearPageNumber() { + + pageNumber_ = 0; + onChanged(); + return this; + } + + private java.util.List taskStatuses_ = + java.util.Collections.emptyList(); + private void ensureTaskStatusesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + taskStatuses_ = new java.util.ArrayList(taskStatuses_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder> taskStatusesBuilder_; + + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public java.util.List getTaskStatusesList() { + if (taskStatusesBuilder_ == null) { + return java.util.Collections.unmodifiableList(taskStatuses_); + } else { + return taskStatusesBuilder_.getMessageList(); + } + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public int getTaskStatusesCount() { + if (taskStatusesBuilder_ == null) { + return taskStatuses_.size(); + } else { + return taskStatusesBuilder_.getCount(); + } + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus getTaskStatuses(int index) { + if (taskStatusesBuilder_ == null) { + return taskStatuses_.get(index); + } else { + return taskStatusesBuilder_.getMessage(index); + } + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public Builder setTaskStatuses( + int index, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus value) { + if (taskStatusesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTaskStatusesIsMutable(); + taskStatuses_.set(index, value); + onChanged(); + } else { + taskStatusesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public Builder setTaskStatuses( + int index, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder builderForValue) { + if (taskStatusesBuilder_ == null) { + ensureTaskStatusesIsMutable(); + taskStatuses_.set(index, builderForValue.build()); + onChanged(); + } else { + taskStatusesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public Builder addTaskStatuses(io.evitadb.externalApi.grpc.generated.GrpcTaskStatus value) { + if (taskStatusesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTaskStatusesIsMutable(); + taskStatuses_.add(value); + onChanged(); + } else { + taskStatusesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public Builder addTaskStatuses( + int index, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus value) { + if (taskStatusesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTaskStatusesIsMutable(); + taskStatuses_.add(index, value); + onChanged(); + } else { + taskStatusesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public Builder addTaskStatuses( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder builderForValue) { + if (taskStatusesBuilder_ == null) { + ensureTaskStatusesIsMutable(); + taskStatuses_.add(builderForValue.build()); + onChanged(); + } else { + taskStatusesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public Builder addTaskStatuses( + int index, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder builderForValue) { + if (taskStatusesBuilder_ == null) { + ensureTaskStatusesIsMutable(); + taskStatuses_.add(index, builderForValue.build()); + onChanged(); + } else { + taskStatusesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public Builder addAllTaskStatuses( + java.lang.Iterable values) { + if (taskStatusesBuilder_ == null) { + ensureTaskStatusesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, taskStatuses_); + onChanged(); + } else { + taskStatusesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public Builder clearTaskStatuses() { + if (taskStatusesBuilder_ == null) { + taskStatuses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + taskStatusesBuilder_.clear(); + } + return this; + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public Builder removeTaskStatuses(int index) { + if (taskStatusesBuilder_ == null) { + ensureTaskStatusesIsMutable(); + taskStatuses_.remove(index); + onChanged(); + } else { + taskStatusesBuilder_.remove(index); + } + return this; + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder getTaskStatusesBuilder( + int index) { + return getTaskStatusesFieldBuilder().getBuilder(index); + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder getTaskStatusesOrBuilder( + int index) { + if (taskStatusesBuilder_ == null) { + return taskStatuses_.get(index); } else { + return taskStatusesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public java.util.List + getTaskStatusesOrBuilderList() { + if (taskStatusesBuilder_ != null) { + return taskStatusesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(taskStatuses_); + } + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder addTaskStatusesBuilder() { + return getTaskStatusesFieldBuilder().addBuilder( + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.getDefaultInstance()); + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder addTaskStatusesBuilder( + int index) { + return getTaskStatusesFieldBuilder().addBuilder( + index, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.getDefaultInstance()); + } + /** + *
+     * Collection of task statuses.
+     * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + public java.util.List + getTaskStatusesBuilderList() { + return getTaskStatusesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder> + getTaskStatusesFieldBuilder() { + if (taskStatusesBuilder_ == null) { + taskStatusesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus, io.evitadb.externalApi.grpc.generated.GrpcTaskStatus.Builder, io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder>( + taskStatuses_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + taskStatuses_ = null; + } + return taskStatusesBuilder_; + } + + private int totalNumberOfRecords_ ; + /** + *
+     * Total number of task statuses.
+     * 
+ * + * int32 totalNumberOfRecords = 4; + * @return The totalNumberOfRecords. + */ + @java.lang.Override + public int getTotalNumberOfRecords() { + return totalNumberOfRecords_; + } + /** + *
+     * Total number of task statuses.
+     * 
+ * + * int32 totalNumberOfRecords = 4; + * @param value The totalNumberOfRecords to set. + * @return This builder for chaining. + */ + public Builder setTotalNumberOfRecords(int value) { + + totalNumberOfRecords_ = value; + onChanged(); + return this; + } + /** + *
+     * Total number of task statuses.
+     * 
+ * + * int32 totalNumberOfRecords = 4; + * @return This builder for chaining. + */ + public Builder clearTotalNumberOfRecords() { + + totalNumberOfRecords_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse) + } + + // @@protoc_insertion_point(class_scope:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse) + private static final io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse(); + } + + public static io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GrpcTaskStatusesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GrpcTaskStatusesResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesResponseOrBuilder.java b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesResponseOrBuilder.java new file mode 100644 index 000000000..7b0227b42 --- /dev/null +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/java/io/evitadb/externalApi/grpc/generated/GrpcTaskStatusesResponseOrBuilder.java @@ -0,0 +1,106 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2023-2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GrpcEvitaAPI.proto + +package io.evitadb.externalApi.grpc.generated; + +public interface GrpcTaskStatusesResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.evitadb.externalApi.grpc.generated.GrpcTaskStatusesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The size of the page.
+   * 
+ * + * int32 pageSize = 1; + * @return The pageSize. + */ + int getPageSize(); + + /** + *
+   * The number of the page.
+   * 
+ * + * int32 pageNumber = 2; + * @return The pageNumber. + */ + int getPageNumber(); + + /** + *
+   * Collection of task statuses.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + java.util.List + getTaskStatusesList(); + /** + *
+   * Collection of task statuses.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + io.evitadb.externalApi.grpc.generated.GrpcTaskStatus getTaskStatuses(int index); + /** + *
+   * Collection of task statuses.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + int getTaskStatusesCount(); + /** + *
+   * Collection of task statuses.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + java.util.List + getTaskStatusesOrBuilderList(); + /** + *
+   * Collection of task statuses.
+   * 
+ * + * repeated .io.evitadb.externalApi.grpc.generated.GrpcTaskStatus taskStatuses = 3; + */ + io.evitadb.externalApi.grpc.generated.GrpcTaskStatusOrBuilder getTaskStatusesOrBuilder( + int index); + + /** + *
+   * Total number of task statuses.
+   * 
+ * + * int32 totalNumberOfRecords = 4; + * @return The totalNumberOfRecords. + */ + int getTotalNumberOfRecords(); +} diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/resources/META-INF/io/evitadb/externalApi/grpc/GrpcEvitaAPI.proto b/evita_external_api/evita_external_api_grpc/shared/src/main/resources/META-INF/io/evitadb/externalApi/grpc/GrpcEvitaAPI.proto index 8d533984e..194c17a40 100644 --- a/evita_external_api/evita_external_api_grpc/shared/src/main/resources/META-INF/io/evitadb/externalApi/grpc/GrpcEvitaAPI.proto +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/resources/META-INF/io/evitadb/externalApi/grpc/GrpcEvitaAPI.proto @@ -8,6 +8,7 @@ import "google/protobuf/empty.proto"; import "GrpcEnums.proto"; import "GrpcEvitaDataTypes.proto"; import "GrpcCatalogSchemaMutation.proto"; +import "google/protobuf/wrappers.proto"; // Response to a server status request. message GrpcEvitaServerStatusResponse { @@ -118,10 +119,21 @@ message GrpcRestoreCatalogRequest { bytes backupFile = 2; } +// Request to restore a catalog. +message GrpcRestoreCatalogFromServerFileRequest { + // Name of the catalog where the backup will be restored + // The name must not clash with any of existing catalogs + string catalogName = 1; + // The identification of the file on the server that should be restored + GrpcUuid fileId = 2; +} + // Response to a catalog restore request. message GrpcRestoreCatalogResponse { // returns the number of bytes read from the backup file int64 read = 1; + // the id of the task that is used to restore the catalog and getting its progress + GrpcUuid taskId = 2; } // Request to delete a catalog. @@ -142,6 +154,121 @@ message GrpcUpdateEvitaRequest { repeated GrpcTopLevelCatalogSchemaMutation schemaMutations = 1; } +// identification of the file available for fetching +message GrpcFile { + // Identification of the file + GrpcUuid fileId = 1; + // File name + string name = 2; + // Detailed description of the file + google.protobuf.StringValue description = 3; + // Content type of the file + string contentType = 4; + // Size of the file in bytes + int64 totalSizeInBytes = 5; + // Origin of the file (usually the taskType) + google.protobuf.StringValue origin = 6; +} + +// Record representing status of particular asynchronous task +message GrpcTaskStatus { + string taskType = 1; + string taskName = 2; + GrpcUuid taskId = 3; + google.protobuf.StringValue catalogName = 4; + GrpcOffsetDateTime issued = 5; + GrpcOffsetDateTime started = 6; + GrpcOffsetDateTime finished = 7; + int32 progress = 8; + google.protobuf.StringValue settings = 9; + oneof result { + google.protobuf.StringValue text = 10; + GrpcFile file = 11; + } + google.protobuf.StringValue exception = 12; +} + +// Request to list task statuses in paginated form. +message GrpcTaskStatusesRequest { + // Page number of the task statuses to be listed. + int32 pageNumber = 1; + // Number of task statuses per page. + int32 pageSize = 2; +} + +// Response to a task statuses request. +message GrpcTaskStatusesResponse { + // The size of the page. + int32 pageSize = 1; + // The number of the page. + int32 pageNumber = 2; + // Collection of task statuses. + repeated GrpcTaskStatus taskStatuses = 3; + // Total number of task statuses. + int32 totalNumberOfRecords = 4; +} + +// Request to get single task status by id +message GrpcTaskStatusRequest { + // Identification of the task + GrpcUuid taskId = 1; +} + +// Response to a task status request. +message GrpcTaskStatusResponse { + // Task status if found + GrpcTaskStatus taskStatus = 1; +} + +// Request to get cancel task status by id +message GrpcCancelTaskRequest { + // Identification of the task + GrpcUuid taskId = 1; +} + +// Request to get cancel task status by id +message GrpcCancelTaskResponse { + // true if the task was found and canceled + bool success = 1; +} + +// Request to list task statuses in paginated form. +message GrpcFilesToFetchRequest { + // Page number of the task statuses to be listed. + int32 pageNumber = 1; + // Number of task statuses per page. + int32 pageSize = 2; + // Optional origin of the files (derived from taskType), passing non-null value + // in this argument filters the returned files to only those that are related to the specified origin + google.protobuf.StringValue origin = 3; +} + +// Response to a task statuses request. +message GrpcFilesToFetchResponse { + // The size of the page. + int32 pageSize = 1; + // The number of the page. + int32 pageNumber = 2; + // Collection of files to fetch. + repeated GrpcFile filesToFetch = 3; + // Total number of files to fetch. + int32 totalNumberOfRecords = 4; +} + +// Request to get single file by id +message GrpcFetchFileRequest { + // Identification of the file + GrpcUuid fileId = 1; +} + +// Response to a task status request. +message GrpcFetchFileResponse { + // chunk of the file content + bytes fileContents = 1; + // total size of the file + int64 totalSizeInBytes = 2; +} + // This service contains RPCs that could be called by gRPC clients on evitaDB. Main purpose of this service is to provide // a way to create sessions and catalogs, and to update the catalog. service EvitaService { @@ -167,8 +294,21 @@ service EvitaService { rpc ReplaceCatalog(GrpcReplaceCatalogRequest) returns (GrpcReplaceCatalogResponse); // Procedure used to restore a catalog from backup. rpc RestoreCatalog(stream GrpcRestoreCatalogRequest) returns (GrpcRestoreCatalogResponse); + // Procedure used to restore a catalog from backup. + rpc RestoreCatalogFromServerFile(stream GrpcRestoreCatalogFromServerFileRequest) returns (GrpcRestoreCatalogResponse); // Procedure used to delete an existing catalog. rpc DeleteCatalogIfExists(GrpcDeleteCatalogIfExistsRequest) returns (GrpcDeleteCatalogIfExistsResponse); // Procedure used to update the catalog with a set of mutations. rpc Update(GrpcUpdateEvitaRequest) returns (google.protobuf.Empty); + // Procedure used to get listing of task statuses. + rpc ListTaskStatuses(GrpcTaskStatusesRequest) returns (GrpcTaskStatusesResponse); + // Procedure used to get detail of particular task status. + rpc GetTaskStatus(GrpcTaskStatusRequest) returns (GrpcTaskStatusResponse); + // Procedure used to cancel queued or running task. + rpc CancelTask(GrpcCancelTaskRequest) returns (GrpcCancelTaskResponse); + // Procedure used to get listing of files available for fetching. + rpc ListFilesToFetch(GrpcFilesToFetchRequest) returns (GrpcFilesToFetchResponse); + // Procedure used to get file contents + rpc FetchFile(GrpcFetchFileRequest) returns (GrpcFetchFileResponse); + } diff --git a/evita_external_api/evita_external_api_grpc/shared/src/main/resources/META-INF/io/evitadb/externalApi/grpc/GrpcEvitaSessionAPI.proto b/evita_external_api/evita_external_api_grpc/shared/src/main/resources/META-INF/io/evitadb/externalApi/grpc/GrpcEvitaSessionAPI.proto index 2e30a6edc..810d4c479 100644 --- a/evita_external_api/evita_external_api_grpc/shared/src/main/resources/META-INF/io/evitadb/externalApi/grpc/GrpcEvitaSessionAPI.proto +++ b/evita_external_api/evita_external_api_grpc/shared/src/main/resources/META-INF/io/evitadb/externalApi/grpc/GrpcEvitaSessionAPI.proto @@ -229,8 +229,8 @@ message GrpcGoLiveAndCloseResponse { // Response to a catalog backup request. message GrpcBackupCatalogResponse { - // Binary contents of the backup file. - bytes backupFile = 1; + // the id of the task that is used to backup the catalog and getting its progress + GrpcUuid taskId = 1; } // Request for acquiring the list of all entity types. diff --git a/evita_external_api/evita_external_api_observability/src/main/java/io/evitadb/externalApi/observability/metric/MetricHandler.java b/evita_external_api/evita_external_api_observability/src/main/java/io/evitadb/externalApi/observability/metric/MetricHandler.java index 880702614..00aa0d0da 100644 --- a/evita_external_api/evita_external_api_observability/src/main/java/io/evitadb/externalApi/observability/metric/MetricHandler.java +++ b/evita_external_api/evita_external_api_observability/src/main/java/io/evitadb/externalApi/observability/metric/MetricHandler.java @@ -30,13 +30,14 @@ import io.evitadb.api.observability.annotation.ExportMetric; import io.evitadb.api.observability.annotation.ExportMetricLabel; import io.evitadb.api.observability.annotation.HistogramSettings; +import io.evitadb.api.task.Task; import io.evitadb.core.Evita; -import io.evitadb.core.async.BackgroundRunnableTask; +import io.evitadb.core.async.ClientRunnableTask; +import io.evitadb.core.async.Scheduler; import io.evitadb.core.metric.event.CustomMetricsExecutionEvent; import io.evitadb.externalApi.observability.configuration.ObservabilityConfig; import io.evitadb.function.ChainableConsumer; import io.evitadb.utils.ArrayUtils; -import io.evitadb.utils.Assert; import io.evitadb.utils.ReflectionLookup; import io.evitadb.utils.StringUtils; import io.prometheus.metrics.core.metrics.Counter; @@ -52,6 +53,7 @@ import jdk.jfr.Name; import jdk.jfr.consumer.RecordedEvent; import jdk.jfr.consumer.RecordingStream; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; import javax.annotation.Nonnull; @@ -67,8 +69,8 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; import java.util.regex.Pattern; @@ -342,16 +344,88 @@ public MetricHandler(@Nonnull ObservabilityConfig observabilityConfig) { * @param evita evita instance */ public void registerHandlers(@Nonnull Evita evita) { - ExecutorService executor = evita.getServiceExecutor(); + Scheduler scheduler = evita.getServiceExecutor(); registerJvmMetrics(); final Set> allowedMetrics = getAllowedEventSet(); - final AtomicLong initializedTime = new AtomicLong(Long.MAX_VALUE); - executor.execute( - new BackgroundRunnableTask( + final MetricTask metricTask = new MetricTask(allowedMetrics); + scheduler.submit((Task) metricTask); + + try { + metricTask.getInitialized() + .thenAccept(unused -> { + // emit the start event + evita.emitStartObservabilityEvents(); + }).get(1, TimeUnit.MINUTES); + } catch (Exception e) { + log.error("Failed to initialize metric handler in time. Metrics might not work. Start events are not emitted."); + } + } + + /** + * Registers JVM metrics based on the configuration. + */ + private void registerJvmMetrics() { + final List allowedEventsFromConfig = observabilityConfig.getAllowedEvents(); + + if (allowedEventsFromConfig != null && allowedEventsFromConfig.stream().noneMatch(DEFAULT_JVM_METRICS_NAME::equals)) { + allowedEventsFromConfig + .stream() + .filter(it -> !MetricHandler.isCustomEventClassName(it)) + .map(DEFAULT_JVM_METRICS::get) + .filter(Objects::nonNull) + .forEach(Runnable::run); + } else { + DEFAULT_JVM_METRICS.get(DEFAULT_JVM_METRICS_NAME).run(); + } + } + + /** + * Method calculates the index of allowed events that should be logged and metrics that should be created. + * + * @return index of allowed events and metrics + */ + @Nonnull + private Set> getAllowedEventSet() { + final List allowedEventsFromConfig = observabilityConfig.getAllowedEvents(); + final Set> knownEvents = EvitaJfrEventRegistry.getEventClasses(); + + final Set configuredEvents = new HashSet<>(16); + configuredEvents.addAll( + Objects.requireNonNullElseGet( + allowedEventsFromConfig, + () -> knownEvents.stream().map(Class::getName).toList() + ) + ); + + final Set> allowedEventSet = new HashSet<>(16); + for (String loggingEvent : configuredEvents) { + if (loggingEvent.endsWith(".*")) { + final String packageName = loggingEvent.substring(0, loggingEvent.length() - 2); + final Set> classes = EvitaJfrEventRegistry.getEventClassesFromPackage(packageName); + allowedEventSet.addAll(classes); + } else { + ofNullable(EvitaJfrEventRegistry.getEventClass(loggingEvent)) + .ifPresent(allowedEventSet::add); + } + } + return allowedEventSet; + } + + /** + * Task that listens for JFR events and transforms them into Prometheus metrics. + */ + private static class MetricTask extends ClientRunnableTask implements Task { + @Getter private final CompletableFuture initialized = new CompletableFuture<>(); + + public MetricTask( + @Nonnull Set> allowedMetrics + ) { + super( "Metric handler", - () -> { + null, + theTask -> { final ReflectionLookup lookup = ReflectionLookup.NO_CACHE_INSTANCE; try (var recordingStream = new RecordingStream()) { for (Class eventClass : allowedMetrics) { @@ -486,76 +560,14 @@ public void registerHandlers(@Nonnull Evita evita) { } } - initializedTime.set(System.currentTimeMillis()); + ((MetricTask) theTask).initialized.complete(true); recordingStream.start(); } } - ) - ); - - final long waitStart = System.currentTimeMillis(); - while (System.currentTimeMillis() - initializedTime.get() < 500 && System.currentTimeMillis() - waitStart < 5000) { - Thread.onSpinWait(); - } - - Assert.isPremiseValid( - initializedTime.get() != Long.MAX_VALUE, - "Failed to initialize the metric handler within the specified time." - ); - // emit the start event - evita.emitStartObservabilityEvents(); - } - - /** - * Registers JVM metrics based on the configuration. - */ - private void registerJvmMetrics() { - final List allowedEventsFromConfig = observabilityConfig.getAllowedEvents(); - - if (allowedEventsFromConfig != null && allowedEventsFromConfig.stream().noneMatch(DEFAULT_JVM_METRICS_NAME::equals)) { - allowedEventsFromConfig - .stream() - .filter(it -> !MetricHandler.isCustomEventClassName(it)) - .map(DEFAULT_JVM_METRICS::get) - .filter(Objects::nonNull) - .forEach(Runnable::run); - } else { - DEFAULT_JVM_METRICS.get(DEFAULT_JVM_METRICS_NAME).run(); + ); } } - /** - * Method calculates the index of allowed events that should be logged and metrics that should be created. - * - * @return index of allowed events and metrics - */ - @Nonnull - private Set> getAllowedEventSet() { - final List allowedEventsFromConfig = observabilityConfig.getAllowedEvents(); - final Set> knownEvents = EvitaJfrEventRegistry.getEventClasses(); - - final Set configuredEvents = new HashSet<>(16); - configuredEvents.addAll( - Objects.requireNonNullElseGet( - allowedEventsFromConfig, - () -> knownEvents.stream().map(Class::getName).toList() - ) - ); - - final Set> allowedEventSet = new HashSet<>(16); - for (String loggingEvent : configuredEvents) { - if (loggingEvent.endsWith(".*")) { - final String packageName = loggingEvent.substring(0, loggingEvent.length() - 2); - final Set> classes = EvitaJfrEventRegistry.getEventClassesFromPackage(packageName); - allowedEventSet.addAll(classes); - } else { - ofNullable(EvitaJfrEventRegistry.getEventClass(loggingEvent)) - .ifPresent(allowedEventSet::add); - } - } - return allowedEventSet; - } - /** * Represents the exporter of the metric label identified in the event class by annotation {@link ExportMetricLabel}. * diff --git a/evita_functional_tests/src/test/java/io/evitadb/api/EvitaTest.java b/evita_functional_tests/src/test/java/io/evitadb/api/EvitaTest.java index d79a59de3..fdd5979a5 100644 --- a/evita_functional_tests/src/test/java/io/evitadb/api/EvitaTest.java +++ b/evita_functional_tests/src/test/java/io/evitadb/api/EvitaTest.java @@ -34,6 +34,7 @@ import io.evitadb.api.exception.InvalidSchemaMutationException; import io.evitadb.api.exception.UnexpectedResultCountException; import io.evitadb.api.exception.UnexpectedResultException; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.mock.MockCatalogStructuralChangeObserver; import io.evitadb.api.query.order.OrderDirection; import io.evitadb.api.query.require.FacetStatisticsDepth; @@ -54,7 +55,6 @@ import io.evitadb.api.requestResponse.schema.SealedEntitySchema; import io.evitadb.api.requestResponse.schema.dto.GlobalAttributeUniquenessType; import io.evitadb.api.requestResponse.schema.mutation.catalog.ModifyEntitySchemaMutation; -import io.evitadb.api.task.ProgressiveCompletableFuture; import io.evitadb.core.Evita; import io.evitadb.core.exception.AttributeNotFilterableException; import io.evitadb.core.exception.AttributeNotSortableException; @@ -96,6 +96,7 @@ import java.util.Locale; import java.util.Objects; import java.util.Set; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -1677,12 +1678,12 @@ void shouldProperlyHandleFetchingOfNotYetKnownEntities() { void shouldCreateBackupAndRestoreCatalog() throws IOException, ExecutionException, InterruptedException { setupCatalogWithProductAndCategory(); - final ProgressiveCompletableFuture backupPathFuture = evita.backupCatalog(TEST_CATALOG, null, true); - final Path backupPath = backupPathFuture.join(); + final CompletableFuture backupPathFuture = evita.backupCatalog(TEST_CATALOG, null, true); + final Path backupPath = backupPathFuture.join().path(); assertTrue(backupPath.toFile().exists()); - final ProgressiveCompletableFuture future = evita.restoreCatalog( + final CompletableFuture future = evita.restoreCatalog( TEST_CATALOG + "_restored", Files.size(backupPath), new BufferedInputStream(new FileInputStream(backupPath.toFile())) @@ -1727,12 +1728,12 @@ void shouldCreateBackupAndRestoreTransactionalCatalog() throws IOException, Exec session.goLiveAndClose(); }); - final ProgressiveCompletableFuture backupPathFuture = evita.backupCatalog(TEST_CATALOG, null, true); - final Path backupPath = backupPathFuture.join(); + final CompletableFuture backupPathFuture = evita.backupCatalog(TEST_CATALOG, null, true); + final Path backupPath = backupPathFuture.join().path(); assertTrue(backupPath.toFile().exists()); - final ProgressiveCompletableFuture future = evita.restoreCatalog( + final CompletableFuture future = evita.restoreCatalog( TEST_CATALOG + "_restored", Files.size(backupPath), new BufferedInputStream(new FileInputStream(backupPath.toFile())) @@ -1974,6 +1975,7 @@ private EvitaConfiguration getEvitaConfiguration(int inactivityTimeoutInSeconds) .storage( StorageOptions.builder() .storageDirectory(getEvitaTestDirectory()) + .exportDirectory(getEvitaTestDirectory()) .timeTravelEnabled(false) .build() ) diff --git a/evita_functional_tests/src/test/java/io/evitadb/api/EvitaTransactionalFunctionalTest.java b/evita_functional_tests/src/test/java/io/evitadb/api/EvitaTransactionalFunctionalTest.java index 2739d1eee..4989e47fa 100644 --- a/evita_functional_tests/src/test/java/io/evitadb/api/EvitaTransactionalFunctionalTest.java +++ b/evita_functional_tests/src/test/java/io/evitadb/api/EvitaTransactionalFunctionalTest.java @@ -34,6 +34,7 @@ import io.evitadb.api.configuration.ThreadPoolOptions; import io.evitadb.api.configuration.TransactionOptions; import io.evitadb.api.exception.RollbackException; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.query.QueryConstraints; import io.evitadb.api.requestResponse.data.EntityContract; import io.evitadb.api.requestResponse.data.EntityEditor.EntityBuilder; @@ -50,7 +51,6 @@ import io.evitadb.api.requestResponse.system.CatalogVersionDescriptor.TransactionChanges; import io.evitadb.api.requestResponse.system.TimeFlow; import io.evitadb.api.requestResponse.transaction.TransactionMutation; -import io.evitadb.api.task.ProgressiveCompletableFuture; import io.evitadb.core.Catalog; import io.evitadb.core.Evita; import io.evitadb.core.EvitaSession; @@ -1184,14 +1184,14 @@ void shouldBackupAndRestoreCatalogDuringHeavyParallelIndexing(EvitaContract orig .build() ); - final AtomicReference> lastBackupProcess = new AtomicReference<>(); + final AtomicReference> lastBackupProcess = new AtomicReference<>(); final Set insertedPrimaryKeysAndAssociatedTxs = automaticallyGenerateEntitiesInParallel( evita, productSchema, theEvita -> { lastBackupProcess.set(theEvita.backupCatalog(TEST_CATALOG, null, false)); } ); - final Path backupFilePath = lastBackupProcess.get().get(); + final Path backupFilePath = lastBackupProcess.get().get().path(); assertTrue(backupFilePath.toFile().exists(), "Backup file does not exist!"); final String restoredCatalogName = TEST_CATALOG + "_restored"; @@ -1274,14 +1274,14 @@ void shouldBackupAndRestoreCatalogDuringHeavyParallelIndexingIncludingWal(EvitaC .build() ); - final AtomicReference> lastBackupProcess = new AtomicReference<>(); + final AtomicReference> lastBackupProcess = new AtomicReference<>(); final Set insertedPrimaryKeysAndAssociatedTxs = automaticallyGenerateEntitiesInParallel( evita, productSchema, theEvita -> { lastBackupProcess.set(theEvita.backupCatalog(TEST_CATALOG, null, true)); } ); - final Path backupFilePath = lastBackupProcess.get().get(); + final Path backupFilePath = lastBackupProcess.get().get().path(); assertTrue(backupFilePath.toFile().exists(), "Backup file does not exist!"); final String restoredCatalogName = TEST_CATALOG + "_restored"; @@ -1501,7 +1501,7 @@ record -> { log.info("Bootstrap record: " + record); // create backup from each point in time final Path backupPath = restartedEvita.backupCatalog(TEST_CATALOG, record.timestamp(), false) - .get(2, TimeUnit.MINUTES); + .get(2, TimeUnit.MINUTES).path(); // restore it to unique new catalog final String restoredCatalogName = TEST_CATALOG + "_restored_" + record.catalogVersion(); try (final InputStream inputStream = Files.newInputStream(backupPath)) { diff --git a/evita_functional_tests/src/test/java/io/evitadb/core/async/BackgroundCallableTaskTest.java b/evita_functional_tests/src/test/java/io/evitadb/core/async/ClientCallableTaskTest.java similarity index 52% rename from evita_functional_tests/src/test/java/io/evitadb/core/async/BackgroundCallableTaskTest.java rename to evita_functional_tests/src/test/java/io/evitadb/core/async/ClientCallableTaskTest.java index d313dfa99..bc32fab24 100644 --- a/evita_functional_tests/src/test/java/io/evitadb/core/async/BackgroundCallableTaskTest.java +++ b/evita_functional_tests/src/test/java/io/evitadb/core/async/ClientCallableTaskTest.java @@ -23,34 +23,30 @@ package io.evitadb.core.async; -import io.evitadb.api.task.ProgressiveCompletableFuture; import io.evitadb.test.TestConstants; import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.ForkJoinPool; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; /** - * This test verifies behavior of the {@link BackgroundCallableTask} class. + * This test verifies behavior of the {@link ClientCallableTask} class. * * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 */ -class BackgroundCallableTaskTest implements TestConstants { +class ClientCallableTaskTest implements TestConstants { @Test void shouldCombineBackgroundTasksUsingFutures() throws ExecutionException, InterruptedException { - final BackgroundCallableTask task1 = new BackgroundCallableTask<>("task1", task -> 1); - final BackgroundCallableTask task2 = new BackgroundCallableTask<>("task2", task -> 2); - final CompletableFuture result = task1.getFuture().thenCombine(task2.getFuture(), Integer::sum); + final ClientCallableTask task1 = new ClientCallableTask<>("task1", null, task -> 1); + final ClientCallableTask task2 = new ClientCallableTask<>("task2", null, task -> 2); + final CompletableFuture result = task1.getFutureResult().thenCombine(task2.getFutureResult(), Integer::sum); assertEquals(1, task1.execute()); assertEquals(2, task2.execute()); @@ -59,9 +55,9 @@ void shouldCombineBackgroundTasksUsingFutures() throws ExecutionException, Inter @Test void shouldCombineBackgroundTasksUsingFuturesAndExecutor() throws ExecutionException, InterruptedException { - final BackgroundCallableTask task1 = new BackgroundCallableTask<>("task1", task -> 1); - final BackgroundCallableTask task2 = new BackgroundCallableTask<>("task2", task -> 2); - final CompletableFuture result = task1.getFuture().thenCombine(task2.getFuture(), Integer::sum); + final ClientCallableTask task1 = new ClientCallableTask<>("task1", null, task -> 1); + final ClientCallableTask task2 = new ClientCallableTask<>("task2", null, task -> 2); + final CompletableFuture result = task1.getFutureResult().thenCombine(task2.getFutureResult(), Integer::sum); ForkJoinPool.commonPool().invokeAll(Arrays.asList(task1, task2)); @@ -70,8 +66,8 @@ void shouldCombineBackgroundTasksUsingFuturesAndExecutor() throws ExecutionExcep @Test void shouldPropagateInformationAboutProgress() throws ExecutionException, InterruptedException { - final BackgroundCallableTask task = new BackgroundCallableTask<>( - "task", + final ClientCallableTask task = new ClientCallableTask<>( + "task", null, theTask -> sleepingUpdateTask(theTask, 100, 2) ); @@ -86,7 +82,7 @@ void shouldPropagateInformationAboutProgress() throws ExecutionException, Interr final ArrayList progress = new ArrayList<>(); do { - final int theProgress = task.getProgress(); + final int theProgress = task.getStatus().progress(); if (progress.isEmpty() || progress.get(progress.size() - 1) < theProgress) { progress.add(theProgress); } @@ -96,44 +92,7 @@ void shouldPropagateInformationAboutProgress() throws ExecutionException, Interr assertFalse(progress.isEmpty()); } - @Test - void shouldCorrectlyCalculateCumulatedProgress() throws ExecutionException, InterruptedException { - final BackgroundCallableTask task1 = new BackgroundCallableTask<>( - "task1", - theTask -> sleepingUpdateTask(theTask, 2, 100) - ); - - final BackgroundCallableTask task2 = new BackgroundCallableTask<>( - "task2", - theTask -> sleepingUpdateTask(theTask, 2, 100) - ); - - final ProgressiveCompletableFuture finalFuture = task1.getFuture().andThen(result -> task2.getFuture()); - final ForkJoinPool forkJoinPool = new ForkJoinPool(1); - forkJoinPool.submit(task1); - forkJoinPool.submit(task2); - - final ArrayList progress = new ArrayList<>(); - do { - final int theProgress = finalFuture.getProgress(); - if (theProgress > -1 && (progress.isEmpty() || progress.get(progress.size() - 1) < theProgress)) { - progress.add(theProgress); - } - } while (!finalFuture.isDone()); - - assertEquals(1, finalFuture.get()); - assertEquals(100, finalFuture.getProgress()); - assertFalse(progress.isEmpty()); - final Set allowedTicks = new HashSet<>(5); - for (int i = 0; i <= 4; i++) { - allowedTicks.add(i * 25); - } - for (Integer progressTick : progress) { - assertTrue(allowedTicks.contains(progressTick), "Progress should be divisible by 4, but is " + progressTick); - } - } - - private int sleepingUpdateTask(BackgroundCallableTask theTask, int ticks, int waitMillis) { + private int sleepingUpdateTask(ClientCallableTask theTask, int ticks, int waitMillis) { try { for (int i = 0; i < ticks; i++) { theTask.updateProgress(i * (100 / ticks)); diff --git a/evita_functional_tests/src/test/java/io/evitadb/core/async/BackgroundRunnableTaskTest.java b/evita_functional_tests/src/test/java/io/evitadb/core/async/ClientRunnableTaskTest.java similarity index 52% rename from evita_functional_tests/src/test/java/io/evitadb/core/async/BackgroundRunnableTaskTest.java rename to evita_functional_tests/src/test/java/io/evitadb/core/async/ClientRunnableTaskTest.java index 93bc4614d..157719692 100644 --- a/evita_functional_tests/src/test/java/io/evitadb/core/async/BackgroundRunnableTaskTest.java +++ b/evita_functional_tests/src/test/java/io/evitadb/core/async/ClientRunnableTaskTest.java @@ -23,13 +23,10 @@ package io.evitadb.core.async; -import io.evitadb.api.task.ProgressiveCompletableFuture; import io.evitadb.test.TestConstants; import org.junit.jupiter.api.Test; import java.util.ArrayList; -import java.util.HashSet; -import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.ForkJoinPool; @@ -39,31 +36,31 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** - * This test verifies behavior of the {@link BackgroundRunnableTask} class. + * This test verifies behavior of the {@link ClientRunnableTask} class. * * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 */ -class BackgroundRunnableTaskTest implements TestConstants { +class ClientRunnableTaskTest implements TestConstants { @Test void shouldCombineBackgroundTasksUsingFutures() throws ExecutionException, InterruptedException { - final BackgroundRunnableTask task1 = new BackgroundRunnableTask("task1", task -> {}); - final BackgroundRunnableTask task2 = new BackgroundRunnableTask("task2", task -> {}); - final CompletableFuture result = task1.getFuture().thenCombine(task2.getFuture(), (a, b) -> 3); + final ClientRunnableTask task1 = new ClientRunnableTask<>("task1", null, task -> {}); + final ClientRunnableTask task2 = new ClientRunnableTask<>("task2", null, task -> {}); + final CompletableFuture result = task1.getFutureResult().thenCombine(task2.getFutureResult(), (a, b) -> 3); task1.run(); task2.run(); - assertTrue(task1.getFuture().isDone()); - assertTrue(task2.getFuture().isDone()); + assertTrue(task1.getFutureResult().isDone()); + assertTrue(task2.getFutureResult().isDone()); assertEquals(3, result.get()); } @Test void shouldCombineBackgroundTasksUsingFuturesAndExecutor() throws ExecutionException, InterruptedException { - final BackgroundRunnableTask task1 = new BackgroundRunnableTask("task1", task -> {}); - final BackgroundRunnableTask task2 = new BackgroundRunnableTask("task2", task -> {}); - final CompletableFuture result = task1.getFuture().thenCombine(task2.getFuture(), (a, b) -> 3); + final ClientRunnableTask task1 = new ClientRunnableTask<>("task1", null, task -> {}); + final ClientRunnableTask task2 = new ClientRunnableTask<>("task2", null, task -> {}); + final CompletableFuture result = task1.getFutureResult().thenCombine(task2.getFutureResult(), (a, b) -> 3); final ForkJoinPool forkJoinPool = ForkJoinPool.commonPool(); forkJoinPool.execute(task1); @@ -74,8 +71,8 @@ void shouldCombineBackgroundTasksUsingFuturesAndExecutor() throws ExecutionExcep @Test void shouldPropagateInformationAboutProgress() { - final BackgroundRunnableTask task = new BackgroundRunnableTask( - "task", + final ClientRunnableTask task = new ClientRunnableTask<>( + "task", null, theTask -> sleepingUpdateTask(theTask, 100, 2) ); @@ -84,7 +81,7 @@ void shouldPropagateInformationAboutProgress() { final ArrayList progress = new ArrayList<>(); do { - final int theProgress = task.getProgress(); + final int theProgress = task.getStatus().progress(); if (progress.isEmpty() || progress.get(progress.size() - 1) < theProgress) { progress.add(theProgress); } @@ -94,44 +91,7 @@ void shouldPropagateInformationAboutProgress() { assertFalse(progress.isEmpty()); } - @Test - void shouldCorrectlyCalculateCumulatedProgress() { - final BackgroundRunnableTask task1 = new BackgroundRunnableTask( - "task1", - theTask -> sleepingUpdateTask(theTask, 2, 100) - ); - - final BackgroundRunnableTask task2 = new BackgroundRunnableTask( - "task2", - theTask -> sleepingUpdateTask(theTask, 2, 100) - ); - - final ProgressiveCompletableFuture finalFuture = task1.getFuture().andThen(result -> task2.getFuture()); - final ForkJoinPool forkJoinPool = new ForkJoinPool(1); - forkJoinPool.submit(task1); - forkJoinPool.submit(task2); - - final ArrayList progress = new ArrayList<>(); - do { - final int theProgress = finalFuture.getProgress(); - if (theProgress > -1 && (progress.isEmpty() || progress.get(progress.size() - 1) < theProgress)) { - progress.add(theProgress); - } - } while (!finalFuture.isDone()); - - assertTrue(finalFuture.isDone()); - assertEquals(100, finalFuture.getProgress()); - assertFalse(progress.isEmpty()); - final Set allowedTicks = new HashSet<>(5); - for (int i = 0; i <= 4; i++) { - allowedTicks.add(i * 25); - } - for (Integer progressTick : progress) { - assertTrue(allowedTicks.contains(progressTick), "Progress should be divisible by 4, but is " + progressTick); - } - } - - private int sleepingUpdateTask(BackgroundRunnableTask theTask, int ticks, int waitMillis) { + private int sleepingUpdateTask(ClientRunnableTask theTask, int ticks, int waitMillis) { try { for (int i = 0; i < ticks; i++) { theTask.updateProgress(i * (100 / ticks)); diff --git a/evita_functional_tests/src/test/java/io/evitadb/core/async/SchedulerTest.java b/evita_functional_tests/src/test/java/io/evitadb/core/async/SchedulerTest.java new file mode 100644 index 000000000..233b806cf --- /dev/null +++ b/evita_functional_tests/src/test/java/io/evitadb/core/async/SchedulerTest.java @@ -0,0 +1,144 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.evitadb.core.async; + +import io.evitadb.api.configuration.ThreadPoolOptions; +import io.evitadb.api.task.Task; +import io.evitadb.api.task.TaskStatus; +import io.evitadb.api.task.TaskStatus.State; +import io.evitadb.dataType.PaginatedList; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; + +import java.util.Optional; +import java.util.concurrent.CancellationException; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +/** + * This test verifies the correct functionality of the {@link Scheduler} class. + * + * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 + */ +class SchedulerTest { + private final Scheduler scheduler = new Scheduler( + ThreadPoolOptions + .serviceThreadPoolBuilder() + .build() + ); + + @AfterEach + void tearDown() { + scheduler.shutdownNow(); + } + + @Test + void shouldRegisterTask() { + assertEquals(0, scheduler.getJobStatuses(1, 20).getTotalRecordCount()); + + scheduler.submit( + (Task) new ClientRunnableTask<>("Test task", null, () -> { + }) + ); + + assertEquals(1, scheduler.getJobStatuses(1, 20).getTotalRecordCount()); + } + + @Test + void shouldGetStatusOfTheTask() throws ExecutionException, InterruptedException { + assertEquals(0, scheduler.getJobStatuses(1, 20).getTotalRecordCount()); + + final CompletableFuture result = scheduler.submit( + (Task) new ClientCallableTask<>("Test task", null, () -> 5) + ); + + final PaginatedList> jobStatuses = scheduler.getJobStatuses(1, 20); + assertEquals(1, jobStatuses.getTotalRecordCount()); + + assertEquals(5, result.get()); + final Optional> jobStatus = scheduler.getJobStatus(jobStatuses.getData().get(0).taskId()); + + assertTrue(jobStatus.isPresent()); + assertEquals("Test task", jobStatus.get().taskName()); + assertEquals(5, jobStatus.get().result()); + assertEquals(State.FINISHED, jobStatus.get().state()); + } + + @Test + void shouldCancelTheTask() throws InterruptedException { + assertEquals(0, scheduler.getJobStatuses(1, 20).getTotalRecordCount()); + + final AtomicBoolean interrupted = new AtomicBoolean(false); + final CompletableFuture result = scheduler.submit( + (Task) new ClientCallableTask("Test task", null, theTask -> { + for (int i = 0; i < 1_000_000_000; i++) { + if (theTask.getFutureResult().isCancelled()) { + interrupted.set(true); + return -1; + } + Thread.onSpinWait(); + } + return 5; + }) + ); + + final PaginatedList> jobStatuses = scheduler.getJobStatuses(1, 20); + assertEquals(1, jobStatuses.getTotalRecordCount()); + + final Optional> jobStatus = scheduler.getJobStatus(jobStatuses.getData().get(0).taskId()); + + assertTrue(jobStatus.isPresent()); + assertEquals("Test task", jobStatus.get().taskName()); + + scheduler.cancelJob(jobStatus.get().taskId()); + + try { + result.get(); + fail("Exception expected"); + } catch (CancellationException | ExecutionException e) { + // expected + } + + // wait for the task to be interrupted + final long start = System.currentTimeMillis(); + do { + Thread.onSpinWait(); + } while (!interrupted.get() && System.currentTimeMillis() - start < 100_000); + + final Optional> jobStatusAgain = scheduler.getJobStatus(jobStatuses.getData().get(0).taskId()); + final Optional> taskStatusRef = jobStatusAgain; + taskStatusRef.ifPresent(taskStatus -> { + assertNull(taskStatus.result()); + assertEquals(State.FAILED, taskStatus.state()); + }); + assertTrue(interrupted.get()); + } + +} diff --git a/evita_functional_tests/src/test/java/io/evitadb/core/file/ExportFileServiceTest.java b/evita_functional_tests/src/test/java/io/evitadb/core/file/ExportFileServiceTest.java new file mode 100644 index 000000000..504c5be61 --- /dev/null +++ b/evita_functional_tests/src/test/java/io/evitadb/core/file/ExportFileServiceTest.java @@ -0,0 +1,199 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.evitadb.core.file; + +import com.google.common.collect.Lists; +import io.evitadb.api.configuration.StorageOptions; +import io.evitadb.api.file.FileForFetch; +import io.evitadb.core.file.ExportFileService.ExportFileHandle; +import io.evitadb.dataType.PaginatedList; +import io.evitadb.test.EvitaTestSupport; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * This test verifies behavior of {@link ExportFileService}. + * + * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 + */ +class ExportFileServiceTest implements EvitaTestSupport { + private static final String SUBDIR_NAME = "exportFileServiceTest"; + private final StorageOptions storageOptions = StorageOptions.builder( + StorageOptions.temporary() + ) + .exportDirectory(getPathInTargetDirectory(SUBDIR_NAME)) + .build(); + private final ExportFileService exportFileService = new ExportFileService(storageOptions); + + @BeforeEach + void setUp() throws IOException { + cleanTestSubDirectory(SUBDIR_NAME); + } + + @Test + void shouldStoreNewFile() throws IOException { + writeFile("testFile.txt", "A,B"); + + // verify the file was written + final PaginatedList files = exportFileService.listFilesToFetch(1, Integer.MAX_VALUE, null); + assertEquals(1, files.getTotalRecordCount()); + + final FileForFetch fileForFetch = files.getData().get(0); + assertEquals("testFile.txt", fileForFetch.name()); + assertEquals("With description ...", fileForFetch.description()); + assertEquals("text/plain", fileForFetch.contentType()); + assertEquals(15, fileForFetch.totalSizeInBytes()); + assertArrayEquals(new String[] {"A", "B"}, fileForFetch.origin()); + + // verify the file content + assertEquals("testFileContent", Files.readString(fileForFetch.path(), StandardCharsets.UTF_8)); + } + + @Test + void shouldListAndFilterFiles() throws IOException { + final Random rnd = new Random(); + final List tags = new ArrayList<>(32); + for (int i = 0; i < 28; i++) { + final String[] theTags = Stream.generate(() -> Character.toString((char) ('A' + rnd.nextInt(16)))) + .limit(5) + .toArray(String[]::new); + tags.add(theTags); + writeFile( + "testFile" + i + ".txt", + String.join(",", theTags) + ); + } + + assertArrayEquals( + new String[] { + "testFile27.txt", "testFile26.txt", "testFile25.txt", "testFile24.txt", "testFile23.txt" + }, + this.exportFileService.listFilesToFetch(1, 5, null) + .getData().stream().map(FileForFetch::name).toArray(String[]::new) + ); + + assertArrayEquals( + new String[] { + "testFile2.txt", "testFile1.txt", "testFile0.txt" + }, + this.exportFileService.listFilesToFetch(6, 5, null) + .getData().stream().map(FileForFetch::name).toArray(String[]::new) + ); + + final List filteredNames = new ArrayList<>(32); + for (int i = 0; i < tags.size(); i++) { + final String[] tag = tags.get(i); + if (Arrays.asList(tag).contains("A")) { + filteredNames.add("testFile" + i + ".txt"); + } + } + + assertArrayEquals( + Lists.reverse(filteredNames).stream().limit(10).toArray(String[]::new), + this.exportFileService.listFilesToFetch(1, 10, "A") + .getData().stream().map(FileForFetch::name).toArray(String[]::new) + ); + } + + @Test + void shouldDeleteFile() throws IOException { + for (int i = 0; i < 5; i++) { + writeFile("testFile" + i + ".txt", null); + } + + assertEquals( + 10, numberOfFiles(storageOptions.exportDirectory()) + ); + + final PaginatedList filesBeforeDelete = this.exportFileService.listFilesToFetch(1, 20, null); + assertEquals(5, filesBeforeDelete.getTotalRecordCount()); + + this.exportFileService.deleteFile(filesBeforeDelete.getData().get(0).fileId()); + this.exportFileService.deleteFile(filesBeforeDelete.getData().get(3).fileId()); + + assertEquals(3, this.exportFileService.listFilesToFetch(1, 20, null).getTotalRecordCount()); + + assertEquals( + 6, numberOfFiles(storageOptions.exportDirectory()) + ); + } + + @Test + void shouldFetchFile() throws IOException { + final FileForFetch storedFile = writeFile("testFile.txt", "A,B"); + + final ByteArrayOutputStream bos = new ByteArrayOutputStream(); + this.exportFileService.fetchFile(storedFile.fileId(), bos); + + final String content = bos.toString(StandardCharsets.UTF_8); + assertEquals("testFileContent", content); + } + + @Nullable + private FileForFetch writeFile(@Nonnull String fileName, @Nonnull String withOrigin) throws IOException { + final ExportFileHandle exportFileHandle = exportFileService.storeFile( + fileName, + "With description ...", + "text/plain", + withOrigin + ); + try (final OutputStream outputStream = exportFileHandle.outputStream()) { + outputStream.write("testFileContent".getBytes()); + } + return exportFileHandle.fileForFetchFuture().getNow(null); + } + + /** + * Method returns number files in target directory. + * + * @param path path to the catalog directory + * @return number of files + * @throws IOException when the directory cannot be read + */ + private static int numberOfFiles(@Nonnull Path path) throws IOException { + try (final Stream list = Files.list(path)) { + return list + .mapToInt(it -> 1) + .sum(); + } + } + +} diff --git a/evita_functional_tests/src/test/java/io/evitadb/server/EvitaServerTest.java b/evita_functional_tests/src/test/java/io/evitadb/server/EvitaServerTest.java index 85b5f00a7..afb309ac6 100644 --- a/evita_functional_tests/src/test/java/io/evitadb/server/EvitaServerTest.java +++ b/evita_functional_tests/src/test/java/io/evitadb/server/EvitaServerTest.java @@ -293,7 +293,7 @@ void shouldSignalizeReadinessAndHealthinessCorrectly() { assertTrue(status.isPresent()); String output = status.get(); output = Pattern.compile("(\"serverName\": \"evitaDB-)(.+?)\"").matcher(output).replaceAll("$1RANDOM\""); - output = Pattern.compile("(\"version\": \")(\\d{4}\\.\\d{1,2}(-SNAPSHOT)?)\"").matcher(output).replaceAll("$1VARIABLE\""); + output = Pattern.compile("(\"version\": \")(\\d{4}\\.\\d{1,2}(-SNAPSHOT)?|\\?)\"").matcher(output).replaceAll("$1VARIABLE\""); output = Pattern.compile("(\"startedAt\": \")(.+?)\"").matcher(output).replaceAll("$1VARIABLE\""); output = Pattern.compile("(\"uptime\": )(\\d+?)").matcher(output).replaceAll("$1VARIABLE"); output = Pattern.compile("(\"uptimeForHuman\": \")(.+?)\"").matcher(output).replaceAll("$1VARIABLE\""); diff --git a/evita_functional_tests/src/test/java/io/evitadb/store/catalog/DefaultCatalogPersistenceServiceTest.java b/evita_functional_tests/src/test/java/io/evitadb/store/catalog/DefaultCatalogPersistenceServiceTest.java index 453621add..db5e7e0f7 100644 --- a/evita_functional_tests/src/test/java/io/evitadb/store/catalog/DefaultCatalogPersistenceServiceTest.java +++ b/evita_functional_tests/src/test/java/io/evitadb/store/catalog/DefaultCatalogPersistenceServiceTest.java @@ -54,6 +54,7 @@ import io.evitadb.core.async.Scheduler; import io.evitadb.core.buffer.WarmUpDataStoreMemoryBuffer; import io.evitadb.core.cache.NoCacheSupervisor; +import io.evitadb.core.file.ExportFileService; import io.evitadb.core.metric.event.storage.FileType; import io.evitadb.core.sequence.SequenceService; import io.evitadb.dataType.PaginatedList; @@ -265,7 +266,8 @@ void shouldSerializeAndDeserializeCatalogHeader() { SEALED_CATALOG_SCHEMA.getName(), getStorageOptions(), getTransactionOptions(), - Mockito.mock(Scheduler.class) + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) ); ioService.getStoragePartPersistenceService(0L) @@ -325,7 +327,8 @@ void shouldDetectInvalidCatalogContents() { RENAMED_CATALOG, getStorageOptions(), getTransactionOptions(), - Mockito.mock(Scheduler.class) + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) )) { // do nothing } @@ -343,7 +346,8 @@ void shouldDetectInvalidCatalogContentsAndAutomaticallyAdaptThem() throws IOExce RENAMED_CATALOG, getStorageOptions(), getTransactionOptions(), - Mockito.mock(Scheduler.class) + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) )) { final long lastCatalogVersion = persistenceService.getLastCatalogVersion(); final CatalogHeader catalogHeader = persistenceService.getCatalogHeader(lastCatalogVersion); @@ -364,12 +368,15 @@ void shouldSignalizeInvalidEntityNames() { assertThrows( InvalidClassifierFormatException.class, () -> { - try (var cps = new DefaultCatalogPersistenceService( - SEALED_CATALOG_SCHEMA.getName(), - getStorageOptions(), - getTransactionOptions(), - Mockito.mock(Scheduler.class) - )) { + try ( + var cps = new DefaultCatalogPersistenceService( + SEALED_CATALOG_SCHEMA.getName(), + getStorageOptions(), + getTransactionOptions(), + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) + ) + ) { cps.verifyEntityType( Collections.emptyList(), "→" @@ -384,12 +391,15 @@ void shouldSignalizeConflictingEntityNames() { assertThrows( EntityTypeAlreadyPresentInCatalogSchemaException.class, () -> { - try (var cps = new DefaultCatalogPersistenceService( - SEALED_CATALOG_SCHEMA.getName(), - getStorageOptions(), - getTransactionOptions(), - Mockito.mock(Scheduler.class) - )) { + try ( + var cps = new DefaultCatalogPersistenceService( + SEALED_CATALOG_SCHEMA.getName(), + getStorageOptions(), + getTransactionOptions(), + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) + ) + ) { final EntityCollection mockCollection = mock(EntityCollection.class); when(mockCollection.getEntityType()).thenReturn("a"); when(mockCollection.getSchema()).thenReturn(new EntitySchemaDecorator(() -> SEALED_CATALOG_SCHEMA, EntitySchema._internalBuild("a"))); @@ -405,24 +415,30 @@ void shouldSignalizeConflictingEntityNames() { @Test void shouldRefuseDuplicateCatalogName() { //noinspection EmptyTryBlock - try (var ignored1 = new DefaultCatalogPersistenceService( - SEALED_CATALOG_SCHEMA.getName(), - getStorageOptions(), - getTransactionOptions(), - Mockito.mock(Scheduler.class) - )) { + try ( + var ignored1 = new DefaultCatalogPersistenceService( + SEALED_CATALOG_SCHEMA.getName(), + getStorageOptions(), + getTransactionOptions(), + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) + ) + ) { } assertThrows( DirectoryNotEmptyException.class, () -> { //noinspection EmptyTryBlock - try (var ignored2 = new DefaultCatalogPersistenceService( - CATALOG_SCHEMA.getName(), - getStorageOptions(), - getTransactionOptions(), - Mockito.mock(Scheduler.class) - )) { + try ( + var ignored2 = new DefaultCatalogPersistenceService( + CATALOG_SCHEMA.getName(), + getStorageOptions(), + getTransactionOptions(), + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) + ) + ) { } } ); @@ -433,13 +449,16 @@ void shouldDeleteCatalog() throws IOException { shouldSerializeAndDeserializeCatalogHeader(); final Path catalogDirectory = getStorageOptions().storageDirectoryOrDefault().resolve(TEST_CATALOG); - try (var cps = new DefaultCatalogPersistenceService( - Mockito.mock(CatalogContract.class), - TEST_CATALOG, - getStorageOptions(), - getTransactionOptions(), - Mockito.mock(Scheduler.class) - )) { + try ( + var cps = new DefaultCatalogPersistenceService( + Mockito.mock(CatalogContract.class), + TEST_CATALOG, + getStorageOptions(), + getTransactionOptions(), + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) + ) + ) { assertTrue(catalogDirectory.toFile().exists()); assertTrue(countFiles(catalogDirectory) > 0); cps.delete(); @@ -449,12 +468,15 @@ void shouldDeleteCatalog() throws IOException { @Test void shouldReturnDefaultHeaderOnEmptyDirectory() { - try (var cps = new DefaultCatalogPersistenceService( - SEALED_CATALOG_SCHEMA.getName(), - getStorageOptions(), - getTransactionOptions(), - Mockito.mock(Scheduler.class) - )) { + try ( + var cps = new DefaultCatalogPersistenceService( + SEALED_CATALOG_SCHEMA.getName(), + getStorageOptions(), + getTransactionOptions(), + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) + ) + ) { final CatalogHeader header = cps.getCatalogHeader(0L); assertNotNull(header); assertEquals(CatalogState.WARMING_UP, header.catalogState()); @@ -472,12 +494,15 @@ void shouldAppendWalFromByteBufferAndReadItAgain() { final String catalogName = SEALED_CATALOG_SCHEMA.getName(); // first switch to the transactional mode - try (var cps = new DefaultCatalogPersistenceService( - catalogName, - getStorageOptions(), - getTransactionOptions(), - Mockito.mock(Scheduler.class) - )) { + try ( + var cps = new DefaultCatalogPersistenceService( + catalogName, + getStorageOptions(), + getTransactionOptions(), + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) + ) + ) { cps.getStoragePartPersistenceService(0L) .putStoragePart(0L, new CatalogSchemaStoragePart(CATALOG_SCHEMA)); cps.storeHeader( @@ -496,13 +521,16 @@ void shouldAppendWalFromByteBufferAndReadItAgain() { ); // and then write to the WAL - try (var cps = new DefaultCatalogPersistenceService( - Mockito.mock(CatalogContract.class), - catalogName, - getStorageOptions(), - getTransactionOptions(), - Mockito.mock(Scheduler.class) - )) { + try ( + var cps = new DefaultCatalogPersistenceService( + Mockito.mock(CatalogContract.class), + catalogName, + getStorageOptions(), + getTransactionOptions(), + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) + ) + ) { cps.appendWalAndDiscard( 2L, writtenTransactionMutation, @@ -544,7 +572,8 @@ void shouldTraverseBootstrapRecordsFromOldestToNewest() { catalogName, storageOptions, getTransactionOptions(), - Mockito.mock(Scheduler.class) + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) ); for (int i = 0; i < 12; i++) { @@ -606,7 +635,8 @@ void shouldTraverseBootstrapRecordsFromNewestToOldest() { catalogName, getStorageOptions(), getTransactionOptions(), - Mockito.mock(Scheduler.class) + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) ); for (int i = 0; i < 12; i++) { @@ -638,7 +668,8 @@ void shouldTrimBootstrapRecords() { catalogName, getStorageOptions(), getTransactionOptions(), - Mockito.mock(Scheduler.class) + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) ); final OffsetDateTime timestamp = OffsetDateTime.now(); @@ -669,7 +700,8 @@ private Path prepareInvalidCatalogContents() { SEALED_CATALOG_SCHEMA.getName(), getStorageOptions(), getTransactionOptions(), - Mockito.mock(Scheduler.class) + Mockito.mock(Scheduler.class), + Mockito.mock(ExportFileService.class) ); ioService.getStoragePartPersistenceService(0L) @@ -725,10 +757,12 @@ private Path prepareInvalidCatalogContents() { @Nonnull private StorageOptions getStorageOptions() { return new StorageOptions( + getTestDirectory().resolve(DIR_DEFAULT_CATALOG_PERSISTENCE_SERVICE_TEST), getTestDirectory().resolve(DIR_DEFAULT_CATALOG_PERSISTENCE_SERVICE_TEST), 60, 60, StorageOptions.DEFAULT_OUTPUT_BUFFER_SIZE, 1, - true, 1.0, 0L, false + true, 1.0, 0L, false, + Long.MAX_VALUE, Long.MAX_VALUE ); } diff --git a/evita_functional_tests/src/test/java/io/evitadb/store/offsetIndex/OffsetIndexSerializationServiceTest.java b/evita_functional_tests/src/test/java/io/evitadb/store/offsetIndex/OffsetIndexSerializationServiceTest.java index ed2d9bafe..19a836df4 100644 --- a/evita_functional_tests/src/test/java/io/evitadb/store/offsetIndex/OffsetIndexSerializationServiceTest.java +++ b/evita_functional_tests/src/test/java/io/evitadb/store/offsetIndex/OffsetIndexSerializationServiceTest.java @@ -40,8 +40,8 @@ class OffsetIndexSerializationServiceTest { @Test void shouldComputeExpectedRecordCountProperly() { final StorageOptions testOptions = new StorageOptions( - Path.of(""), 1, 0, 55, 1, - false, 1.0, 0L, false + Path.of(""), Path.of(""), 1, 0, 55, 1, + false, 1.0, 0L, false, Long.MAX_VALUE, Long.MAX_VALUE ); assertEquals(new OffsetIndexSerializationService.ExpectedCounts(0, 1), OffsetIndexSerializationService.computeExpectedRecordCount(testOptions, 0)); assertEquals(new OffsetIndexSerializationService.ExpectedCounts(1, 1), OffsetIndexSerializationService.computeExpectedRecordCount(testOptions, 1)); diff --git a/evita_functional_tests/src/test/java/io/evitadb/store/offsetIndex/OffsetIndexTest.java b/evita_functional_tests/src/test/java/io/evitadb/store/offsetIndex/OffsetIndexTest.java index 6a824ae65..09d852f3f 100644 --- a/evita_functional_tests/src/test/java/io/evitadb/store/offsetIndex/OffsetIndexTest.java +++ b/evita_functional_tests/src/test/java/io/evitadb/store/offsetIndex/OffsetIndexTest.java @@ -231,7 +231,7 @@ void shouldCopySnapshotOfTheBigFileOffsetIndexAndReconstruct() { final long finalCatalogVersion = nextCatalogVersion + 1; final OffsetIndexDescriptor snapshotBootstrapDescriptor; try (final FileOutputStream fos = new FileOutputStream(snapshotPath.toFile())) { - snapshotBootstrapDescriptor = purgedSourceOffsetIndex.copySnapshotTo(fos, finalCatalogVersion); + snapshotBootstrapDescriptor = purgedSourceOffsetIndex.copySnapshotTo(fos, null, finalCatalogVersion); } catch (IOException e) { throw new AssertionFailedError("IO exception!", e); } diff --git a/evita_query/src/main/java/io/evitadb/api/query/QueryConstraints.java b/evita_query/src/main/java/io/evitadb/api/query/QueryConstraints.java index faad7b31b..5903165bf 100644 --- a/evita_query/src/main/java/io/evitadb/api/query/QueryConstraints.java +++ b/evita_query/src/main/java/io/evitadb/api/query/QueryConstraints.java @@ -15345,4 +15345,4 @@ static EntityContentRequire[] entityFetchAllContentAnd(@Nullable EntityContentRe } } -} \ No newline at end of file +} diff --git a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLBaseListener.java b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLBaseListener.java index e4253b9fb..73e1a3250 100644 --- a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLBaseListener.java +++ b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLBaseListener.java @@ -6,7 +6,7 @@ * | __/\ V /| | || (_| | |_| | |_) | * \___| \_/ |_|\__\__,_|____/|____/ * - * Copyright (c) 2023-2024 + * Copyright (c) 2024 * * Licensed under the Business Source License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -2869,4 +2869,4 @@ public class EvitaQLBaseListener implements EvitaQLListener { *

The default implementation does nothing.

*/ @Override public void visitErrorNode(ErrorNode node) { } -} \ No newline at end of file +} diff --git a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLBaseVisitor.java b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLBaseVisitor.java index 7f7a74c17..0add23482 100644 --- a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLBaseVisitor.java +++ b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLBaseVisitor.java @@ -6,7 +6,7 @@ * | __/\ V /| | || (_| | |_| | |_) | * \___| \_/ |_|\__\__,_|____/|____/ * - * Copyright (c) 2023-2024 + * Copyright (c) 2024 * * Licensed under the Business Source License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -1674,4 +1674,4 @@ public class EvitaQLBaseVisitor extends AbstractParseTreeVisitor implement * {@link #visitChildren} on {@code ctx}.

*/ @Override public T visitEnumValueToken(EvitaQLParser.EnumValueTokenContext ctx) { return visitChildren(ctx); } -} \ No newline at end of file +} diff --git a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLLexer.java b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLLexer.java index 2e2122ace..dd21dca67 100644 --- a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLLexer.java +++ b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLLexer.java @@ -6,7 +6,7 @@ * | __/\ V /| | || (_| | |_| | |_) | * \___| \_/ |_|\__\__,_|____/|____/ * - * Copyright (c) 2023-2024 + * Copyright (c) 2024 * * Licensed under the Business Source License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -25,14 +25,16 @@ package io.evitadb.api.query.parser.grammar; -import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.CharStream; -import org.antlr.v4.runtime.Token; -import org.antlr.v4.runtime.TokenStream; -import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.RuntimeMetaData; +import org.antlr.v4.runtime.Vocabulary; +import org.antlr.v4.runtime.VocabularyImpl; +import org.antlr.v4.runtime.atn.ATN; +import org.antlr.v4.runtime.atn.ATNDeserializer; +import org.antlr.v4.runtime.atn.LexerATNSimulator; +import org.antlr.v4.runtime.atn.PredictionContextCache; import org.antlr.v4.runtime.dfa.DFA; -import org.antlr.v4.runtime.misc.*; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class EvitaQLLexer extends Lexer { @@ -864,4 +866,4 @@ public EvitaQLLexer(CharStream input) { _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); } } -} \ No newline at end of file +} diff --git a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLListener.java b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLListener.java index e75e3650f..b9789fa02 100644 --- a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLListener.java +++ b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLListener.java @@ -6,7 +6,7 @@ * | __/\ V /| | || (_| | |_| | |_) | * \___| \_/ |_|\__\__,_|____/|____/ * - * Copyright (c) 2023-2024 + * Copyright (c) 2024 * * Licensed under the Business Source License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -2668,4 +2668,4 @@ public interface EvitaQLListener extends ParseTreeListener { * @param ctx the parse tree */ void exitEnumValueToken(EvitaQLParser.EnumValueTokenContext ctx); -} \ No newline at end of file +} diff --git a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLParser.java b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLParser.java index c0f221d35..501e97e58 100644 --- a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLParser.java +++ b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLParser.java @@ -6,7 +6,7 @@ * | __/\ V /| | || (_| | |_| | |_) | * \___| \_/ |_|\__\__,_|____/|____/ * - * Copyright (c) 2023-2024 + * Copyright (c) 2024 * * Licensed under the Business Source License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -25,14 +25,25 @@ package io.evitadb.api.query.parser.grammar; -import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.NoViableAltException; +import org.antlr.v4.runtime.Parser; +import org.antlr.v4.runtime.ParserRuleContext; +import org.antlr.v4.runtime.RecognitionException; +import org.antlr.v4.runtime.RuntimeMetaData; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.Vocabulary; +import org.antlr.v4.runtime.VocabularyImpl; +import org.antlr.v4.runtime.atn.ATN; +import org.antlr.v4.runtime.atn.ATNDeserializer; +import org.antlr.v4.runtime.atn.ParserATNSimulator; +import org.antlr.v4.runtime.atn.PredictionContextCache; import org.antlr.v4.runtime.dfa.DFA; -import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.misc.*; -import org.antlr.v4.runtime.tree.*; -import java.util.List; -import java.util.Iterator; +import org.antlr.v4.runtime.tree.ParseTreeListener; +import org.antlr.v4.runtime.tree.ParseTreeVisitor; +import org.antlr.v4.runtime.tree.TerminalNode; + import java.util.ArrayList; +import java.util.List; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class EvitaQLParser extends Parser { @@ -12044,4 +12055,4 @@ public final ValueTokenContext valueToken() throws RecognitionException { _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); } } -} \ No newline at end of file +} diff --git a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLVisitor.java b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLVisitor.java index 00894df7b..39e76cfd6 100644 --- a/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLVisitor.java +++ b/evita_query/src/main/java/io/evitadb/api/query/parser/grammar/EvitaQLVisitor.java @@ -6,7 +6,7 @@ * | __/\ V /| | || (_| | |_| | |_) | * \___| \_/ |_|\__\__,_|____/|____/ * - * Copyright (c) 2023-2024 + * Copyright (c) 2024 * * Licensed under the Business Source License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -1587,4 +1587,4 @@ public interface EvitaQLVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitEnumValueToken(EvitaQLParser.EnumValueTokenContext ctx); -} \ No newline at end of file +} diff --git a/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/kryo/ObservableOutput.java b/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/kryo/ObservableOutput.java index c56df4f12..9efaa6e4e 100644 --- a/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/kryo/ObservableOutput.java +++ b/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/kryo/ObservableOutput.java @@ -28,6 +28,7 @@ import io.evitadb.store.exception.StorageException; import io.evitadb.store.model.FileLocation; import io.evitadb.store.offsetIndex.model.StorageRecord; +import io.evitadb.utils.Assert; import io.evitadb.utils.BitUtils; import lombok.Getter; @@ -181,6 +182,7 @@ public void markRecordLengthPosition() { */ public FileLocation markEnd(byte controlByte) { try { + Assert.isPremiseValid(payloadStartPosition != -1, "Payload start position must be initialized!"); this.writingTail = true; final Optional crc32Ref = ofNullable(crc32C); final byte alteredControlByte = crc32Ref.isPresent() ? diff --git a/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/offsetIndex/OffsetIndex.java b/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/offsetIndex/OffsetIndex.java index 9fadb59e9..c78e33516 100644 --- a/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/offsetIndex/OffsetIndex.java +++ b/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/offsetIndex/OffsetIndex.java @@ -82,6 +82,7 @@ import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.IntConsumer; import java.util.function.LongConsumer; import java.util.stream.Collectors; @@ -721,12 +722,14 @@ public void purge(@Nullable Long catalogVersion) { * the caller is responsible for closing the stream. * * @param outputStream target output stream to write the copy to + * @param progressConsumer consumer that will be called with the progress of the copy * @param catalogVersion will be propagated to {@link StorageRecord#transactionId()} * @return result containing the file location and the file descriptor actual when the copy was made */ @Nonnull public OffsetIndexDescriptor copySnapshotTo( @Nonnull OutputStream outputStream, + @Nullable IntConsumer progressConsumer, long catalogVersion, @Nullable StoragePart... updatedStorageParts ) { @@ -769,9 +772,11 @@ public OffsetIndexDescriptor copySnapshotTo( final FileLocationAndWrittenBytes locationAndWrittenBytes = OffsetIndexSerializationService.copySnapshotTo( this, randomAccessFileInputStream, - outputStream, catalogVersion, + outputStream, + catalogVersion, overriddenEntries, - this.volatileValues + this.volatileValues, + progressConsumer ); return new OffsetIndexDescriptor( this.fileOffsetDescriptor.version() + 1, @@ -954,7 +959,7 @@ public void forgetVolatileData() { @Nonnull public OffsetIndexDescriptor compact(@Nonnull Path newFilePath) { try (final FileOutputStream fos = new FileOutputStream(newFilePath.toFile())) { - return copySnapshotTo(fos, this.keyCatalogVersion); + return copySnapshotTo(fos, null, this.keyCatalogVersion); } catch (IOException e) { throw new UnexpectedIOException( "Error occurred while compacting the snapshot to the new file: " + e.getMessage(), diff --git a/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/offsetIndex/OffsetIndexSerializationService.java b/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/offsetIndex/OffsetIndexSerializationService.java index 7c058c05e..b10015df8 100644 --- a/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/offsetIndex/OffsetIndexSerializationService.java +++ b/evita_store/evita_store_key_value/src/main/java/io/evitadb/store/offsetIndex/OffsetIndexSerializationService.java @@ -54,6 +54,7 @@ import java.util.Optional; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; +import java.util.function.IntConsumer; import java.util.zip.CRC32C; import static java.util.Optional.ofNullable; @@ -223,7 +224,8 @@ public static FileLocationAndWrittenBytes copySnapshotTo( @Nonnull OutputStream outputStream, long catalogVersion, @Nonnull Map valuesToOverride, - @Nonnull VolatileValues volatileValues + @Nonnull VolatileValues volatileValues, + @Nullable IntConsumer progressConsumer ) { // we don't close neither input stream nor the output stream // input stream is still used in callee and the output stream is managed by the callee @@ -238,6 +240,7 @@ public static FileLocationAndWrittenBytes copySnapshotTo( } final Collection> entries = offsetIndex.getEntries(); final Collection nonFlushedValues = new ArrayList<>(entries.size()); + int counter = 0; final Iterator> it = entries.iterator(); while (it.hasNext()) { final Entry entry = it.next(); @@ -271,6 +274,10 @@ public static FileLocationAndWrittenBytes copySnapshotTo( return payload; } ); + counter++; + if (progressConsumer != null) { + progressConsumer.accept(counter); + } // finally, register non-flushed value final RecordKey key = entry.getKey(); @@ -302,6 +309,7 @@ public static FileLocationAndWrittenBytes serialize( @Nullable FileLocation lastFileOffsetIndexLocation, @Nonnull StorageOptions storageOptions ) { + final int totalEntryCount = nonFlushedEntries.size(); final Iterator entries = nonFlushedEntries.iterator(); // start with full buffer diff --git a/evita_store/evita_store_server/pom.xml b/evita_store/evita_store_server/pom.xml index a9813579d..af1f84a2e 100644 --- a/evita_store/evita_store_server/pom.xml +++ b/evita_store/evita_store_server/pom.xml @@ -60,4 +60,28 @@ kryo + + + + net.bytebuddy + byte-buddy-maven-plugin + 1.14.17 + + + transform-classes + + transform + + + + + io.evitadb.core.async.InterruptionTransformer + + + + + + + + diff --git a/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultCatalogPersistenceService.java b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultCatalogPersistenceService.java index bbde6faf5..1dab9beb0 100644 --- a/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultCatalogPersistenceService.java +++ b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultCatalogPersistenceService.java @@ -32,6 +32,7 @@ import io.evitadb.api.exception.CollectionNotFoundException; import io.evitadb.api.exception.EntityTypeAlreadyPresentInCatalogSchemaException; import io.evitadb.api.exception.TemporalDataNotAvailableException; +import io.evitadb.api.file.FileForFetch; import io.evitadb.api.requestResponse.data.AttributesContract.AttributeKey; import io.evitadb.api.requestResponse.mutation.Mutation; import io.evitadb.api.requestResponse.schema.EntitySchemaContract; @@ -43,6 +44,7 @@ import io.evitadb.api.requestResponse.system.CatalogVersionDescriptor; import io.evitadb.api.requestResponse.system.TimeFlow; import io.evitadb.api.requestResponse.transaction.TransactionMutation; +import io.evitadb.api.task.Task; import io.evitadb.core.Catalog; import io.evitadb.core.CatalogVersionBeyondTheHorizonListener; import io.evitadb.core.EntityCollection; @@ -50,6 +52,7 @@ import io.evitadb.core.buffer.DataStoreIndexChanges; import io.evitadb.core.buffer.DataStoreMemoryBuffer; import io.evitadb.core.buffer.WarmUpDataStoreMemoryBuffer; +import io.evitadb.core.file.ExportFileService; import io.evitadb.core.metric.event.storage.CatalogStatisticsEvent; import io.evitadb.core.metric.event.storage.DataFileCompactEvent; import io.evitadb.core.metric.event.storage.FileType; @@ -69,6 +72,7 @@ import io.evitadb.index.attribute.GlobalUniqueIndex; import io.evitadb.store.catalog.ObsoleteFileMaintainer.DataFilesBulkInfo; import io.evitadb.store.catalog.model.CatalogBootstrap; +import io.evitadb.store.catalog.task.BackupTask; import io.evitadb.store.entity.model.schema.CatalogSchemaStoragePart; import io.evitadb.store.exception.InvalidFileNameException; import io.evitadb.store.exception.InvalidStoragePathException; @@ -79,7 +83,6 @@ import io.evitadb.store.kryo.VersionedKryoFactory; import io.evitadb.store.kryo.VersionedKryoKeyInputs; import io.evitadb.store.model.FileLocation; -import io.evitadb.store.model.StoragePart; import io.evitadb.store.offsetIndex.OffsetIndex.NonFlushedBlock; import io.evitadb.store.offsetIndex.OffsetIndexDescriptor; import io.evitadb.store.offsetIndex.exception.UnexpectedCatalogContentsException; @@ -120,7 +123,6 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.io.BufferedOutputStream; import java.io.Closeable; import java.io.File; import java.io.FileOutputStream; @@ -136,7 +138,6 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Function; -import java.util.function.IntConsumer; import java.util.function.LongConsumer; import java.util.function.LongSupplier; import java.util.function.Supplier; @@ -144,8 +145,6 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; import static io.evitadb.store.catalog.CatalogOffsetIndexStoragePartPersistenceService.readCatalogHeader; import static io.evitadb.store.spi.CatalogPersistenceService.*; @@ -188,6 +187,10 @@ public class DefaultCatalogPersistenceService implements CatalogPersistenceServi * The off-heap memory manager instance that is used for allocating off-heap memory regions for storing data. */ private final OffHeapMemoryManager offHeapMemoryManager; + /** + * The export file service instance that is used for backing-up data from the catalog. + */ + private final ExportFileService exportFileService; /** * The name of the catalog that maps to {@link EntitySchema#getName()}. */ @@ -213,7 +216,7 @@ public class DefaultCatalogPersistenceService implements CatalogPersistenceServi /** * Contains information about storage configuration options. */ - @Nonnull + @Getter @Nonnull private final StorageOptions storageOptions; /** * Contains information about transaction configuration options. @@ -348,6 +351,31 @@ public static Path pathForCatalog(@Nonnull String catalogName, @Nonnull Path sto } } + /** + * Serializes the bootstrap record to the output and returns the {@link StorageRecord}. + * + * @param output the output to write the record to + * @param bootstrapRecord the bootstrap record to serialize + * @return the {@link StorageRecord} with the serialized bootstrap record + */ + @Nonnull + public static StorageRecord serializeBootstrapRecord( + @Nonnull ObservableOutput output, + @Nonnull CatalogBootstrap bootstrapRecord + ) { + return new StorageRecord<>( + output, bootstrapRecord.catalogVersion(), true, + theOutput -> { + theOutput.writeLong(bootstrapRecord.catalogVersion()); + theOutput.writeInt(bootstrapRecord.catalogFileIndex()); + theOutput.writeLong(bootstrapRecord.timestamp().toInstant().toEpochMilli()); + theOutput.writeLong(bootstrapRecord.fileLocation().startingPosition()); + theOutput.writeInt(bootstrapRecord.fileLocation().recordLength()); + return bootstrapRecord; + } + ); + } + /** * Retrieves the first catalog bootstrap for a given catalog or NULL if the bootstrap file is empty. * @@ -697,31 +725,6 @@ private static CatalogVersion readCatalogVersion(@Nonnull ReadOnlyFileHandle rea ); } - /** - * Serializes the bootstrap record to the output and returns the {@link StorageRecord}. - * - * @param output the output to write the record to - * @param bootstrapRecord the bootstrap record to serialize - * @return the {@link StorageRecord} with the serialized bootstrap record - */ - @Nonnull - private static StorageRecord serializeBootstrapRecord( - @Nonnull ObservableOutput output, - @Nonnull CatalogBootstrap bootstrapRecord - ) { - return new StorageRecord<>( - output, bootstrapRecord.catalogVersion(), true, - theOutput -> { - theOutput.writeLong(bootstrapRecord.catalogVersion()); - theOutput.writeInt(bootstrapRecord.catalogFileIndex()); - theOutput.writeLong(bootstrapRecord.timestamp().toInstant().toEpochMilli()); - theOutput.writeLong(bootstrapRecord.fileLocation().startingPosition()); - theOutput.writeInt(bootstrapRecord.fileLocation().recordLength()); - return bootstrapRecord; - } - ); - } - /** * Copies the bootstrap record to the specified file handle. * @@ -778,11 +781,13 @@ public DefaultCatalogPersistenceService( @Nonnull String catalogName, @Nonnull StorageOptions storageOptions, @Nonnull TransactionOptions transactionOptions, - @Nonnull Scheduler scheduler + @Nonnull Scheduler scheduler, + @Nonnull ExportFileService exportFileService ) { this.storageOptions = storageOptions; this.transactionOptions = transactionOptions; this.scheduler = scheduler; + this.exportFileService = exportFileService; this.offHeapMemoryManager = new OffHeapMemoryManager( catalogName, transactionOptions.transactionMemoryBufferLimitSizeBytes(), @@ -858,11 +863,13 @@ public DefaultCatalogPersistenceService( @Nonnull String catalogName, @Nonnull StorageOptions storageOptions, @Nonnull TransactionOptions transactionOptions, - @Nonnull Scheduler scheduler + @Nonnull Scheduler scheduler, + @Nonnull ExportFileService exportFileService ) { this.storageOptions = storageOptions; this.transactionOptions = transactionOptions; this.scheduler = scheduler; + this.exportFileService = exportFileService; this.offHeapMemoryManager = new OffHeapMemoryManager( catalogName, transactionOptions.transactionMemoryBufferLimitSizeBytes(), @@ -955,6 +962,7 @@ private DefaultCatalogPersistenceService( this.recordTypeRegistry = previous.recordTypeRegistry; this.observableOutputKeeper = previous.observableOutputKeeper; this.offHeapMemoryManager = previous.offHeapMemoryManager; + this.exportFileService = previous.exportFileService; this.catalogName = catalogName; this.catalogStoragePath = catalogStoragePath; this.bootstrapWriteHandle = new AtomicReference<>(bootstrapWriteHandle); @@ -1572,7 +1580,7 @@ public EntityCollectionPersistenceService replaceCollectionWith( // now copy living snapshot of the entity collection to a new file Assert.isPremiseValid(newFile.createNewFile(), "Cannot create new entity collection file: `" + newFilePath + "`!"); try (final FileOutputStream fos = new FileOutputStream(newFile)) { - newEntityCollectionHeader = entityPersistenceService.copySnapshotTo(catalogVersion, newEntityTypeFileIndex, fos); + newEntityCollectionHeader = entityPersistenceService.copySnapshotTo(catalogVersion, newEntityTypeFileIndex, fos, null); } } catch (RuntimeException | IOException ex) { // delete non-finished damaged file if exists @@ -1806,161 +1814,13 @@ public void purgeAllObsoleteFiles() { @Nonnull @Override - public Path backup(@Nonnull UUID id, @Nullable OffsetDateTime pastMoment, boolean includingWAL, @Nonnull IntConsumer progressUpdater) throws TemporalDataNotAvailableException { - final CatalogBootstrap bootstrapToUse = pastMoment == null ? + public Task createBackupTask(@Nullable OffsetDateTime pastMoment, boolean includingWAL) throws TemporalDataNotAvailableException { + final CatalogBootstrap bootstrapRecord = pastMoment == null ? this.bootstrapUsed : getCatalogBootstrapForSpecificMoment(this.catalogName, this.storageOptions, pastMoment); - final long catalogVersion = bootstrapToUse.catalogVersion(); - - final Path backupFolder = this.transactionOptions.transactionWorkDirectory().resolve("backup"); - if (!backupFolder.toFile().exists()) { - Assert.isPremiseValid(backupFolder.toFile().mkdirs(), "Failed to create backup folder `" + backupFolder + "`!"); - } - final Path backupFile = backupFolder.resolve(id + ".zip"); - - try (final Closeables closeables = new Closeables()) { - final CatalogOffsetIndexStoragePartPersistenceService catalogPersistenceService = pastMoment == null ? - getStoragePartPersistenceService(catalogVersion) : - closeables.add(createCatalogOffsetIndexStoragePartService(bootstrapToUse)); - - try (ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(backupFile.toFile())))) { - zipOutputStream.putNextEntry(new ZipEntry(this.catalogName + "/")); - zipOutputStream.closeEntry(); - - // first store all the active contents of the entity collection data files - final CatalogHeader catalogHeader = catalogPersistenceService.getCatalogHeader(catalogVersion); - final Map entityHeaders = CollectionUtils.createHashMap( - catalogHeader.getEntityTypeFileIndexes().size() - ); - for (CollectionFileReference entityTypeFileIndex : catalogHeader.getEntityTypeFileIndexes()) { - final String entityDataFileName = CatalogPersistenceService.getEntityCollectionDataStoreFileName( - entityTypeFileIndex.entityType(), - entityTypeFileIndex.entityTypePrimaryKey(), - 0 - ); - zipOutputStream.putNextEntry(new ZipEntry(this.catalogName + "/" + entityDataFileName)); - final DefaultEntityCollectionPersistenceService entityCollectionPersistenceService = pastMoment == null ? - getOrCreateEntityCollectionPersistenceService( - catalogVersion, entityTypeFileIndex.entityType(), entityTypeFileIndex.entityTypePrimaryKey() - ) : - closeables.add( - createEntityCollectionPersistenceService(catalogPersistenceService.getStoragePart(catalogVersion, 1, EntityCollectionHeader.class)) - ); - final EntityCollectionHeader newEntityCollectionHeader = entityCollectionPersistenceService.copySnapshotTo( - catalogVersion, - new CollectionFileReference( - entityTypeFileIndex.entityType(), - entityTypeFileIndex.entityTypePrimaryKey(), - 0, - entityTypeFileIndex.fileLocation() - ), - zipOutputStream - ); - entityHeaders.put( - entityTypeFileIndex.entityType(), - newEntityCollectionHeader - ); - zipOutputStream.closeEntry(); - } - - // then write the active contents of the catalog file - final String catalogDataStoreFileName = CatalogPersistenceService.getCatalogDataStoreFileName(this.catalogName, 0); - zipOutputStream.putNextEntry(new ZipEntry(this.catalogName + "/" + catalogDataStoreFileName)); - - final OffsetIndexDescriptor catalogDataFileDescriptor = catalogPersistenceService - .copySnapshotTo( - catalogVersion, zipOutputStream, - Stream.concat( - Stream.of( - new CatalogHeader( - STORAGE_PROTOCOL_VERSION, - catalogHeader.version() + 1, - catalogHeader.walFileReference(), - entityHeaders.values().stream() - .map( - it -> new CollectionFileReference( - it.entityType(), - it.entityTypePrimaryKey(), - it.entityTypeFileIndex(), - it.fileLocation() - ) - ) - .collect( - Collectors.toMap( - CollectionFileReference::entityType, - Function.identity() - ) - ), - catalogHeader.compressedKeys(), - catalogHeader.catalogId(), - catalogHeader.catalogName(), - catalogHeader.catalogState(), - catalogHeader.lastEntityCollectionPrimaryKey(), - 1.0 // all entries are active - ) - ), - entityHeaders.values().stream() - ) - .map(StoragePart.class::cast) - .toArray(StoragePart[]::new) - ); - zipOutputStream.closeEntry(); - - // store the WAL file with all records written after the catalog version - if (includingWAL) { - try (final Stream walFileStream = Files.list(catalogStoragePath)) { - walFileStream - .filter(it -> it.getFileName().toString().endsWith(WAL_FILE_SUFFIX)) - .forEach(walFile -> { - try { - zipOutputStream.putNextEntry(new ZipEntry(this.catalogName + "/" + walFile.getFileName())); - Files.copy(walFile, zipOutputStream); - zipOutputStream.closeEntry(); - } catch (IOException e) { - throw new UnexpectedIOException( - "Failed to backup WAL file `" + walFile + "`!", - "Failed to backup WAL file!", - e - ); - } - }); - } - } - - // finally, store the catalog bootstrap - final String bootstrapFileName = getCatalogBootstrapFileName(this.catalogName); - zipOutputStream.putNextEntry(new ZipEntry(this.catalogName + "/" + bootstrapFileName)); - // store used bootstrap - final ObservableOutput boostrapOutput = new ObservableOutput<>( - zipOutputStream, - CatalogBootstrap.BOOTSTRAP_RECORD_SIZE, - CatalogBootstrap.BOOTSTRAP_RECORD_SIZE << 1, - 0L - ); - final StorageRecord catalogBootstrapStorageRecord = serializeBootstrapRecord( - boostrapOutput, - new CatalogBootstrap( - catalogVersion, - 0, - OffsetDateTime.now(), - catalogDataFileDescriptor.fileLocation() - ) - ); - boostrapOutput.flush(); - Assert.isPremiseValid( - catalogBootstrapStorageRecord.fileLocation().recordLength() == CatalogBootstrap.BOOTSTRAP_RECORD_SIZE, - "Unexpected bootstrap record size: " + catalogBootstrapStorageRecord.fileLocation().recordLength() - ); - zipOutputStream.closeEntry(); - } catch (IOException e) { - throw new UnexpectedIOException( - "Failed to backup catalog `" + this.catalogName + "`!", - "Failed to backup catalog!", - e - ); - } - } - - return backupFile; + return new BackupTask( + this.catalogName, pastMoment, includingWAL, + bootstrapRecord, this.exportFileService, this + ); } @Override @@ -2018,6 +1878,55 @@ public boolean isClosed() { return this.catalogStoragePartPersistenceService.isEmpty(); } + /** + * Creates new instance of the catalog offset index storage part persistence service for the specified catalog + * version (header). + * + * @param catalogBootstrap the catalog header + * @return the new instance of the catalog offset index storage part persistence service + */ + @Nonnull + public CatalogOffsetIndexStoragePartPersistenceService createCatalogOffsetIndexStoragePartService( + @Nonnull CatalogBootstrap catalogBootstrap + ) { + return CatalogOffsetIndexStoragePartPersistenceService.create( + this.catalogName, + this.catalogStoragePath.resolve(getCatalogDataStoreFileName(this.catalogName, catalogBootstrap.catalogFileIndex())), + this.storageOptions, + this.transactionOptions, + catalogBootstrap, + this.recordTypeRegistry, + this.offHeapMemoryManager, + this.observableOutputKeeper, + VERSIONED_KRYO_FACTORY, + nonFlushedBlock -> this.reportNonFlushedContents(catalogName, nonFlushedBlock), + oldestRecordTimestamp -> reportOldestHistoricalRecord(catalogName, oldestRecordTimestamp.orElse(null)) + ); + } + + /** + * Creates new instance of the entity collection persistence service for the specified entity type. + * + * @param entityCollectionHeader the entity collection header + * @return the new instance of the entity collection persistence service + */ + @Nonnull + public DefaultEntityCollectionPersistenceService createEntityCollectionPersistenceService( + @Nonnull EntityCollectionHeader entityCollectionHeader + ) { + return new DefaultEntityCollectionPersistenceService( + this.bootstrapUsed.catalogVersion(), + this.catalogName, + this.catalogStoragePath, + entityCollectionHeader, + this.storageOptions, + this.transactionOptions, + this.offHeapMemoryManager, + this.observableOutputKeeper, + this.recordTypeRegistry + ); + } + /** * Records a bootstrap in the catalog. * @@ -2072,7 +1981,7 @@ CatalogBootstrap recordBootstrap( final String compactedFileName = getCatalogDataStoreFileName(newCatalogName, newCatalogFileIndex); final OffsetIndexDescriptor compactedDescriptor; try (final FileOutputStream fos = new FileOutputStream(this.catalogStoragePath.resolve(compactedFileName).toFile())) { - compactedDescriptor = storagePartPersistenceService.copySnapshotTo(catalogVersion, fos); + compactedDescriptor = storagePartPersistenceService.copySnapshotTo(catalogVersion, fos, null); } catch (IOException e) { throw new UnexpectedIOException( "Error occurred while compacting catalog data file: " + e.getMessage(), @@ -2244,55 +2153,6 @@ void trimBootstrapFile(long catalogVersion) { } } - /** - * Creates new instance of the catalog offset index storage part persistence service for the specified catalog - * version (header). - * - * @param catalogBootstrap the catalog header - * @return the new instance of the catalog offset index storage part persistence service - */ - @Nonnull - private CatalogOffsetIndexStoragePartPersistenceService createCatalogOffsetIndexStoragePartService( - @Nonnull CatalogBootstrap catalogBootstrap - ) { - return CatalogOffsetIndexStoragePartPersistenceService.create( - this.catalogName, - this.catalogStoragePath.resolve(getCatalogDataStoreFileName(this.catalogName, catalogBootstrap.catalogFileIndex())), - this.storageOptions, - this.transactionOptions, - catalogBootstrap, - this.recordTypeRegistry, - this.offHeapMemoryManager, - this.observableOutputKeeper, - VERSIONED_KRYO_FACTORY, - nonFlushedBlock -> this.reportNonFlushedContents(catalogName, nonFlushedBlock), - oldestRecordTimestamp -> reportOldestHistoricalRecord(catalogName, oldestRecordTimestamp.orElse(null)) - ); - } - - /** - * Creates new instance of the entity collection persistence service for the specified entity type. - * - * @param entityCollectionHeader the entity collection header - * @return the new instance of the entity collection persistence service - */ - @Nonnull - private DefaultEntityCollectionPersistenceService createEntityCollectionPersistenceService( - @Nonnull EntityCollectionHeader entityCollectionHeader - ) { - return new DefaultEntityCollectionPersistenceService( - this.bootstrapUsed.catalogVersion(), - this.catalogName, - this.catalogStoragePath, - entityCollectionHeader, - this.storageOptions, - this.transactionOptions, - this.offHeapMemoryManager, - this.observableOutputKeeper, - this.recordTypeRegistry - ); - } - /** * Removes the persistence service from internal index and closes its resources. * @@ -2633,34 +2493,4 @@ public void close() { } } - /** - * Closeable objects aggregator. - */ - private static class Closeables implements AutoCloseable { - private final List closeables = new LinkedList<>(); - - /** - * Adds a new closeable to the list of closeables that are closed when this object is closed. - * - * @param item the closeable to add - * @param the type of the closeable - * @return the same closeable - */ - @Nonnull - public T add(@Nonnull T item) { - this.closeables.add(item); - return item; - } - - @Override - public void close() { - closeables.forEach(it -> { - try { - it.close(); - } catch (Exception e) { - log.error("Failed to close resource!", e); - } - }); - } - } } diff --git a/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultCatalogPersistenceServiceFactory.java b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultCatalogPersistenceServiceFactory.java index 16123344b..902342398 100644 --- a/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultCatalogPersistenceServiceFactory.java +++ b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultCatalogPersistenceServiceFactory.java @@ -26,26 +26,17 @@ import io.evitadb.api.CatalogContract; import io.evitadb.api.configuration.StorageOptions; import io.evitadb.api.configuration.TransactionOptions; -import io.evitadb.core.async.BackgroundCallableTask; +import io.evitadb.core.async.ClientRunnableTask; import io.evitadb.core.async.Scheduler; -import io.evitadb.exception.UnexpectedIOException; +import io.evitadb.core.file.ExportFileService; +import io.evitadb.store.catalog.task.RestoreTask; import io.evitadb.store.exception.InvalidStoragePathException; import io.evitadb.store.spi.CatalogPersistenceService; import io.evitadb.store.spi.CatalogPersistenceServiceFactory; import io.evitadb.store.spi.exception.DirectoryNotEmptyException; -import io.evitadb.utils.Assert; -import io.evitadb.utils.CountingInputStream; import javax.annotation.Nonnull; -import java.io.IOException; import java.io.InputStream; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.regex.Matcher; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; /** * This implementation is the single and only implementation of {@link CatalogPersistenceServiceFactory}. Instance is @@ -63,10 +54,11 @@ public CatalogPersistenceService createNew( @Nonnull String catalogName, @Nonnull StorageOptions storageOptions, @Nonnull TransactionOptions transactionOptions, - @Nonnull Scheduler scheduler - ) { + @Nonnull Scheduler scheduler, + @Nonnull ExportFileService exportFileService + ) { return new DefaultCatalogPersistenceService( - catalogName, storageOptions, transactionOptions, scheduler + catalogName, storageOptions, transactionOptions, scheduler, exportFileService ); } @@ -77,106 +69,28 @@ public CatalogPersistenceService load( @Nonnull String catalogName, @Nonnull StorageOptions storageOptions, @Nonnull TransactionOptions transactionOptions, - @Nonnull Scheduler scheduler + @Nonnull Scheduler scheduler, + @Nonnull ExportFileService exportFileService ) { return new DefaultCatalogPersistenceService( - catalogInstance, catalogName, storageOptions, transactionOptions, scheduler + catalogInstance, catalogName, storageOptions, transactionOptions, scheduler, exportFileService ); } @Nonnull @Override - public BackgroundCallableTask restoreCatalogTo( + public ClientRunnableTask restoreCatalogTo( @Nonnull String catalogName, @Nonnull StorageOptions storageOptions, long totalBytesExpected, @Nonnull InputStream inputStream ) throws DirectoryNotEmptyException, InvalidStoragePathException { - return new BackgroundCallableTask<>( + return new RestoreTask( catalogName, - "Restore catalog `" + catalogName + "`", - task -> { - // unzip contents of the stream - final CountingInputStream cis = new CountingInputStream(inputStream); - try (final ZipInputStream zipInputStream = new ZipInputStream(cis)) { - final Path storagePath = DefaultCatalogPersistenceService.pathForCatalog(catalogName, storageOptions.storageDirectoryOrDefault()); - DefaultCatalogPersistenceService.verifyDirectory(storagePath, true); - - ZipEntry entry = zipInputStream.getNextEntry(); - Assert.isPremiseValid(entry.isDirectory(), "First entry in the zip file must be a directory!"); - // last character is always a slash - final String directoryName = entry.getName().substring(0, entry.getName().length() - 1); - // allocate buffer for reading - final ByteBuffer buffer = ByteBuffer.allocate(16_384); - while ((entry = zipInputStream.getNextEntry()) != null) { - // get the name of the file in the zip and create the file in the storage - final String fileName = getFileNameWithCatalogRename(entry.getName(), directoryName, catalogName); - final Path entryPath = storagePath.resolve(fileName); - try (final FileChannel fileChannel = FileChannel.open(entryPath, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE)) { - // read the file from the zip and write it to the storage - int bytesRead; - while ((bytesRead = zipInputStream.read(buffer.array())) != -1) { - buffer.limit(bytesRead); - while (buffer.hasRemaining()) { - fileChannel.write(buffer); - } - buffer.clear(); - task.updateProgress((int)((cis.getCount() * 100L) / totalBytesExpected)); - } - } - } - // write file marking the catalog as restored - Assert.isPremiseValid( - storagePath.resolve(CatalogPersistenceService.RESTORE_FLAG).toFile().createNewFile(), - () -> new UnexpectedIOException( - "Unexpected exception occurred while restoring catalog " + catalogName + ": unable to create restore flag file!", - "Unexpected exception occurred while restoring catalog - unable to create restore flag file!" - ) - ); - return storagePath; - } catch (IOException e) { - throw new UnexpectedIOException( - "Unexpected exception occurred while restoring catalog: " + e.getMessage(), - "Unexpected exception occurred while restoring catalog!", - e - ); - } - } + inputStream, + totalBytesExpected, + storageOptions ); } - /** - * Returns the file name with renaming the files that contain original catalog name. - * - * @param entryName relative path in the ZIP file - * @param originalCatalogName original catalog name - * @param catalogName the new catalog name - * @return the file name with renaming - */ - @Nonnull - private static String getFileNameWithCatalogRename( - @Nonnull String entryName, - @Nonnull String originalCatalogName, - @Nonnull String catalogName - ) { - final String fileName = entryName.substring(originalCatalogName.length() + 1); - if (entryName.endsWith(CatalogPersistenceService.BOOT_FILE_SUFFIX)) { - return CatalogPersistenceService.getCatalogBootstrapFileName(catalogName); - } else if (entryName.endsWith(CatalogPersistenceService.CATALOG_FILE_SUFFIX)) { - final Matcher matcher = CatalogPersistenceService.getCatalogDataStoreFileNamePattern(originalCatalogName) - .matcher(fileName); - Assert.isPremiseValid( - matcher.matches(), - "Invalid file name for catalog date file!" - ); - return CatalogPersistenceService.getCatalogDataStoreFileName( - catalogName, Integer.parseInt(matcher.group(1)) - ); - } else if (entryName.endsWith(CatalogPersistenceService.WAL_FILE_SUFFIX)) { - final int walIndex = CatalogPersistenceService.getIndexFromWalFileName(originalCatalogName, fileName); - return CatalogPersistenceService.getWalFileName(catalogName, walIndex); - } else { - return fileName; - } - } } diff --git a/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultEntityCollectionPersistenceService.java b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultEntityCollectionPersistenceService.java index 0e8ea9079..8c5e93831 100644 --- a/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultEntityCollectionPersistenceService.java +++ b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/DefaultEntityCollectionPersistenceService.java @@ -126,6 +126,7 @@ import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; +import java.util.function.IntConsumer; import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -1129,7 +1130,7 @@ public EntityCollectionHeader compact(@Nonnull String catalogName, long catalogV final Path newFilePath = newReference.toFilePath(catalogStoragePath); final OffsetIndexDescriptor offsetIndexDescriptor; try (final FileOutputStream fos = new FileOutputStream(newFilePath.toFile())) { - offsetIndexDescriptor = this.storagePartPersistenceService.copySnapshotTo(catalogVersion, fos); + offsetIndexDescriptor = this.storagePartPersistenceService.copySnapshotTo(catalogVersion, fos, null); } catch (IOException e) { throw new UnexpectedIOException( "Error occurred while compacting entity " + this.entityCollectionFile + " data file: " + e.getMessage(), @@ -1162,12 +1163,13 @@ public Function createTypeKryoInstance() public EntityCollectionHeader copySnapshotTo( long catalogVersion, @Nonnull CollectionFileReference fileReference, - @Nonnull OutputStream outputStream + @Nonnull OutputStream outputStream, + @Nullable IntConsumer progressConsumer ) { - final OffsetIndexDescriptor offsetIndexDescriptor = getStoragePartPersistenceService().copySnapshotTo(catalogVersion, outputStream); + final OffsetIndexDescriptor offsetIndexDescriptor = getStoragePartPersistenceService().copySnapshotTo(catalogVersion, outputStream, progressConsumer); final EntityCollectionHeader currentHeader = getEntityCollectionHeader(); final Path catalogStoragePath = this.entityCollectionFile.getParent(); - final EntityCollectionHeader theHeader = createEntityCollectionHeader( + return createEntityCollectionHeader( catalogVersion, catalogStoragePath, offsetIndexDescriptor, @@ -1179,7 +1181,6 @@ public EntityCollectionHeader copySnapshotTo( offsetIndexDescriptor.fileLocation() ) ); - return theHeader; } @Override diff --git a/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/OffsetIndexStoragePartPersistenceService.java b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/OffsetIndexStoragePartPersistenceService.java index bcbb18c13..34e3c3f09 100644 --- a/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/OffsetIndexStoragePartPersistenceService.java +++ b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/OffsetIndexStoragePartPersistenceService.java @@ -49,6 +49,7 @@ import java.util.Objects; import java.util.UUID; import java.util.function.Function; +import java.util.function.IntConsumer; import java.util.stream.Stream; /** @@ -203,6 +204,15 @@ public Stream getEntryStream(@Nonnull Class contai } } + @Override + public int countStorageParts(long catalogVersion) { + if (offsetIndex.isOperative()) { + return this.offsetIndex.count(catalogVersion); + } else { + throw new PersistenceServiceClosed(); + } + } + @Override public int countStorageParts(long catalogVersion, @Nonnull Class containerType) { if (offsetIndex.isOperative()) { @@ -313,11 +323,13 @@ public OffsetIndexDescriptor flush(long catalogVersion) { @Nonnull @Override public OffsetIndexDescriptor copySnapshotTo( - long catalogVersion, @Nonnull OutputStream outputStream, + long catalogVersion, + @Nonnull OutputStream outputStream, + @Nullable IntConsumer progressConsumer, @Nullable StoragePart... updatedStorageParts ) { if (offsetIndex.isOperative()) { - return this.offsetIndex.copySnapshotTo(outputStream, catalogVersion, updatedStorageParts); + return this.offsetIndex.copySnapshotTo(outputStream, progressConsumer, catalogVersion, updatedStorageParts); } else { throw new PersistenceServiceClosed(); } diff --git a/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/task/BackupTask.java b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/task/BackupTask.java new file mode 100644 index 000000000..6c6bf3307 --- /dev/null +++ b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/task/BackupTask.java @@ -0,0 +1,502 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.evitadb.store.catalog.task; + +import io.evitadb.api.file.FileForFetch; +import io.evitadb.api.task.TaskStatus; +import io.evitadb.core.async.ClientCallableTask; +import io.evitadb.core.async.Interruptible; +import io.evitadb.core.file.ExportFileService; +import io.evitadb.core.file.ExportFileService.ExportFileHandle; +import io.evitadb.exception.GenericEvitaInternalError; +import io.evitadb.exception.UnexpectedIOException; +import io.evitadb.store.catalog.CatalogOffsetIndexStoragePartPersistenceService; +import io.evitadb.store.catalog.DefaultCatalogPersistenceService; +import io.evitadb.store.catalog.DefaultEntityCollectionPersistenceService; +import io.evitadb.store.catalog.model.CatalogBootstrap; +import io.evitadb.store.catalog.task.BackupTask.BackupSettings; +import io.evitadb.store.kryo.ObservableOutput; +import io.evitadb.store.model.StoragePart; +import io.evitadb.store.offsetIndex.OffsetIndexDescriptor; +import io.evitadb.store.offsetIndex.model.StorageRecord; +import io.evitadb.store.spi.CatalogPersistenceService; +import io.evitadb.store.spi.model.CatalogHeader; +import io.evitadb.store.spi.model.EntityCollectionHeader; +import io.evitadb.store.spi.model.reference.CollectionFileReference; +import io.evitadb.utils.Assert; +import io.evitadb.utils.CollectionUtils; +import lombok.extern.slf4j.Slf4j; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.io.BufferedOutputStream; +import java.io.Closeable; +import java.io.IOException; +import java.io.Serializable; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import static io.evitadb.store.catalog.DefaultCatalogPersistenceService.serializeBootstrapRecord; +import static io.evitadb.store.spi.CatalogPersistenceService.STORAGE_PROTOCOL_VERSION; +import static io.evitadb.store.spi.CatalogPersistenceService.WAL_FILE_SUFFIX; +import static io.evitadb.store.spi.CatalogPersistenceService.getCatalogBootstrapFileName; +import static java.util.Optional.ofNullable; + +/** + * Task responsible for backing up the catalog data and WAL files. + * + * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 + */ +@Slf4j +public class BackupTask extends ClientCallableTask { + private final String catalogName; + private final CatalogBootstrap bootstrapRecord; + private final ExportFileService exportFileService; + private final DefaultCatalogPersistenceService catalogPersistenceService; + + public BackupTask( + @Nonnull String catalogName, + @Nullable OffsetDateTime pastMoment, + boolean includingWAL, + @Nonnull CatalogBootstrap bootstrapRecord, + @Nonnull ExportFileService exportFileService, + @Nonnull DefaultCatalogPersistenceService catalogPersistenceService + ) { + super( + catalogName, + "Backup catalog " + catalogName + + (pastMoment == null ? " now" : " at " + pastMoment) + + (includingWAL ? "" : ", including WAL: " + includingWAL), + new BackupSettings(pastMoment, includingWAL), + (task) -> ((BackupTask) task).doBackup() + ); + this.catalogName = catalogName; + this.bootstrapRecord = bootstrapRecord; + this.exportFileService = exportFileService; + this.catalogPersistenceService = catalogPersistenceService; + } + + /** + * Method executes the backup logic for this catalog with particular settings. + * + * @return the path to the created backup file + */ + @Nonnull + private FileForFetch doBackup() { + final BackupSettings settings = getStatus().settings(); + final OffsetDateTime thePastMoment = settings.pastMoment(); + final boolean theIncludingWAL = settings.includingWAL(); + final long catalogVersion = this.bootstrapRecord.catalogVersion(); + + final Path backupFolder = this.catalogPersistenceService.getStorageOptions().exportDirectoryOrDefault(); + if (!backupFolder.toFile().exists()) { + Assert.isPremiseValid(backupFolder.toFile().mkdirs(), "Failed to create backup folder `" + backupFolder + "`!"); + } + + final ExportFileHandle exportFileHandle = this.exportFileService.storeFile( + "backup_" + + (thePastMoment == null ? + "actual_" + OffsetDateTime.now().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME) : + "historical_" + thePastMoment.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME) + ) + ".zip", + "The backup of the " + + (thePastMoment == null ? "actual " : "historical " + thePastMoment) + + "catalog `" + this.catalogName + "`" + (theIncludingWAL ? " including WAL." : "."), + "application/zip", + this.getClass().getSimpleName() + ); + + try (final Closeables closeables = new Closeables()) { + final CatalogOffsetIndexStoragePartPersistenceService catalogPersistenceService = thePastMoment == null ? + this.catalogPersistenceService.getStoragePartPersistenceService(catalogVersion) : + closeables.add(this.catalogPersistenceService.createCatalogOffsetIndexStoragePartService(this.bootstrapRecord)); + + try (ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(exportFileHandle.outputStream()))) { + zipOutputStream.putNextEntry(new ZipEntry(this.catalogName + "/")); + zipOutputStream.closeEntry(); + + // first store all the active contents of the entity collection data files + final CatalogHeader catalogHeader = catalogPersistenceService.getCatalogHeader(catalogVersion); + final Map entityHeaders = CollectionUtils.createHashMap( + catalogHeader.getEntityTypeFileIndexes().size() + ); + + // collect all entity collection services and calculate total record count to backup + final ServicesAndStatistics servicesAndStatistics = getServicesAndStatistics( + catalogVersion, thePastMoment, theIncludingWAL, catalogPersistenceService, catalogHeader, closeables + ); + + int backedUpRecords = 0; + for (CollectionFileReference entityTypeFileIndex : catalogHeader.getEntityTypeFileIndexes()) { + backedUpRecords = backupEntityCollectionDataFile( + catalogVersion, backedUpRecords, entityTypeFileIndex, zipOutputStream, servicesAndStatistics, + entityHeaders + ); + } + + // then write the active contents of the catalog file + final String catalogDataStoreFileName = CatalogPersistenceService.getCatalogDataStoreFileName(this.catalogName, 0); + zipOutputStream.putNextEntry(new ZipEntry(this.catalogName + "/" + catalogDataStoreFileName)); + + final OffsetIndexDescriptor catalogDataFileDescriptor = backupCatalogDataFile( + catalogVersion, backedUpRecords, catalogPersistenceService, zipOutputStream, + servicesAndStatistics, catalogHeader, entityHeaders + ); + backedUpRecords += servicesAndStatistics.catalogServiceRecordCount(); + + // store the WAL file with all records written after the catalog version + if (theIncludingWAL) { + backupWAL(backedUpRecords, servicesAndStatistics, zipOutputStream); + } + + // finally, store the catalog bootstrap + backupBootstrapRecord(catalogVersion, zipOutputStream, catalogDataFileDescriptor); + } catch (IOException e) { + throw new UnexpectedIOException( + "Failed to backup catalog `" + this.catalogName + "`!", + "Failed to backup catalog!", + e + ); + } + } + return ofNullable(exportFileHandle.fileForFetchFuture().getNow(null)) + .orElseThrow( + () -> new GenericEvitaInternalError( + "File for fetch should be generated in close method and" + + " should be already available by now." + ) + ); + } + + /** + * Copies the active contents of the catalog data file to the backup. + */ + @Interruptible + @Nonnull + private OffsetIndexDescriptor backupCatalogDataFile( + long catalogVersion, + int processedRecords, + @Nonnull CatalogOffsetIndexStoragePartPersistenceService catalogPersistenceService, + @Nonnull ZipOutputStream zipOutputStream, + @Nonnull ServicesAndStatistics servicesAndStatistics, + @Nonnull CatalogHeader catalogHeader, + @Nonnull Map entityHeaders + ) throws IOException { + final OffsetIndexDescriptor catalogDataFileDescriptor = catalogPersistenceService + .copySnapshotTo( + catalogVersion, + zipOutputStream, + recordsCopied -> getUpdateProgress(processedRecords + recordsCopied, servicesAndStatistics.totalRecords()), + Stream.concat( + Stream.of( + new CatalogHeader( + STORAGE_PROTOCOL_VERSION, + catalogHeader.version() + 1, + catalogHeader.walFileReference(), + entityHeaders.values().stream() + .map( + it -> new CollectionFileReference( + it.entityType(), + it.entityTypePrimaryKey(), + it.entityTypeFileIndex(), + it.fileLocation() + ) + ) + .collect( + Collectors.toMap( + CollectionFileReference::entityType, + Function.identity() + ) + ), + catalogHeader.compressedKeys(), + catalogHeader.catalogId(), + catalogHeader.catalogName(), + catalogHeader.catalogState(), + catalogHeader.lastEntityCollectionPrimaryKey(), + 1.0 // all entries are active + ) + ), + entityHeaders.values().stream() + ) + .map(StoragePart.class::cast) + .toArray(StoragePart[]::new) + ); + zipOutputStream.closeEntry(); + return catalogDataFileDescriptor; + } + + /** + * Copies the active contents of the entity collection data file to the backup. + */ + @Interruptible + private int backupEntityCollectionDataFile( + long catalogVersion, + int backedUpRecords, + @Nonnull CollectionFileReference entityTypeFileIndex, + @Nonnull ZipOutputStream zipOutputStream, + @Nonnull ServicesAndStatistics servicesAndStatistics, + @Nonnull Map entityHeaders + ) throws IOException { + final String entityDataFileName = CatalogPersistenceService.getEntityCollectionDataStoreFileName( + entityTypeFileIndex.entityType(), + entityTypeFileIndex.entityTypePrimaryKey(), + 0 + ); + zipOutputStream.putNextEntry(new ZipEntry(this.catalogName + "/" + entityDataFileName)); + final DefaultEntityCollectionPersistenceService entityCollectionPersistenceService = servicesAndStatistics.getServiceByEntityTypePrimaryKey(entityTypeFileIndex.entityTypePrimaryKey()); + final int finalBackedUpRecords = backedUpRecords; + final EntityCollectionHeader newEntityCollectionHeader = entityCollectionPersistenceService + .copySnapshotTo( + catalogVersion, + new CollectionFileReference( + entityTypeFileIndex.entityType(), + entityTypeFileIndex.entityTypePrimaryKey(), + 0, + entityTypeFileIndex.fileLocation() + ), + zipOutputStream, + recordsCopied -> getUpdateProgress(finalBackedUpRecords + recordsCopied, servicesAndStatistics.totalRecords()) + ); + entityHeaders.put( + entityTypeFileIndex.entityType(), + newEntityCollectionHeader + ); + zipOutputStream.closeEntry(); + return backedUpRecords + servicesAndStatistics.getServiceRecordCount(entityTypeFileIndex.entityTypePrimaryKey()); + } + + /** + * Copies the WAL files to the backup. + */ + @Interruptible + private void backupWAL( + int backedUpRecords, + @Nonnull ServicesAndStatistics servicesAndStatistics, + @Nonnull ZipOutputStream zipOutputStream + ) { + for (int i = 0; i < servicesAndStatistics.walFiles().length; i++) { + final Path walFile = servicesAndStatistics.walFiles()[i]; + try { + zipOutputStream.putNextEntry(new ZipEntry(this.catalogName + "/" + walFile.getFileName())); + Files.copy(walFile, zipOutputStream); + zipOutputStream.closeEntry(); + getUpdateProgress(backedUpRecords + i + 1, servicesAndStatistics.totalRecords()); + } catch (IOException e) { + throw new UnexpectedIOException( + "Failed to backup WAL file `" + walFile + "`!", + "Failed to backup WAL file!", + e + ); + } + } + } + + /** + * Stores the catalog bootstrap record to the backup. + */ + @Interruptible + private void backupBootstrapRecord( + long catalogVersion, + @Nonnull ZipOutputStream zipOutputStream, + @Nonnull OffsetIndexDescriptor catalogDataFileDescriptor + ) throws IOException { + final String bootstrapFileName = getCatalogBootstrapFileName(this.catalogName); + zipOutputStream.putNextEntry(new ZipEntry(this.catalogName + "/" + bootstrapFileName)); + + final ObservableOutput boostrapOutput = new ObservableOutput<>( + zipOutputStream, + CatalogBootstrap.BOOTSTRAP_RECORD_SIZE, + CatalogBootstrap.BOOTSTRAP_RECORD_SIZE << 1, + 0L + ); + final StorageRecord catalogBootstrapStorageRecord = serializeBootstrapRecord( + boostrapOutput, + new CatalogBootstrap( + catalogVersion, + 0, + OffsetDateTime.now(), + catalogDataFileDescriptor.fileLocation() + ) + ); + boostrapOutput.flush(); + Assert.isPremiseValid( + catalogBootstrapStorageRecord.fileLocation().recordLength() == CatalogBootstrap.BOOTSTRAP_RECORD_SIZE, + "Unexpected bootstrap record size: " + catalogBootstrapStorageRecord.fileLocation().recordLength() + ); + zipOutputStream.closeEntry(); + } + + /** + * Updates the progress of the backup task based on the number of processed records. + * + * @param processedRecords the records processed so far + * @param totalRecords the total number of records to process + * @return the updated task status + */ + @Interruptible + @Nonnull + private TaskStatus getUpdateProgress(int processedRecords, int totalRecords) { + return getStatus().updateProgress((int) (((float) processedRecords / (float) totalRecords) * 100.0)); + } + + /** + * Collects all entity collection services and calculates total record count to backup. + */ + @Nonnull + private ServicesAndStatistics getServicesAndStatistics( + long catalogVersion, + @Nullable OffsetDateTime thePastMoment, + boolean theIncludingWAL, + @Nonnull CatalogOffsetIndexStoragePartPersistenceService catalogPersistenceService, + @Nonnull CatalogHeader catalogHeader, + @Nonnull Closeables closeables + ) throws IOException { + int totalRecords = 0; + final Map entityCollectionPersistenceServices = new HashMap<>(); + final int catalogServiceRecordCount = catalogPersistenceService.countStorageParts(catalogVersion); + totalRecords += catalogServiceRecordCount; + + for (CollectionFileReference entityTypeFileIndex : catalogHeader.getEntityTypeFileIndexes()) { + final DefaultEntityCollectionPersistenceService entityCollectionPersistenceService = thePastMoment == null ? + this.catalogPersistenceService.getOrCreateEntityCollectionPersistenceService( + catalogVersion, entityTypeFileIndex.entityType(), entityTypeFileIndex.entityTypePrimaryKey() + ) : + closeables.add( + this.catalogPersistenceService.createEntityCollectionPersistenceService(catalogPersistenceService.getStoragePart(catalogVersion, 1, EntityCollectionHeader.class)) + ); + final ServiceWithStatistics serviceStats = new ServiceWithStatistics( + entityCollectionPersistenceService, + entityCollectionPersistenceService.getStoragePartPersistenceService().countStorageParts(catalogVersion) + ); + entityCollectionPersistenceServices.put( + entityTypeFileIndex.entityTypePrimaryKey(), + serviceStats + ); + totalRecords += serviceStats.totalRecordCount(); + } + + final Path[] walFiles; + if (theIncludingWAL) { + try (final Stream walFileStream = Files.list(this.catalogPersistenceService.getCatalogStoragePath())) { + walFiles = walFileStream + .filter(it -> it.getFileName().toString().endsWith(WAL_FILE_SUFFIX)) + .toArray(Path[]::new); + } + } else { + walFiles = new Path[0]; + } + + return new ServicesAndStatistics( + totalRecords + walFiles.length, + catalogServiceRecordCount, + entityCollectionPersistenceServices, + walFiles + ); + } + + /** + * Record contains total record count and index of services. + */ + private record ServicesAndStatistics( + int totalRecords, + int catalogServiceRecordCount, + @Nonnull Map serviceIndex, + @Nonnull Path[] walFiles + ) { + + @Nonnull + public DefaultEntityCollectionPersistenceService getServiceByEntityTypePrimaryKey(int entityTypePrimaryKey) { + return ofNullable(serviceIndex.get(entityTypePrimaryKey)).map(ServiceWithStatistics::service).orElseThrow(); + } + + public int getServiceRecordCount(int entityTypePrimaryKey) { + return ofNullable(serviceIndex.get(entityTypePrimaryKey)).map(ServiceWithStatistics::totalRecordCount).orElseThrow(); + } + + } + + /** + * Record contains reference to service along with total record count it manages. + */ + private record ServiceWithStatistics( + @Nonnull DefaultEntityCollectionPersistenceService service, + int totalRecordCount + ) { + } + + /** + * Settings for this instance of backup task. + * + * @param pastMoment the date and time to create SNAPSHOT backup from + * @param includingWAL whether to include WAL files in the backup + */ + public record BackupSettings( + @Nullable OffsetDateTime pastMoment, + boolean includingWAL + ) implements Serializable { + } + + /** + * Closeable objects aggregator. + */ + private static class Closeables implements AutoCloseable { + private final List closeables = new LinkedList<>(); + + /** + * Adds a new closeable to the list of closeables that are closed when this object is closed. + * + * @param item the closeable to add + * @param the type of the closeable + * @return the same closeable + */ + @Nonnull + public T add(@Nonnull T item) { + this.closeables.add(item); + return item; + } + + @Override + public void close() { + closeables.forEach(it -> { + try { + it.close(); + } catch (Exception e) { + log.error("Failed to close resource!", e); + } + }); + } + } + +} diff --git a/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/task/RestoreTask.java b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/task/RestoreTask.java new file mode 100644 index 000000000..da106b203 --- /dev/null +++ b/evita_store/evita_store_server/src/main/java/io/evitadb/store/catalog/task/RestoreTask.java @@ -0,0 +1,217 @@ +/* + * + * _ _ ____ ____ + * _____ _(_) |_ __ _| _ \| __ ) + * / _ \ \ / / | __/ _` | | | | _ \ + * | __/\ V /| | || (_| | |_| | |_) | + * \___| \_/ |_|\__\__,_|____/|____/ + * + * Copyright (c) 2024 + * + * Licensed under the Business Source License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://github.com/FgForrest/evitaDB/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.evitadb.store.catalog.task; + +import io.evitadb.api.configuration.StorageOptions; +import io.evitadb.api.task.TaskStatus; +import io.evitadb.core.async.ClientRunnableTask; +import io.evitadb.core.async.Interruptible; +import io.evitadb.exception.UnexpectedIOException; +import io.evitadb.store.catalog.DefaultCatalogPersistenceService; +import io.evitadb.store.catalog.task.RestoreTask.RestoreSettings; +import io.evitadb.store.spi.CatalogPersistenceService; +import io.evitadb.utils.Assert; +import io.evitadb.utils.CountingInputStream; +import io.evitadb.utils.UUIDUtil; + +import javax.annotation.Nonnull; +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.Serializable; +import java.nio.ByteBuffer; +import java.nio.channels.FileChannel; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.nio.file.StandardOpenOption; +import java.util.regex.Matcher; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +/** + * This task is used to restore a catalog from a ZIP file. + * + * @author Jan Novotný (novotny@fg.cz), FG Forrest a.s. (c) 2024 + */ +public class RestoreTask extends ClientRunnableTask { + private final StorageOptions storageOptions; + + /** + * Returns the file name with renaming the files that contain original catalog name. + * + * @param entryName relative path in the ZIP file + * @param originalCatalogName original catalog name + * @param catalogName the new catalog name + * @return the file name with renaming + */ + @Nonnull + private static String getFileNameWithCatalogRename( + @Nonnull String entryName, + @Nonnull String originalCatalogName, + @Nonnull String catalogName + ) { + final String fileName = entryName.substring(originalCatalogName.length() + 1); + if (entryName.endsWith(CatalogPersistenceService.BOOT_FILE_SUFFIX)) { + return CatalogPersistenceService.getCatalogBootstrapFileName(catalogName); + } else if (entryName.endsWith(CatalogPersistenceService.CATALOG_FILE_SUFFIX)) { + final Matcher matcher = CatalogPersistenceService.getCatalogDataStoreFileNamePattern(originalCatalogName) + .matcher(fileName); + Assert.isPremiseValid( + matcher.matches(), + "Invalid file name for catalog date file!" + ); + return CatalogPersistenceService.getCatalogDataStoreFileName( + catalogName, Integer.parseInt(matcher.group(1)) + ); + } else if (entryName.endsWith(CatalogPersistenceService.WAL_FILE_SUFFIX)) { + final int walIndex = CatalogPersistenceService.getIndexFromWalFileName(originalCatalogName, fileName); + return CatalogPersistenceService.getWalFileName(catalogName, walIndex); + } else { + return fileName; + } + } + + public RestoreTask( + @Nonnull String catalogName, + @Nonnull InputStream inputStream, + long totalSizeInBytes, + @Nonnull StorageOptions storageOptions + ) { + super( + catalogName, + "Restore catalog `" + catalogName + "`", + new RestoreSettings(inputStream, storageOptions.exportDirectory(), totalSizeInBytes), + task -> ((RestoreTask) task).doRestore() + ); + this.storageOptions = storageOptions; + } + + /** + * Restores the catalog from the input stream. + */ + private void doRestore() { + // unzip contents of the stream + final TaskStatus status = getStatus(); + final String catalogName = status.catalogName(); + final Path inputFile = this.storageOptions.exportDirectory().resolve(status.settings().fileName()); + try ( + final CountingInputStream cis = new CountingInputStream( + new BufferedInputStream( + Files.newInputStream(inputFile, StandardOpenOption.READ, StandardOpenOption.DELETE_ON_CLOSE) + ) + ); + final ZipInputStream zipInputStream = new ZipInputStream(cis) + ) { + final Path storagePath = DefaultCatalogPersistenceService.pathForCatalog(catalogName, this.storageOptions.storageDirectoryOrDefault()); + DefaultCatalogPersistenceService.verifyDirectory(storagePath, true); + + ZipEntry entry = zipInputStream.getNextEntry(); + Assert.isPremiseValid(entry.isDirectory(), "First entry in the zip file must be a directory!"); + // last character is always a slash + final String directoryName = entry.getName().substring(0, entry.getName().length() - 1); + // allocate buffer for reading + final ByteBuffer buffer = ByteBuffer.allocate(16_384); + while ((entry = zipInputStream.getNextEntry()) != null) { + // get the name of the file in the zip and create the file in the storage + final String fileName = getFileNameWithCatalogRename(entry.getName(), directoryName, catalogName); + final Path entryPath = storagePath.resolve(fileName); + try (final FileChannel fileChannel = FileChannel.open(entryPath, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE)) { + // read the file from the zip and write it to the storage + int bytesRead; + while ((bytesRead = zipInputStream.read(buffer.array())) != -1) { + readBlock(cis, fileChannel, buffer, bytesRead); + } + } + } + // write file marking the catalog as restored + Assert.isPremiseValid( + storagePath.resolve(CatalogPersistenceService.RESTORE_FLAG).toFile().createNewFile(), + () -> new UnexpectedIOException( + "Unexpected exception occurred while restoring catalog " + catalogName + ": unable to create restore flag file!", + "Unexpected exception occurred while restoring catalog - unable to create restore flag file!" + ) + ); + } catch (IOException e) { + throw new UnexpectedIOException( + "Unexpected exception occurred while restoring catalog: " + e.getMessage(), + "Unexpected exception occurred while restoring catalog!", + e + ); + } + } + + /** + * Reads block of data from the input stream and writes it to the file channel. + */ + @Interruptible + private void readBlock( + @Nonnull CountingInputStream cis, + @Nonnull FileChannel fileChannel, + @Nonnull ByteBuffer buffer, + int bytesRead + ) throws IOException { + buffer.limit(bytesRead); + while (buffer.hasRemaining()) { + fileChannel.write(buffer); + } + buffer.clear(); + updateProgress((int) ((cis.getCount() * 100L) / getStatus().settings().totalSizeInBytes())); + } + + /** + * Settings for this instance of restore task. + * + * @param fileName name of the file to be restored + * @param totalSizeInBytes total size of the file in bytes + */ + public record RestoreSettings( + @Nonnull String fileName, + long totalSizeInBytes + ) implements Serializable { + + public RestoreSettings(@Nonnull InputStream inputStream, @Nonnull Path export, long totalSizeInBytes) { + this(UUIDUtil.randomUUID() + ".zip", totalSizeInBytes); + try { + // todo jno avoid copying the file to the disk when it's already in place + final long bytesCopied = Files.copy( + inputStream, export.resolve(fileName()), + StandardCopyOption.REPLACE_EXISTING + ); + Assert.isPremiseValid( + bytesCopied == totalSizeInBytes, + "Unexpected number of bytes copied (" + bytesCopied + "B instead of " + totalSizeInBytes + "B)!" + ); + } catch (IOException e) { + throw new UnexpectedIOException( + "Unexpected exception occurred while storing catalog file for restoration: " + e.getMessage(), + "Unexpected exception occurred while storing catalog file for restoration!", + e + ); + } + } + + } + +} diff --git a/evita_store/evita_store_server/src/main/java/io/evitadb/store/wal/TransactionalStoragePartPersistenceService.java b/evita_store/evita_store_server/src/main/java/io/evitadb/store/wal/TransactionalStoragePartPersistenceService.java index e50694f44..b2efebdf7 100644 --- a/evita_store/evita_store_server/src/main/java/io/evitadb/store/wal/TransactionalStoragePartPersistenceService.java +++ b/evita_store/evita_store_server/src/main/java/io/evitadb/store/wal/TransactionalStoragePartPersistenceService.java @@ -55,6 +55,7 @@ import java.util.Set; import java.util.UUID; import java.util.function.Function; +import java.util.function.IntConsumer; import java.util.stream.Stream; import static java.util.Optional.ofNullable; @@ -198,6 +199,13 @@ public Stream getEntryStream(@Nonnull Class contai ); } + @Override + public int countStorageParts(long catalogVersion) { + // this is going to be slow, but it's not used in production scenarios + return this.offsetIndex.count(catalogVersion) + this.delegate.countStorageParts(catalogVersion) - + this.removedStoragePartKeys.size(); + } + @Override public int countStorageParts(long catalogVersion, @Nonnull Class containerType) { final byte recType = offsetIndex.getIdForRecordType(containerType); @@ -241,7 +249,9 @@ public PersistentStorageDescriptor flush(long catalogVersion) { @Nonnull @Override public PersistentStorageDescriptor copySnapshotTo( - long catalogVersion, @Nonnull OutputStream outputStream, + long catalogVersion, + @Nonnull OutputStream outputStream, + @Nullable IntConsumer progressUpdater, @Nullable StoragePart... updatedStorageParts ) { throw new UnsupportedOperationException(