Skip to content

Commit

Permalink
reporter to accept observer
Browse files Browse the repository at this point in the history
  • Loading branch information
pgomulka committed Jul 3, 2024
1 parent 05ceb83 commit 825b63e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ public IndexResult index(Index index) throws IOException {
config().getMapperService(),
DocumentSizeAccumulator.EMPTY_INSTANCE
);
documentParsingReporter.onIndexingCompleted(index.parsedDoc());
ParsedDocument parsedDocument = index.parsedDoc();
DocumentSizeObserver documentSizeObserver = parsedDocument.getDocumentSizeObserver();
documentParsingReporter.onIndexingCompleted(documentSizeObserver);

return result;
}
Expand Down Expand Up @@ -149,8 +151,8 @@ public TestDocumentSizeReporter(String indexName) {
}

@Override
public void onIndexingCompleted(ParsedDocument parsedDocument) {
DocumentSizeObserver documentSizeObserver = parsedDocument.getDocumentSizeObserver();
public void onIndexingCompleted(DocumentSizeObserver documentSizeObserver) {
DocumentSizeObserver documentSizeObserver = documentSizeObserver.getDocumentSizeObserver();
COUNTER.addAndGet(documentSizeObserver.normalisedBytesParsed());
assertThat(indexName, equalTo(TEST_INDEX_NAME));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

package org.elasticsearch.plugins.internal;

import org.elasticsearch.index.mapper.ParsedDocument;

/**
* An interface to allow performing an action when parsing and indexing has been completed
*/
Expand All @@ -23,10 +21,10 @@ public interface DocumentSizeReporter {
/**
* An action to be performed upon finished indexing.
*/
default void onParsingCompleted(ParsedDocument parsedDocument) {}
default void onParsingCompleted(DocumentSizeObserver documentSizeObserver) {}

/**
* An action to be performed upon finished indexing.
*/
default void onIndexingCompleted(ParsedDocument parsedDocument) {}
default void onIndexingCompleted(DocumentSizeObserver documentSizeObserver) {}
}

0 comments on commit 825b63e

Please sign in to comment.