Interface AbstractIndexFieldData.PerValueEstimator

All Known Implementing Classes:
PagedBytesIndexFieldData.PagedBytesEstimator
Enclosing class:
AbstractIndexFieldData<FD extends AtomicFieldData>

public static interface AbstractIndexFieldData.PerValueEstimator
A PerValueEstimator is a sub-class that can be used to estimate the memory overhead for loading the data. Each field data implementation should implement its own PerValueEstimator if it intends to take advantage of the CircuitBreaker.

Note that the .beforeLoad(...) and .afterLoad(...) methods must be manually called.

  • Method Summary

    Modifier and Type Method Description
    void afterLoad​(org.apache.lucene.index.TermsEnum termsEnum, long actualUsed)
    Possibly adjust a circuit breaker after field data has been loaded, now that the actual amount of memory used by the field data is known
    org.apache.lucene.index.TermsEnum beforeLoad​(org.apache.lucene.index.Terms terms)
    Execute any pre-loading estimations for the terms.
    long bytesPerValue​(org.apache.lucene.util.BytesRef term)  
  • Method Details

    • bytesPerValue

      long bytesPerValue​(org.apache.lucene.util.BytesRef term)
      Returns:
      the number of bytes for the given term
    • beforeLoad

      org.apache.lucene.index.TermsEnum beforeLoad​(org.apache.lucene.index.Terms terms) throws java.io.IOException
      Execute any pre-loading estimations for the terms. May also optionally wrap a TermsEnum in a RamAccountingTermsEnum which will estimate the memory on a per-term basis.
      Parameters:
      terms - terms to be estimated
      Returns:
      A TermsEnum for the given terms
      Throws:
      java.io.IOException
    • afterLoad

      void afterLoad​(org.apache.lucene.index.TermsEnum termsEnum, long actualUsed)
      Possibly adjust a circuit breaker after field data has been loaded, now that the actual amount of memory used by the field data is known
      Parameters:
      termsEnum - terms that were loaded
      actualUsed - actual field data memory usage