1<!--$Id: memp_set_fileid.so,v 10.14 2005/04/14 13:08:06 sue Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DbMpoolFile::set_fileid</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DbMpoolFile::set_fileid</b>
14</td>
15<td align=right>
16<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a>
17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db_cxx.h&gt;
23<p>
24int
25DbMpoolFile::set(u_int8_t *fileid);
26<p>
27int DbMpoolFile::get_fileid(u_int8_t *fileid);
28</pre></b>
29<hr size=1 noshade>
30<b>Description: DbMpoolFile::set_fileid</b>
31<p>The DbMpoolFile::set_fileid method specifies a unique identifier for the file.
32(The shared memory buffer pool functions must be able to uniquely
33identify files in order that multiple processes wanting to share a file
34will correctly identify it in the pool.)</p>
35<p>On most UNIX/POSIX systems, the <b>fileid</b> field will not need to
36be set, and the memory pool functions will use the file's device and
37inode numbers for this purpose.  On Windows systems, the memory pool
38functions use the values returned by GetFileInformationByHandle() by
39default -- these values are known to be constant between processes and
40over reboot in the case of NTFS (in which they are the NTFS MFT
41indices).</p>
42<p>On other filesystems (for example, FAT or NFS), these default values
43are not necessarily unique between processes or across system reboots.
44<b>Applications wanting to maintain a shared memory buffer pool
45between processes or across system reboots, in which the pool contains
46pages from files stored on such filesystems, must specify a unique file
47identifier using the DbMpoolFile::set_fileid method, and each process opening
48the file must provide the same unique identifier.</b></p>
49<p>This call should not be necessary for most applications.  Specifically,
50it is not necessary if the memory pool is not shared between processes
51and is reinstantiated after each system reboot, if the application is
52using the Berkeley DB access methods instead of calling the pool functions
53explicitly, or if the files in the memory pool are stored on filesystems
54in which the default values as described previously are invariant
55between process and across system reboots.</p>
56<p>The DbMpoolFile::set_fileid method configures a file in the memory pool, not only
57operations performed using the specified <a href="/api_cxx/mempfile_class.html">DbMpoolFile</a> handle.</p>
58<p>The DbMpoolFile::set_fileid method may not be called after the <a href="/api_cxx/memp_fopen.html">DbMpoolFile::open</a> method is
59called.
60</p>
61<p>The DbMpoolFile::set_fileid method
62either returns a non-zero error value
63or throws an exception that encapsulates a non-zero error value on
64failure, and returns 0 on success.
65</p>
66<b>Parameters</b> <br>
67 <b>fileid</b><ul compact><li>The <b>fileid</b> parameter is the unique identifier for the file.
68Unique file identifiers must be a DB_FILE_ID_LEN length array of bytes.</ul>
69<br>
70<hr size=1 noshade>
71<b>Description: DbMpoolFile::get_fileid</b>
72<p>The DbMpoolFile::get_fileid method copies the file's identifier into the
73memory location referenced by <b>fileid</b>.</p>
74<p>The DbMpoolFile::get_fileid method
75either returns a non-zero error value
76or throws an exception that encapsulates a non-zero error value on
77failure, and returns 0 on success.
78</p>
79<p>The DbMpoolFile::get_fileid method may be called at any time during the life of the
80application.</p>
81<hr size=1 noshade>
82<br><b>Class</b>
83<a href="/api_cxx/env_class.html">DbEnv</a>, <a href="/api_cxx/mempfile_class.html">DbMpoolFile</a>
84<br><b>See Also</b>
85<a href="/api_cxx/memp_list.html">Memory Pools and Related Methods</a>
86</tt>
87<table width="100%"><tr><td><br></td><td align=right>
88<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a>
89</td></tr></table>
90<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
91</body>
92</html>
93