Class FileSizeRotationPolicy
java.lang.Object
org.apache.storm.hdfs.trident.rotation.FileSizeRotationPolicy
- All Implemented Interfaces:
Serializable,FileRotationPolicy
File rotation policy that will rotate files when a certain
file size is reached.
For example:
// rotate when files reach 5MB
FileSizeRotationPolicy policy =
new FileSizeRotationPolicy(5.0, Units.MB);
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongbooleanmark(long offset) Check if a file rotation should be performed based on the offset at which file is being written.booleanmark(TridentTuple tuple, long offset) Called for every tuple the HdfsBolt executes.voidreset()Called after the HdfsBolt rotates a file.voidstart()Start the policy.
-
Constructor Details
-
FileSizeRotationPolicy
-
-
Method Details
-
mark
Description copied from interface:FileRotationPolicyCalled for every tuple the HdfsBolt executes.- Specified by:
markin interfaceFileRotationPolicy- Parameters:
tuple- The tuple executed.offset- current offset of file being written- Returns:
- true if a file rotation should be performed
-
mark
public boolean mark(long offset) Description copied from interface:FileRotationPolicyCheck if a file rotation should be performed based on the offset at which file is being written.- Specified by:
markin interfaceFileRotationPolicy- Parameters:
offset- the current offset of file being written- Returns:
- true if a file rotation should be performed.
-
reset
public void reset()Description copied from interface:FileRotationPolicyCalled after the HdfsBolt rotates a file.- Specified by:
resetin interfaceFileRotationPolicy
-
start
public void start()Description copied from interface:FileRotationPolicyStart the policy. Useful in case of policies like timed rotation where the timer can be started.- Specified by:
startin interfaceFileRotationPolicy
-
getMaxBytes
public long getMaxBytes()
-