Package org.nuxeo.ecm.core.work
Class BaseOverflowRecordFilter
- java.lang.Object
-
- org.nuxeo.ecm.core.work.BaseOverflowRecordFilter
-
- All Implemented Interfaces:
RecordFilter
- Direct Known Subclasses:
KeyValueStoreOverflowRecordFilter,TransientStoreOverflowRecordFilter
public abstract class BaseOverflowRecordFilter extends Object implements RecordFilter
Base for filter that saves long record's value in an alternate storage. The record is then marked with an internal flag and contains an empty value.- Since:
- 11.1
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_PREFIXstatic StringDEFAULT_STORE_NAMEstatic StringDEFAULT_STORE_TTLstatic intDEFAULT_THRESHOLD_SIZEprotected Stringprefixstatic StringPREFIX_OPTIONstatic StringSTORE_NAME_OPTIONstatic StringSTORE_TTL_OPTIONprotected StringstoreNameprotected DurationstoreTTLstatic StringTHRESHOLD_SIZE_OPTIONprotected intthresholdSize
-
Constructor Summary
Constructors Constructor Description BaseOverflowRecordFilter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description RecordafterRead(Record record, LogOffset offset)Called after reading a record.RecordbeforeAppend(Record record)Called before appending a record to a stream.protected abstract byte[]fetchValue(String key)Fetches a value previously stored bystoreValue(String, byte[])StringgetPrefix()protected StringgetPrefixedKey(String recordKey)StringgetStoreName()DurationgetStoreTTL()intgetThresholdSize()protected StringgetUniqRecordKey(Record record)voidinit(Map<String,String> options)Initialiaze the filter.protected intparseIntOrDefault(String valueAsString, int defaultValue)voidsetPrefix(String prefix)voidsetStoreName(String storeName)voidsetStoreTTL(Duration storeTTL)voidsetThresholdSize(int thresholdSize)protected abstract voidstoreValue(String key, byte[] data)Sets the value associated to the key.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.lib.stream.computation.RecordFilter
afterAppend
-
-
-
-
Field Detail
-
STORE_NAME_OPTION
public static final String STORE_NAME_OPTION
- See Also:
- Constant Field Values
-
DEFAULT_STORE_NAME
public static final String DEFAULT_STORE_NAME
- See Also:
- Constant Field Values
-
STORE_TTL_OPTION
public static final String STORE_TTL_OPTION
- See Also:
- Constant Field Values
-
DEFAULT_STORE_TTL
public static final String DEFAULT_STORE_TTL
- See Also:
- Constant Field Values
-
THRESHOLD_SIZE_OPTION
public static final String THRESHOLD_SIZE_OPTION
- See Also:
- Constant Field Values
-
DEFAULT_THRESHOLD_SIZE
public static final int DEFAULT_THRESHOLD_SIZE
- See Also:
- Constant Field Values
-
PREFIX_OPTION
public static final String PREFIX_OPTION
- See Also:
- Constant Field Values
-
DEFAULT_PREFIX
public static final String DEFAULT_PREFIX
- See Also:
- Constant Field Values
-
thresholdSize
protected int thresholdSize
-
-
Constructor Detail
-
BaseOverflowRecordFilter
public BaseOverflowRecordFilter()
-
-
Method Detail
-
storeValue
protected abstract void storeValue(String key, byte[] data)
Sets the value associated to the key.
-
fetchValue
protected abstract byte[] fetchValue(String key)
Fetches a value previously stored bystoreValue(String, byte[])- Returns:
- the value, or
nullif there is no value
-
init
public void init(Map<String,String> options)
Description copied from interface:RecordFilterInitialiaze the filter.- Specified by:
initin interfaceRecordFilter
-
parseIntOrDefault
protected int parseIntOrDefault(String valueAsString, int defaultValue)
-
beforeAppend
public Record beforeAppend(Record record)
Description copied from interface:RecordFilterCalled before appending a record to a stream. This hook enables to change the record or to skip it when returning null.- Specified by:
beforeAppendin interfaceRecordFilter- Parameters:
record- the record that will be appended to a stream
-
getUniqRecordKey
protected String getUniqRecordKey(Record record)
-
afterRead
public Record afterRead(Record record, LogOffset offset)
Description copied from interface:RecordFilterCalled after reading a record. This hook enables to change the record or to skip it when returning null.- Specified by:
afterReadin interfaceRecordFilter- Parameters:
record- the recordoffset- the offset of the record
-
getThresholdSize
public int getThresholdSize()
-
setThresholdSize
public void setThresholdSize(int thresholdSize)
-
getStoreName
public String getStoreName()
-
setStoreName
public void setStoreName(String storeName)
-
getStoreTTL
public Duration getStoreTTL()
-
setStoreTTL
public void setStoreTTL(Duration storeTTL)
-
getPrefixedKey
protected String getPrefixedKey(String recordKey)
-
-