[120] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
---|
| 2 | <!--NewPage--> |
---|
| 3 | <HTML> |
---|
| 4 | <HEAD> |
---|
| 5 | <!-- Generated by javadoc (build 1.6.0_07) on Tue Sep 01 20:56:51 UTC 2009 --> |
---|
| 6 | <TITLE> |
---|
| 7 | LocalDirAllocator (Hadoop 0.20.1 API) |
---|
| 8 | </TITLE> |
---|
| 9 | |
---|
| 10 | <META NAME="date" CONTENT="2009-09-01"> |
---|
| 11 | |
---|
| 12 | <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> |
---|
| 13 | |
---|
| 14 | <SCRIPT type="text/javascript"> |
---|
| 15 | function windowTitle() |
---|
| 16 | { |
---|
| 17 | if (location.href.indexOf('is-external=true') == -1) { |
---|
| 18 | parent.document.title="LocalDirAllocator (Hadoop 0.20.1 API)"; |
---|
| 19 | } |
---|
| 20 | } |
---|
| 21 | </SCRIPT> |
---|
| 22 | <NOSCRIPT> |
---|
| 23 | </NOSCRIPT> |
---|
| 24 | |
---|
| 25 | </HEAD> |
---|
| 26 | |
---|
| 27 | <BODY BGCOLOR="white" onload="windowTitle();"> |
---|
| 28 | <HR> |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | <!-- ========= START OF TOP NAVBAR ======= --> |
---|
| 32 | <A NAME="navbar_top"><!-- --></A> |
---|
| 33 | <A HREF="#skip-navbar_top" title="Skip navigation links"></A> |
---|
| 34 | <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
---|
| 35 | <TR> |
---|
| 36 | <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
---|
| 37 | <A NAME="navbar_top_firstrow"><!-- --></A> |
---|
| 38 | <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
---|
| 39 | <TR ALIGN="center" VALIGN="top"> |
---|
| 40 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
---|
| 41 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
---|
| 42 | <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
---|
| 43 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/LocalDirAllocator.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
---|
| 44 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
---|
| 45 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
---|
| 46 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
---|
| 47 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
---|
| 48 | </TR> |
---|
| 49 | </TABLE> |
---|
| 50 | </TD> |
---|
| 51 | <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
---|
| 52 | </EM> |
---|
| 53 | </TD> |
---|
| 54 | </TR> |
---|
| 55 | |
---|
| 56 | <TR> |
---|
| 57 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
---|
| 58 | <A HREF="../../../../org/apache/hadoop/fs/InMemoryFileSystem.html" title="class in org.apache.hadoop.fs"><B>PREV CLASS</B></A> |
---|
| 59 | <A HREF="../../../../org/apache/hadoop/fs/LocalFileSystem.html" title="class in org.apache.hadoop.fs"><B>NEXT CLASS</B></A></FONT></TD> |
---|
| 60 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
---|
| 61 | <A HREF="../../../../index.html?org/apache/hadoop/fs/LocalDirAllocator.html" target="_top"><B>FRAMES</B></A> |
---|
| 62 | <A HREF="LocalDirAllocator.html" target="_top"><B>NO FRAMES</B></A> |
---|
| 63 | <SCRIPT type="text/javascript"> |
---|
| 64 | <!-- |
---|
| 65 | if(window==top) { |
---|
| 66 | document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
---|
| 67 | } |
---|
| 68 | //--> |
---|
| 69 | </SCRIPT> |
---|
| 70 | <NOSCRIPT> |
---|
| 71 | <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> |
---|
| 72 | </NOSCRIPT> |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | </FONT></TD> |
---|
| 76 | </TR> |
---|
| 77 | <TR> |
---|
| 78 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
---|
| 79 | SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> |
---|
| 80 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
---|
| 81 | DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> |
---|
| 82 | </TR> |
---|
| 83 | </TABLE> |
---|
| 84 | <A NAME="skip-navbar_top"></A> |
---|
| 85 | <!-- ========= END OF TOP NAVBAR ========= --> |
---|
| 86 | |
---|
| 87 | <HR> |
---|
| 88 | <!-- ======== START OF CLASS DATA ======== --> |
---|
| 89 | <H2> |
---|
| 90 | <FONT SIZE="-1"> |
---|
| 91 | org.apache.hadoop.fs</FONT> |
---|
| 92 | <BR> |
---|
| 93 | Class LocalDirAllocator</H2> |
---|
| 94 | <PRE> |
---|
| 95 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> |
---|
| 96 | <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.hadoop.fs.LocalDirAllocator</B> |
---|
| 97 | </PRE> |
---|
| 98 | <HR> |
---|
| 99 | <DL> |
---|
| 100 | <DT><PRE>public class <B>LocalDirAllocator</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL> |
---|
| 101 | </PRE> |
---|
| 102 | |
---|
| 103 | <P> |
---|
| 104 | An implementation of a round-robin scheme for disk allocation for creating |
---|
| 105 | files. The way it works is that it is kept track what disk was last |
---|
| 106 | allocated for a file write. For the current request, the next disk from |
---|
| 107 | the set of disks would be allocated if the free space on the disk is |
---|
| 108 | sufficient enough to accomodate the file that is being considered for |
---|
| 109 | creation. If the space requirements cannot be met, the next disk in order |
---|
| 110 | would be tried and so on till a disk is found with sufficient capacity. |
---|
| 111 | Once a disk with sufficient space is identified, a check is done to make |
---|
| 112 | sure that the disk is writable. Also, there is an API provided that doesn't |
---|
| 113 | take the space requirements into consideration but just checks whether the |
---|
| 114 | disk under consideration is writable (this should be used for cases where |
---|
| 115 | the file size is not known apriori). An API is provided to read a path that |
---|
| 116 | was created earlier. That API works by doing a scan of all the disks for the |
---|
| 117 | input pathname. |
---|
| 118 | This implementation also provides the functionality of having multiple |
---|
| 119 | allocators per JVM (one for each unique functionality or context, like |
---|
| 120 | mapred, dfs-client, etc.). It ensures that there is only one instance of |
---|
| 121 | an allocator per context per JVM. |
---|
| 122 | Note: |
---|
| 123 | 1. The contexts referred above are actually the configuration items defined |
---|
| 124 | in the Configuration class like "mapred.local.dir" (for which we want to |
---|
| 125 | control the dir allocations). The context-strings are exactly those |
---|
| 126 | configuration items. |
---|
| 127 | 2. This implementation does not take into consideration cases where |
---|
| 128 | a disk becomes read-only or goes out of space while a file is being written |
---|
| 129 | to (disks are shared between multiple processes, and so the latter situation |
---|
| 130 | is probable). |
---|
| 131 | 3. In the class implementation, "Disk" is referred to as "Dir", which |
---|
| 132 | actually points to the configured directory on the Disk which will be the |
---|
| 133 | parent for all file write/read allocations. |
---|
| 134 | <P> |
---|
| 135 | |
---|
| 136 | <P> |
---|
| 137 | <HR> |
---|
| 138 | |
---|
| 139 | <P> |
---|
| 140 | |
---|
| 141 | <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
---|
| 142 | |
---|
| 143 | <A NAME="constructor_summary"><!-- --></A> |
---|
| 144 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
| 145 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
| 146 | <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
---|
| 147 | <B>Constructor Summary</B></FONT></TH> |
---|
| 148 | </TR> |
---|
| 149 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 150 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/fs/LocalDirAllocator.html#LocalDirAllocator(java.lang.String)">LocalDirAllocator</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> contextCfgItemName)</CODE> |
---|
| 151 | |
---|
| 152 | <BR> |
---|
| 153 | Create an allocator object</TD> |
---|
| 154 | </TR> |
---|
| 155 | </TABLE> |
---|
| 156 | |
---|
| 157 | <!-- ========== METHOD SUMMARY =========== --> |
---|
| 158 | |
---|
| 159 | <A NAME="method_summary"><!-- --></A> |
---|
| 160 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
| 161 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
| 162 | <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
---|
| 163 | <B>Method Summary</B></FONT></TH> |
---|
| 164 | </TR> |
---|
| 165 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 166 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
| 167 | <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A></CODE></FONT></TD> |
---|
| 168 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/fs/LocalDirAllocator.html#createTmpFileForWrite(java.lang.String, long, org.apache.hadoop.conf.Configuration)">createTmpFileForWrite</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> pathStr, |
---|
| 169 | long size, |
---|
| 170 | <A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf)</CODE> |
---|
| 171 | |
---|
| 172 | <BR> |
---|
| 173 | Creates a temporary file in the local FS.</TD> |
---|
| 174 | </TR> |
---|
| 175 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 176 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
| 177 | <CODE> <A HREF="../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A></CODE></FONT></TD> |
---|
| 178 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/fs/LocalDirAllocator.html#getLocalPathForWrite(java.lang.String, org.apache.hadoop.conf.Configuration)">getLocalPathForWrite</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> pathStr, |
---|
| 179 | <A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf)</CODE> |
---|
| 180 | |
---|
| 181 | <BR> |
---|
| 182 | Get a path from the local FS.</TD> |
---|
| 183 | </TR> |
---|
| 184 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 185 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
| 186 | <CODE> <A HREF="../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A></CODE></FONT></TD> |
---|
| 187 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/fs/LocalDirAllocator.html#getLocalPathForWrite(java.lang.String, long, org.apache.hadoop.conf.Configuration)">getLocalPathForWrite</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> pathStr, |
---|
| 188 | long size, |
---|
| 189 | <A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf)</CODE> |
---|
| 190 | |
---|
| 191 | <BR> |
---|
| 192 | Get a path from the local FS.</TD> |
---|
| 193 | </TR> |
---|
| 194 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 195 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
| 196 | <CODE> <A HREF="../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A></CODE></FONT></TD> |
---|
| 197 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/fs/LocalDirAllocator.html#getLocalPathToRead(java.lang.String, org.apache.hadoop.conf.Configuration)">getLocalPathToRead</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> pathStr, |
---|
| 198 | <A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf)</CODE> |
---|
| 199 | |
---|
| 200 | <BR> |
---|
| 201 | Get a path from the local FS for reading.</TD> |
---|
| 202 | </TR> |
---|
| 203 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 204 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
| 205 | <CODE> boolean</CODE></FONT></TD> |
---|
| 206 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/fs/LocalDirAllocator.html#ifExists(java.lang.String, org.apache.hadoop.conf.Configuration)">ifExists</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> pathStr, |
---|
| 207 | <A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf)</CODE> |
---|
| 208 | |
---|
| 209 | <BR> |
---|
| 210 | We search through all the configured dirs for the file's existence |
---|
| 211 | and return true when we find</TD> |
---|
| 212 | </TR> |
---|
| 213 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 214 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
| 215 | <CODE>static boolean</CODE></FONT></TD> |
---|
| 216 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/fs/LocalDirAllocator.html#isContextValid(java.lang.String)">isContextValid</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> contextCfgItemName)</CODE> |
---|
| 217 | |
---|
| 218 | <BR> |
---|
| 219 | Method to check whether a context is valid</TD> |
---|
| 220 | </TR> |
---|
| 221 | </TABLE> |
---|
| 222 | <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> |
---|
| 223 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
| 224 | <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> |
---|
| 225 | <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> |
---|
| 226 | </TR> |
---|
| 227 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 228 | <TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> |
---|
| 229 | </TR> |
---|
| 230 | </TABLE> |
---|
| 231 | |
---|
| 232 | <P> |
---|
| 233 | |
---|
| 234 | <!-- ========= CONSTRUCTOR DETAIL ======== --> |
---|
| 235 | |
---|
| 236 | <A NAME="constructor_detail"><!-- --></A> |
---|
| 237 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
| 238 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
| 239 | <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
---|
| 240 | <B>Constructor Detail</B></FONT></TH> |
---|
| 241 | </TR> |
---|
| 242 | </TABLE> |
---|
| 243 | |
---|
| 244 | <A NAME="LocalDirAllocator(java.lang.String)"><!-- --></A><H3> |
---|
| 245 | LocalDirAllocator</H3> |
---|
| 246 | <PRE> |
---|
| 247 | public <B>LocalDirAllocator</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> contextCfgItemName)</PRE> |
---|
| 248 | <DL> |
---|
| 249 | <DD>Create an allocator object |
---|
| 250 | <P> |
---|
| 251 | <DL> |
---|
| 252 | <DT><B>Parameters:</B><DD><CODE>contextCfgItemName</CODE> - </DL> |
---|
| 253 | </DL> |
---|
| 254 | |
---|
| 255 | <!-- ============ METHOD DETAIL ========== --> |
---|
| 256 | |
---|
| 257 | <A NAME="method_detail"><!-- --></A> |
---|
| 258 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
| 259 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
| 260 | <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
---|
| 261 | <B>Method Detail</B></FONT></TH> |
---|
| 262 | </TR> |
---|
| 263 | </TABLE> |
---|
| 264 | |
---|
| 265 | <A NAME="getLocalPathForWrite(java.lang.String, org.apache.hadoop.conf.Configuration)"><!-- --></A><H3> |
---|
| 266 | getLocalPathForWrite</H3> |
---|
| 267 | <PRE> |
---|
| 268 | public <A HREF="../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> <B>getLocalPathForWrite</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> pathStr, |
---|
| 269 | <A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf) |
---|
| 270 | throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE> |
---|
| 271 | <DL> |
---|
| 272 | <DD>Get a path from the local FS. This method should be used if the size of |
---|
| 273 | the file is not known apriori. We go round-robin over the set of disks |
---|
| 274 | (via the configured dirs) and return the first complete path where |
---|
| 275 | we could create the parent directory of the passed path. |
---|
| 276 | <P> |
---|
| 277 | <DD><DL> |
---|
| 278 | <DT><B>Parameters:</B><DD><CODE>pathStr</CODE> - the requested path (this will be created on the first |
---|
| 279 | available disk)<DD><CODE>conf</CODE> - the Configuration object |
---|
| 280 | <DT><B>Returns:</B><DD>the complete path to the file on a local disk |
---|
| 281 | <DT><B>Throws:</B> |
---|
| 282 | <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL> |
---|
| 283 | </DD> |
---|
| 284 | </DL> |
---|
| 285 | <HR> |
---|
| 286 | |
---|
| 287 | <A NAME="getLocalPathForWrite(java.lang.String, long, org.apache.hadoop.conf.Configuration)"><!-- --></A><H3> |
---|
| 288 | getLocalPathForWrite</H3> |
---|
| 289 | <PRE> |
---|
| 290 | public <A HREF="../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> <B>getLocalPathForWrite</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> pathStr, |
---|
| 291 | long size, |
---|
| 292 | <A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf) |
---|
| 293 | throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE> |
---|
| 294 | <DL> |
---|
| 295 | <DD>Get a path from the local FS. Pass size as -1 if not known apriori. We |
---|
| 296 | round-robin over the set of disks (via the configured dirs) and return |
---|
| 297 | the first complete path which has enough space |
---|
| 298 | <P> |
---|
| 299 | <DD><DL> |
---|
| 300 | <DT><B>Parameters:</B><DD><CODE>pathStr</CODE> - the requested path (this will be created on the first |
---|
| 301 | available disk)<DD><CODE>size</CODE> - the size of the file that is going to be written<DD><CODE>conf</CODE> - the Configuration object |
---|
| 302 | <DT><B>Returns:</B><DD>the complete path to the file on a local disk |
---|
| 303 | <DT><B>Throws:</B> |
---|
| 304 | <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL> |
---|
| 305 | </DD> |
---|
| 306 | </DL> |
---|
| 307 | <HR> |
---|
| 308 | |
---|
| 309 | <A NAME="getLocalPathToRead(java.lang.String, org.apache.hadoop.conf.Configuration)"><!-- --></A><H3> |
---|
| 310 | getLocalPathToRead</H3> |
---|
| 311 | <PRE> |
---|
| 312 | public <A HREF="../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> <B>getLocalPathToRead</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> pathStr, |
---|
| 313 | <A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf) |
---|
| 314 | throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE> |
---|
| 315 | <DL> |
---|
| 316 | <DD>Get a path from the local FS for reading. We search through all the |
---|
| 317 | configured dirs for the file's existence and return the complete |
---|
| 318 | path to the file when we find one |
---|
| 319 | <P> |
---|
| 320 | <DD><DL> |
---|
| 321 | <DT><B>Parameters:</B><DD><CODE>pathStr</CODE> - the requested file (this will be searched)<DD><CODE>conf</CODE> - the Configuration object |
---|
| 322 | <DT><B>Returns:</B><DD>the complete path to the file on a local disk |
---|
| 323 | <DT><B>Throws:</B> |
---|
| 324 | <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL> |
---|
| 325 | </DD> |
---|
| 326 | </DL> |
---|
| 327 | <HR> |
---|
| 328 | |
---|
| 329 | <A NAME="createTmpFileForWrite(java.lang.String, long, org.apache.hadoop.conf.Configuration)"><!-- --></A><H3> |
---|
| 330 | createTmpFileForWrite</H3> |
---|
| 331 | <PRE> |
---|
| 332 | public <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> <B>createTmpFileForWrite</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> pathStr, |
---|
| 333 | long size, |
---|
| 334 | <A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf) |
---|
| 335 | throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE> |
---|
| 336 | <DL> |
---|
| 337 | <DD>Creates a temporary file in the local FS. Pass size as -1 if not known |
---|
| 338 | apriori. We round-robin over the set of disks (via the configured dirs) |
---|
| 339 | and select the first complete path which has enough space. A file is |
---|
| 340 | created on this directory. The file is guaranteed to go away when the |
---|
| 341 | JVM exits. |
---|
| 342 | <P> |
---|
| 343 | <DD><DL> |
---|
| 344 | <DT><B>Parameters:</B><DD><CODE>pathStr</CODE> - prefix for the temporary file<DD><CODE>size</CODE> - the size of the file that is going to be written<DD><CODE>conf</CODE> - the Configuration object |
---|
| 345 | <DT><B>Returns:</B><DD>a unique temporary file |
---|
| 346 | <DT><B>Throws:</B> |
---|
| 347 | <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL> |
---|
| 348 | </DD> |
---|
| 349 | </DL> |
---|
| 350 | <HR> |
---|
| 351 | |
---|
| 352 | <A NAME="isContextValid(java.lang.String)"><!-- --></A><H3> |
---|
| 353 | isContextValid</H3> |
---|
| 354 | <PRE> |
---|
| 355 | public static boolean <B>isContextValid</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> contextCfgItemName)</PRE> |
---|
| 356 | <DL> |
---|
| 357 | <DD>Method to check whether a context is valid |
---|
| 358 | <P> |
---|
| 359 | <DD><DL> |
---|
| 360 | <DT><B>Parameters:</B><DD><CODE>contextCfgItemName</CODE> - |
---|
| 361 | <DT><B>Returns:</B><DD>true/false</DL> |
---|
| 362 | </DD> |
---|
| 363 | </DL> |
---|
| 364 | <HR> |
---|
| 365 | |
---|
| 366 | <A NAME="ifExists(java.lang.String, org.apache.hadoop.conf.Configuration)"><!-- --></A><H3> |
---|
| 367 | ifExists</H3> |
---|
| 368 | <PRE> |
---|
| 369 | public boolean <B>ifExists</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> pathStr, |
---|
| 370 | <A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf)</PRE> |
---|
| 371 | <DL> |
---|
| 372 | <DD>We search through all the configured dirs for the file's existence |
---|
| 373 | and return true when we find |
---|
| 374 | <P> |
---|
| 375 | <DD><DL> |
---|
| 376 | <DT><B>Parameters:</B><DD><CODE>pathStr</CODE> - the requested file (this will be searched)<DD><CODE>conf</CODE> - the Configuration object |
---|
| 377 | <DT><B>Returns:</B><DD>true if files exist. false otherwise |
---|
| 378 | <DT><B>Throws:</B> |
---|
| 379 | <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL> |
---|
| 380 | </DD> |
---|
| 381 | </DL> |
---|
| 382 | <!-- ========= END OF CLASS DATA ========= --> |
---|
| 383 | <HR> |
---|
| 384 | |
---|
| 385 | |
---|
| 386 | <!-- ======= START OF BOTTOM NAVBAR ====== --> |
---|
| 387 | <A NAME="navbar_bottom"><!-- --></A> |
---|
| 388 | <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> |
---|
| 389 | <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
---|
| 390 | <TR> |
---|
| 391 | <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
---|
| 392 | <A NAME="navbar_bottom_firstrow"><!-- --></A> |
---|
| 393 | <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
---|
| 394 | <TR ALIGN="center" VALIGN="top"> |
---|
| 395 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
---|
| 396 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
---|
| 397 | <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
---|
| 398 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/LocalDirAllocator.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
---|
| 399 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
---|
| 400 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
---|
| 401 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
---|
| 402 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
---|
| 403 | </TR> |
---|
| 404 | </TABLE> |
---|
| 405 | </TD> |
---|
| 406 | <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
---|
| 407 | </EM> |
---|
| 408 | </TD> |
---|
| 409 | </TR> |
---|
| 410 | |
---|
| 411 | <TR> |
---|
| 412 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
---|
| 413 | <A HREF="../../../../org/apache/hadoop/fs/InMemoryFileSystem.html" title="class in org.apache.hadoop.fs"><B>PREV CLASS</B></A> |
---|
| 414 | <A HREF="../../../../org/apache/hadoop/fs/LocalFileSystem.html" title="class in org.apache.hadoop.fs"><B>NEXT CLASS</B></A></FONT></TD> |
---|
| 415 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
---|
| 416 | <A HREF="../../../../index.html?org/apache/hadoop/fs/LocalDirAllocator.html" target="_top"><B>FRAMES</B></A> |
---|
| 417 | <A HREF="LocalDirAllocator.html" target="_top"><B>NO FRAMES</B></A> |
---|
| 418 | <SCRIPT type="text/javascript"> |
---|
| 419 | <!-- |
---|
| 420 | if(window==top) { |
---|
| 421 | document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
---|
| 422 | } |
---|
| 423 | //--> |
---|
| 424 | </SCRIPT> |
---|
| 425 | <NOSCRIPT> |
---|
| 426 | <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> |
---|
| 427 | </NOSCRIPT> |
---|
| 428 | |
---|
| 429 | |
---|
| 430 | </FONT></TD> |
---|
| 431 | </TR> |
---|
| 432 | <TR> |
---|
| 433 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
---|
| 434 | SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> |
---|
| 435 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
---|
| 436 | DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> |
---|
| 437 | </TR> |
---|
| 438 | </TABLE> |
---|
| 439 | <A NAME="skip-navbar_bottom"></A> |
---|
| 440 | <!-- ======== END OF BOTTOM NAVBAR ======= --> |
---|
| 441 | |
---|
| 442 | <HR> |
---|
| 443 | Copyright © 2009 The Apache Software Foundation |
---|
| 444 | </BODY> |
---|
| 445 | </HTML> |
---|