align with es221

This commit is contained in:
Jörg Prante 2021-04-20 10:29:40 +02:00
parent 46487a691d
commit 6af56268aa
7 changed files with 30 additions and 66 deletions

View file

@ -4,10 +4,13 @@ import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings;
import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public interface BasicClient extends Closeable {
void putClusterSetting(String key, Object value, long timeout, TimeUnit timeUnit) throws IOException;
/**
* Set an Elasticsearch client to extend from it. May be null for TransportClient.
* @param client the Elasticsearch client
@ -59,4 +62,6 @@ public interface BasicClient extends Closeable {
long getSearchableDocs(IndexDefinition indexDefinition);
boolean isIndexExists(IndexDefinition indexDefinition);
ScheduledThreadPoolExecutor getScheduler();
}

View file

@ -10,12 +10,6 @@ import java.util.concurrent.TimeUnit;
public interface BulkClient extends BasicClient, Flushable {
/**
* Get bulk control.
* @return the bulk control
*/
BulkController getBulkController();
/**
* Create a new index.
* @param indexDefinition the index definition
@ -42,8 +36,8 @@ public interface BulkClient extends BasicClient, Flushable {
* Add index request. Each request will be added to a queue for bulking requests.
* Submitting request will be done when limits are exceeded.
*
* @param indexDefinition the index definition
* @param id the id
* @param indexDefinition the index definition
* @param id the id
* @param create true if document must be created
* @param source the source
* @return this
@ -155,4 +149,5 @@ public interface BulkClient extends BasicClient, Flushable {
*/
void flushIndex(IndexDefinition indexDefinition);
BulkProcessor getBulkController();
}

View file

@ -1,36 +0,0 @@
package org.xbib.elx.api;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.common.settings.Settings;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public interface BulkController extends Closeable, Flushable {
void init(Settings settings);
void inactivate();
BulkProcessor getBulkProcessor();
BulkMetric getBulkMetric();
Throwable getLastBulkError();
void startBulkMode(IndexDefinition indexDefinition) throws IOException;
void bulkIndex(IndexRequest indexRequest);
void bulkDelete(DeleteRequest deleteRequest);
void bulkUpdate(UpdateRequest updateRequest);
boolean waitForBulkResponses(long timeout, TimeUnit timeUnit);
void stopBulkMode(IndexDefinition indexDefinition) throws IOException;
}

View file

@ -2,11 +2,12 @@ package org.xbib.elx.api;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import java.io.Closeable;
/**
* A bulk listener for following executions of bulk operations.
*/
public interface BulkListener {
public interface BulkListener extends Closeable {
/**
* Callback before the bulk is executed.

View file

@ -1,6 +1,7 @@
package org.xbib.elx.api;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.xbib.metrics.api.Count;
import org.xbib.metrics.api.Metered;
@ -8,8 +9,6 @@ import java.io.Closeable;
public interface BulkMetric extends Closeable {
void init(Settings settings);
void markTotalIngest(long n);
Metered getTotalIngest();
@ -31,4 +30,6 @@ public interface BulkMetric extends Closeable {
void start();
void stop();
void recalculate(BulkRequest request, BulkResponse response);
}

View file

@ -4,21 +4,30 @@ import org.elasticsearch.action.DocWriteRequest;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public interface BulkProcessor extends Closeable, Flushable {
void setBulkActions(int bulkActions);
void setEnabled(boolean enabled);
int getBulkActions();
void startBulkMode(IndexDefinition indexDefinition) throws IOException;
void setBulkSize(long bulkSize);
void stopBulkMode(IndexDefinition indexDefinition) throws IOException;
long getBulkSize();
void setMaxBulkActions(int bulkActions);
BulkProcessor add(DocWriteRequest<?> request);
int getMaxBulkActions();
boolean awaitFlush(long timeout, TimeUnit unit) throws InterruptedException;
void setMaxBulkVolume(long bulkSize);
boolean awaitClose(long timeout, TimeUnit unit) throws InterruptedException;
long getMaxBulkVolume();
void add(DocWriteRequest<?> request);
boolean waitForBulkResponses(long timeout, TimeUnit unit);
BulkMetric getBulkMetric();
Throwable getLastBulkError();
}

View file

@ -1,11 +0,0 @@
package org.xbib.elx.api;
import org.elasticsearch.action.bulk.BulkRequest;
import java.util.concurrent.TimeUnit;
public interface BulkRequestHandler {
void execute(BulkRequest bulkRequest, long executionId);
boolean close(long timeout, TimeUnit unit) throws InterruptedException;
}