Package org.apache.drill.exec.store
Class StorageStrategy
java.lang.Object
org.apache.drill.exec.store.StorageStrategy
Contains list of parameters that will be used to store path / files on file system.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final StorageStrategy
For directories: drwxrwxr-x (owner and group have full access, others can read and execute).static final StorageStrategy
Primary is used for temporary tables. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyToFile
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path file) Applies storage strategy to file: sets permission and adds to file system delete on exit list if needed.org.apache.hadoop.fs.Path
createFileAndApply
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path file) Creates passed file on appropriate file system.org.apache.hadoop.fs.Path
createPathAndApply
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) Creates passed path on appropriate file system.org.apache.hadoop.fs.permission.FsPermission
org.apache.hadoop.fs.permission.FsPermission
getUmask()
boolean
toString()
-
Field Details
-
DEFAULT
For directories: drwxrwxr-x (owner and group have full access, others can read and execute). For files: -rw-rw--r-- (owner and group can read and write, others can read). Folders and files are not deleted on file system close. -
TEMPORARY
Primary is used for temporary tables. For directories: drwx------ (owner has full access, group and others have no access). For files: -rw------- (owner can read and write, group and others have no access). Folders and files are deleted on file system close.
-
-
Constructor Details
-
StorageStrategy
-
-
Method Details
-
getUmask
-
isDeleteOnExit
public boolean isDeleteOnExit() -
getFolderPermission
public org.apache.hadoop.fs.permission.FsPermission getFolderPermission()- Returns:
- folder permission after applying umask
-
getFilePermission
public org.apache.hadoop.fs.permission.FsPermission getFilePermission()- Returns:
- file permission after applying umask
-
createPathAndApply
public org.apache.hadoop.fs.Path createPathAndApply(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) throws IOException Creates passed path on appropriate file system. Before creation checks which parent directories do not exists. Applies storage strategy rules to all newly created directories. Will return first created path or null already existed. Case 1: /a/b -> already exists, attempt to create /a/b/c/d Will create path and return /a/b/c. Case 2: /a/b/c -> already exists, attempt to create /a/b/c/d Will create path and return /a/b/c/d. Case 3: /a/b/c/d -> already exists, will return null.- Parameters:
fs
- file system where file should be locatedpath
- location path- Returns:
- first created parent path or file
- Throws:
IOException
- is thrown in case of problems while creating path, setting permission or adding path to delete on exit list
-
createFileAndApply
public org.apache.hadoop.fs.Path createFileAndApply(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path file) throws IOException Creates passed file on appropriate file system. Before creation checks which parent directories do not exists. Applies storage strategy rules to all newly created directories and file. Will return first created parent path or file if no new parent paths created. Case 1: /a/b -> already exists, attempt to create /a/b/c/some_file.txt Will create file and return /a/b/c. Case 2: /a/b/c -> already exists, attempt to create /a/b/c/some_file.txt Will create file and return /a/b/c/some_file.txt. Case 3: /a/b/c/some_file.txt -> already exists, will fail.- Parameters:
fs
- file system where file should be locatedfile
- file path- Returns:
- first created parent path or file
- Throws:
IOException
- is thrown in case of problems while creating path, setting permission or adding path to delete on exit list
-
applyToFile
public void applyToFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path file) throws IOException Applies storage strategy to file: sets permission and adds to file system delete on exit list if needed.- Parameters:
fs
- file systemfile
- path to file- Throws:
IOException
- is thrown in case of problems while setting permission or adding file to delete on exit list
-
toString
-