public class FileSizeRotationPolicy extends Object implements 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);
Modifier and Type | Class and Description |
---|---|
static class |
FileSizeRotationPolicy.Units |
Constructor and Description |
---|
FileSizeRotationPolicy(float count,
FileSizeRotationPolicy.Units units) |
Modifier and Type | Method and Description |
---|---|
long |
getMaxBytes() |
boolean |
mark(long offset)
Check if a file rotation should be performed based on the offset at which file is being written.
|
boolean |
mark(TridentTuple tuple,
long offset)
Called for every tuple the HdfsBolt executes.
|
void |
reset()
Called after the HdfsBolt rotates a file.
|
void |
start()
Start the policy.
|
public FileSizeRotationPolicy(float count, FileSizeRotationPolicy.Units units)
public boolean mark(TridentTuple tuple, long offset)
FileRotationPolicy
Called for every tuple the HdfsBolt executes.
mark
in interface FileRotationPolicy
tuple
- The tuple executed.offset
- current offset of file being writtenpublic boolean mark(long offset)
FileRotationPolicy
Check if a file rotation should be performed based on the offset at which file is being written.
mark
in interface FileRotationPolicy
offset
- the current offset of file being writtenpublic void reset()
FileRotationPolicy
Called after the HdfsBolt rotates a file.
reset
in interface FileRotationPolicy
public void start()
FileRotationPolicy
Start the policy. Useful in case of policies like timed rotation where the timer can be started.
start
in interface FileRotationPolicy
public long getMaxBytes()
Copyright © 2019 The Apache Software Foundation. All rights reserved.