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 SummaryFieldsModifier and TypeFieldDescriptionstatic final StorageStrategyFor directories: drwxrwxr-x (owner and group have full access, others can read and execute).static final StorageStrategyPrimary is used for temporary tables.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidapplyToFile(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.PathcreateFileAndApply(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path file) Creates passed file on appropriate file system.org.apache.hadoop.fs.PathcreatePathAndApply(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) Creates passed path on appropriate file system.org.apache.hadoop.fs.permission.FsPermissionorg.apache.hadoop.fs.permission.FsPermissiongetUmask()booleantoString()
- 
Field Details- 
DEFAULTFor 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.
- 
TEMPORARYPrimary 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
- 
isDeleteOnExitpublic boolean isDeleteOnExit()
- 
getFolderPermissionpublic org.apache.hadoop.fs.permission.FsPermission getFolderPermission()- Returns:
- folder permission after applying umask
 
- 
getFilePermissionpublic org.apache.hadoop.fs.permission.FsPermission getFilePermission()- Returns:
- file permission after applying umask
 
- 
createPathAndApplypublic 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 located
- path- 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
 
- 
createFileAndApplypublic 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 located
- file- 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
 
- 
applyToFilepublic 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 system
- file- path to file
- Throws:
- IOException- is thrown in case of problems while setting permission or adding file to delete on exit list
 
- 
toString
 
-