-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a temporary (squashed) commit of #32743 till ed4feb6, to be reverted and replaced by the final version of this PR
- Loading branch information
Hendrik Muhs
authored
Aug 10, 2018
1 parent
fd708ed
commit 1a00847
Showing
24 changed files
with
729 additions
and
425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexing/Iteration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.core.indexing; | ||
|
||
import org.elasticsearch.action.index.IndexRequest; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Result object to hold the result of 1 iteration of iterative indexing. | ||
* Acts as an interface between the implementation and the generic indexer. | ||
*/ | ||
public class Iteration<JobPosition> { | ||
|
||
private final boolean isDone; | ||
private final JobPosition position; | ||
private final List<IndexRequest> toIndex; | ||
|
||
/** | ||
* Constructor for the result of 1 iteration. | ||
* | ||
* @param toIndex the list of requests to be indexed | ||
* @param position the extracted, persistable position of the job required for the search phase | ||
* @param isDone true if source is exhausted and job should go to sleep | ||
* | ||
* Note: toIndex.empty() != isDone due to possible filtering in the specific implementation | ||
*/ | ||
public Iteration(List<IndexRequest> toIndex, JobPosition position, boolean isDone) { | ||
this.toIndex = toIndex; | ||
this.position = position; | ||
this.isDone = isDone; | ||
} | ||
|
||
/** | ||
* Returns true if this indexing iteration is done and job should go into sleep mode. | ||
*/ | ||
public boolean isDone() { | ||
return isDone; | ||
} | ||
|
||
/** | ||
* Return the position of the job, a generic to be passed to the next query construction. | ||
* | ||
* @return the position | ||
*/ | ||
public JobPosition getPosition() { | ||
return position; | ||
} | ||
|
||
/** | ||
* List of requests to be passed to bulk indexing. | ||
* | ||
* @return List of index requests. | ||
*/ | ||
public List<IndexRequest> getToIndex() { | ||
return toIndex; | ||
} | ||
} |
Oops, something went wrong.