Class RamAccountingTermsEnum
- java.lang.Object
-
- org.apache.lucene.index.TermsEnum
-
- org.apache.lucene.index.FilteredTermsEnum
-
- org.elasticsearch.index.fielddata.RamAccountingTermsEnum
-
- All Implemented Interfaces:
BytesRefIterator
public final class RamAccountingTermsEnum extends FilteredTermsEnum
TermsEnumthat takes a CircuitBreaker, increasing the breaker every time.next(...)is called. Proxies all methods to the original TermsEnum otherwise.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.index.FilteredTermsEnum
FilteredTermsEnum.AcceptStatus
-
Nested classes/interfaces inherited from class org.apache.lucene.index.TermsEnum
TermsEnum.SeekStatus
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.index.FilteredTermsEnum
actualTerm, tenum
-
-
Constructor Summary
Constructors Constructor Description RamAccountingTermsEnum(TermsEnum termsEnum, CircuitBreaker breaker, AbstractIndexFieldData.PerValueEstimator estimator, String fieldName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FilteredTermsEnum.AcceptStatusaccept(BytesRef term)Always accept the term.voidflush()Flush theflushBufferto the breaker, incrementing the total bytes and resetting the buffer.longgetTotalBytes()BytesRefnext()Proxy to the original next() call, but estimates the overhead of loading the next term.-
Methods inherited from class org.apache.lucene.index.FilteredTermsEnum
attributes, docFreq, impacts, nextSeekTerm, ord, postings, seekCeil, seekExact, seekExact, seekExact, setInitialSeekTerm, term, termState, totalTermFreq
-
-
-
-
Constructor Detail
-
RamAccountingTermsEnum
public RamAccountingTermsEnum(TermsEnum termsEnum, CircuitBreaker breaker, AbstractIndexFieldData.PerValueEstimator estimator, String fieldName)
-
-
Method Detail
-
accept
protected FilteredTermsEnum.AcceptStatus accept(BytesRef term) throws IOException
Always accept the term.- Specified by:
acceptin classFilteredTermsEnum- Throws:
IOException
-
flush
public void flush()
Flush theflushBufferto the breaker, incrementing the total bytes and resetting the buffer.
-
next
public BytesRef next() throws IOException
Proxy to the original next() call, but estimates the overhead of loading the next term.- Specified by:
nextin interfaceBytesRefIterator- Overrides:
nextin classFilteredTermsEnum- Returns:
- the next
BytesRefin the iterator ornullif the end of the iterator is reached. - Throws:
IOException- If there is a low-level I/O error.
-
getTotalBytes
public long getTotalBytes()
- Returns:
- the total number of bytes that have been aggregated
-
-