Class RamAccountingTermsEnum
java.lang.Object
org.apache.lucene.index.TermsEnum
org.apache.lucene.index.FilteredTermsEnum
org.elasticsearch.index.fielddata.RamAccountingTermsEnum
- All Implemented Interfaces:
org.apache.lucene.util.BytesRefIterator
public final class RamAccountingTermsEnum
extends org.apache.lucene.index.FilteredTermsEnum
TermsEnum that takes a CircuitBreaker, increasing the breaker
every time .next(...) is called. Proxies all methods to the original
TermsEnum otherwise.-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Constructor Description RamAccountingTermsEnum(org.apache.lucene.index.TermsEnum termsEnum, CircuitBreaker breaker, AbstractIndexFieldData.PerValueEstimator estimator, java.lang.String fieldName) -
Method Summary
Modifier and Type Method Description protected org.apache.lucene.index.FilteredTermsEnum.AcceptStatusaccept(org.apache.lucene.util.BytesRef term)Always accept the term.voidflush()Flush theflushBufferto the breaker, incrementing the total bytes and resetting the buffer.longgetTotalBytes()org.apache.lucene.util.BytesRefnext()Proxy to the original next() call, but estimates the overhead of loading the next term.
-
Constructor Details
-
RamAccountingTermsEnum
public RamAccountingTermsEnum(org.apache.lucene.index.TermsEnum termsEnum, CircuitBreaker breaker, AbstractIndexFieldData.PerValueEstimator estimator, java.lang.String fieldName)
-
-
Method Details
-
accept
protected org.apache.lucene.index.FilteredTermsEnum.AcceptStatus accept(org.apache.lucene.util.BytesRef term) throws java.io.IOExceptionAlways accept the term.- Specified by:
acceptin classorg.apache.lucene.index.FilteredTermsEnum- Throws:
java.io.IOException
-
flush
public void flush()Flush theflushBufferto the breaker, incrementing the total bytes and resetting the buffer. -
next
public org.apache.lucene.util.BytesRef next() throws java.io.IOExceptionProxy to the original next() call, but estimates the overhead of loading the next term.- Specified by:
nextin interfaceorg.apache.lucene.util.BytesRefIterator- Overrides:
nextin classorg.apache.lucene.index.FilteredTermsEnum- Throws:
java.io.IOException
-
getTotalBytes
public long getTotalBytes()- Returns:
- the total number of bytes that have been aggregated
-