summaryrefslogtreecommitdiff
path: root/db/docs/api_cxx/memp_fget.html
blob: f233cf13acafeb7a9c322c05edf3ded44aafa5b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!--$Id: memp_fget.so,v 10.43 2004/08/13 03:38:58 bostic Exp $-->
<!--Copyright 1997-2004 by Sleepycat Software, Inc.-->
<!--All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DbMpoolFile::get</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td>
<h3>DbMpoolFile::get</h3>
</td>
<td align=right>
<a href="../api_cxx/api_index.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<h3><pre>
#include &lt;db_cxx.h&gt;
<p>
int
DbMpoolFile::get(db_pgno_t *pgnoaddr, u_int32_t flags, void **pagep);
</pre></h3>
<hr size=1 noshade>
<h3>Description: DbMpoolFile::get</h3>
<p>The DbMpoolFile::get method returns pages from the cache.</p>
<p>All pages returned by DbMpoolFile::get will be retained (that is,
<i>pinned</i>), in the pool until a subsequent call to
<a href="../api_cxx/memp_fput.html">DbMpoolFile::put</a>.</p>
<p>The returned page is <b>size_t</b> type aligned.</p>
<p>Fully or partially created pages have all their bytes set to a nul byte,
unless the <a href="../api_cxx/memp_set_clear_len.html">DbMpoolFile::set_clear_len</a> method was called to specify other
behavior before the file was opened.</p>
<a name="2"><!--meow--></a>
<p>The DbMpoolFile::get method
will either return DB_PAGE_NOTFOUND or
throw an exception that encapsulates DB_PAGE_NOTFOUND if the requested page does not exist and DB_MPOOL_CREATE was
not set.
Unless otherwise specified, the DbMpoolFile::get method
either returns a non-zero error value
or throws an exception that encapsulates a non-zero error value on
failure, and returns 0 on success.
</p>
<h3>Parameters</h3>
<dl compact>
<dt><b>flags</b><dd>The <b>flags</b> parameter must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one
or more of the following values:
<dl compact>
<dt><a name="DB_MPOOL_CREATE">DB_MPOOL_CREATE</a><dd>If the specified page does not exist, create it.  In this case, the
<a href="memp_register.html#pgin">pgin</a> method, if specified, is
called.
<dt><a name="DB_MPOOL_LAST">DB_MPOOL_LAST</a><dd>Return the last page of the source file, and copy its page number into
the memory location to which <b>pgnoaddr</b> refers.
<dt><a name="DB_MPOOL_NEW">DB_MPOOL_NEW</a><dd>Create a new page in the file, and copy its page number into the memory
location to which <b>pgnoaddr</b> refers.  In this case, the
<a href="memp_register.html#pgin">pgin</a> method, if specified, is
<b>not</b> called.
</dl>
<p>The DB_MPOOL_CREATE, DB_MPOOL_LAST, and
DB_MPOOL_NEW flags are mutually exclusive.</p>
<dt><b>pagep</b><dd>The <b>pagep</b> parameter references memory into which
a pointer to the returned page is copied.
<dt><b>pgnoaddr</b><dd>If the <b>flags</b> parameter is set to DB_MPOOL_LAST or
DB_MPOOL_NEW, the page number of the created page is copied
into the memory location to which the <b>pgnoaddr</b> parameter
refers.  Otherwise, the <b>pgnoaddr</b> parameter is the page to
create or retrieve.
<p><b>Page numbers begin at 0; that is, the first page in the file is page
number 0, not page number 1.</b></p>
</dl>
<h3>Errors</h3>
<p>The DbMpoolFile::get method
may fail and throw
<a href="../api_cxx/except_class.html">DbException</a>,
encapsulating one of the following non-zero errors, or return one of
the following non-zero errors:</p>
<dl compact>
<dt>EAGAIN<dd>The page reference count has overflowed.  (This should never happen
unless there is a bug in the application.)
</dl>
<dl compact>
<dt>EINVAL<dd>If the DB_MPOOL_NEW flag was set, and the source file was not
opened for writing;
more than one of DB_MPOOL_CREATE, DB_MPOOL_LAST, and
DB_MPOOL_NEW was set; or if an
invalid flag value or parameter was specified.
</dl>
<p>If the cache is full, and no more pages will fit in the pool, the DbMpoolFile::get method will fail and
either return ENOMEM or
throw a DbMemoryException.</p>
<hr size=1 noshade>
<h3>Class</h3>
<a href="../api_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/mempfile_class.html">DbMpoolFile</a>
<h3>See Also</h3>
<a href="../api_cxx/memp_list.html">Memory Pools and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_cxx/api_index.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1><a href="../sleepycat/legal.html">Copyright (c) 1996-2004</a> <a href="http://www.sleepycat.com">Sleepycat Software, Inc.</a> - All rights reserved.</font>
</body>
</html>