Package cz.o2.proxima.direct.io.bulkfs
Class DefaultNamingConvention
- java.lang.Object
-
- cz.o2.proxima.direct.io.bulkfs.DefaultNamingConvention
-
- All Implemented Interfaces:
NamingConvention
,java.io.Serializable
@Internal public class DefaultNamingConvention extends java.lang.Object implements NamingConvention
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultNamingConvention(java.time.Duration rollPeriod, java.lang.String prefix, java.lang.String suffix, Factory<java.lang.String> uuidGenerator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isInRange(java.lang.String name, long minTs, long maxTs)
Validate that the given name belongs to given time range.java.lang.String
nameOf(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.java.util.Set<java.lang.String>
prefixesOf(long startStamp, long endStamp)
Convert given time range to prefixes, at least one of which must allPaths
in given time range have.
-
-
-
Constructor Detail
-
DefaultNamingConvention
public DefaultNamingConvention(java.time.Duration rollPeriod, java.lang.String prefix, java.lang.String suffix, Factory<java.lang.String> uuidGenerator)
-
-
Method Detail
-
nameOf
public java.lang.String nameOf(long ts)
Description copied from interface:NamingConvention
Convert given timestamp to string representing atomic time range of this naming convention.- Specified by:
nameOf
in interfaceNamingConvention
- Parameters:
ts
- timestamp to create name for- Returns:
- String representation of (prefixable) name representing time range
-
prefixesOf
public java.util.Set<java.lang.String> prefixesOf(long startStamp, long endStamp)
Description copied from interface:NamingConvention
Convert given time range to prefixes, at least one of which must allPaths
in given time range have.- Specified by:
prefixesOf
in interfaceNamingConvention
- Parameters:
startStamp
- minimal timestamp (inclusive)endStamp
- maximal timestamp (exclusive)- Returns:
- String representation of name prefix
-
isInRange
public boolean isInRange(java.lang.String name, long minTs, long maxTs)
Description copied from interface:NamingConvention
Validate that the given name belongs to given time range.- Specified by:
isInRange
in interfaceNamingConvention
- Parameters:
name
- name of thePath
minTs
- minimal timestamp (inclusive)maxTs
- maximal timestamp (exclusive)- Returns:
true
if the name belongs to given time rangefalse
otherwise
-
parseMinMaxTimestamp
public Pair<java.lang.Long,java.lang.Long> parseMinMaxTimestamp(java.lang.String name)
Description copied from interface:NamingConvention
Parse min and max timestamp from given string.- Specified by:
parseMinMaxTimestamp
in interfaceNamingConvention
- Parameters:
name
- name generated by this convention- Returns:
Pair
of min and max timestamps
-
-