|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object datafu.hourglass.fs.PathUtils
public class PathUtils
A collection of utility methods for dealing with files and paths.
Field Summary | |
---|---|
static java.text.SimpleDateFormat |
datedPathFormat
|
static java.text.SimpleDateFormat |
nestedDatedPathFormat
|
static org.apache.hadoop.fs.PathFilter |
nonHiddenPathFilter
Filters out paths starting with "." and "_". |
static java.util.TimeZone |
timeZone
|
Constructor Summary | |
---|---|
PathUtils()
|
Method Summary | |
---|---|
static long |
countBytes(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
Sums the size of all files listed under a given path. |
static java.util.List<DatePath> |
findDatedPaths(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
List all paths matching the "yyyyMMdd" format under a given path. |
static java.util.List<DatePath> |
findNestedDatedPaths(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path input)
List all paths matching the "yyyy/MM/dd" format under a given path. |
static java.util.Date |
getDateForDatedPath(org.apache.hadoop.fs.Path path)
Gets the date for a path in the "yyyyMMdd" format. |
static java.util.Date |
getDateForNestedDatedPath(org.apache.hadoop.fs.Path path)
Gets the date for a path in the "yyyy/MM/dd" format. |
static org.apache.hadoop.fs.Path |
getNestedPathRoot(org.apache.hadoop.fs.Path path)
Gets the root path for a path in the "yyyy/MM/dd" format. |
static org.apache.avro.Schema |
getSchemaFromFile(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
Gets the schema from a given Avro data file. |
static org.apache.avro.Schema |
getSchemaFromPath(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
Gets the schema for the first Avro file under the given path. |
static void |
keepLatestDatedPaths(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
int retentionCount)
Delete all but the last N days of paths matching the "yyyyMMdd" format. |
static void |
keepLatestNestedDatedPaths(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
int retentionCount)
Delete all but the last N days of paths matching the "yyyy/MM/dd" format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.TimeZone timeZone
public static final java.text.SimpleDateFormat datedPathFormat
public static final java.text.SimpleDateFormat nestedDatedPathFormat
public static final org.apache.hadoop.fs.PathFilter nonHiddenPathFilter
Constructor Detail |
---|
public PathUtils()
Method Detail |
---|
public static void keepLatestDatedPaths(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, int retentionCount) throws java.io.IOException
fs
- path
- retentionCount
-
java.io.IOException
public static void keepLatestNestedDatedPaths(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, int retentionCount) throws java.io.IOException
fs
- path
- retentionCount
-
java.io.IOException
public static java.util.List<DatePath> findNestedDatedPaths(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path input) throws java.io.IOException
fs
- file systeminput
- path to search under
java.io.IOException
public static java.util.List<DatePath> findDatedPaths(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) throws java.io.IOException
fs
- file systempath
- path to search under
java.io.IOException
public static org.apache.avro.Schema getSchemaFromFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) throws java.io.IOException
fs
- path
-
java.io.IOException
public static org.apache.avro.Schema getSchemaFromPath(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) throws java.io.IOException
path
- path to fetch schema for
java.io.IOException
public static long countBytes(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) throws java.io.IOException
fs
- file systempath
- path to count bytes for
java.io.IOException
public static java.util.Date getDateForDatedPath(org.apache.hadoop.fs.Path path)
path
- path to check
public static java.util.Date getDateForNestedDatedPath(org.apache.hadoop.fs.Path path)
path
- path to check
public static org.apache.hadoop.fs.Path getNestedPathRoot(org.apache.hadoop.fs.Path path)
path
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |