Package cz.o2.proxima.direct.io.bulkfs
Interface NamingConvention
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
DefaultNamingConvention
@Internal public interface NamingConvention extends java.io.Serializable
Interface wrapping generic convention for naming files.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static NamingConventiondefaultConvention(java.time.Duration rollTimePeriod, java.lang.String prefix, java.lang.String suffix)booleanisInRange(java.lang.String name, long minTs, long maxTs)Validate that the given name belongs to given time range.java.lang.StringnameOf(long ts)Convert given timestamp to string representing atomic time range of this naming convention.Pair<java.lang.Long,java.lang.Long>parseMinMaxTimestamp(java.lang.String name)Parse min and max timestamp from given string.static NamingConventionprefixed(java.lang.String prefix, NamingConvention parent)Create aNamingConventionthat adds prefix to each generated name of parent convention.java.util.Collection<java.lang.String>prefixesOf(long minTs, long maxTs)Convert given time range to prefixes, at least one of which must allPathsin given time range have.
-
-
-
Method Detail
-
defaultConvention
static NamingConvention defaultConvention(java.time.Duration rollTimePeriod, java.lang.String prefix, java.lang.String suffix)
- Parameters:
rollTimePeriod- time rolling interval in milliseconds.prefix- prefix of all names generatedsuffix- suffix of filenames- Returns:
- default naming convention with given settings
-
prefixed
static NamingConvention prefixed(java.lang.String prefix, NamingConvention parent)
Create aNamingConventionthat adds prefix to each generated name of parent convention.- Parameters:
prefix- prefix to be added to generated namesparent- the parent convention that generates names- Returns:
- prefixed
NamingConvention
-
nameOf
java.lang.String nameOf(long ts)
Convert given timestamp to string representing atomic time range of this naming convention.- Parameters:
ts- timestamp to create name for- Returns:
- String representation of (prefixable) name representing time range
-
prefixesOf
java.util.Collection<java.lang.String> prefixesOf(long minTs, long maxTs)Convert given time range to prefixes, at least one of which must allPathsin given time range have.- Parameters:
minTs- minimal timestamp (inclusive)maxTs- maximal timestamp (exclusive)- Returns:
- String representation of name prefix
-
isInRange
boolean isInRange(java.lang.String name, long minTs, long maxTs)Validate that the given name belongs to given time range.- Parameters:
name- name of thePathminTs- minimal timestamp (inclusive)maxTs- maximal timestamp (exclusive)- Returns:
trueif the name belongs to given time rangefalseotherwise
-
-