/[pkg-firebird]/upstream/current/src/jrd/cch_proto.h
ViewVC logotype

Contents of /upstream/current/src/jrd/cch_proto.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1141 - (show annotations) (download)
Sun Apr 1 15:48:28 2007 UTC (6 years, 2 months ago) by dmn
File MIME type: text/plain
File size: 7217 byte(s)
Import current upstream CVS
1 /*
2 * PROGRAM: JRD Access Method
3 * MODULE: cch_proto.h
4 * DESCRIPTION: Prototype header file for cch.cpp
5 *
6 * The contents of this file are subject to the Interbase Public
7 * License Version 1.0 (the "License"); you may not use this file
8 * except in compliance with the License. You may obtain a copy
9 * of the License at http://www.Inprise.com/IPL.html
10 *
11 * Software distributed under the License is distributed on an
12 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
13 * or implied. See the License for the specific language governing
14 * rights and limitations under the License.
15 *
16 * The Original Code was created by Inprise Corporation
17 * and its predecessors. Portions created by Inprise Corporation are
18 * Copyright (C) Inprise Corporation.
19 *
20 * All Rights Reserved.
21 * Contributor(s): ______________________________________.
22 */
23
24 #ifndef JRD_CCH_PROTO_H
25 #define JRD_CCH_PROTO_H
26
27 namespace Ods {
28 struct pag;
29 }
30
31 void CCH_shutdown_database(Jrd::Database*);
32
33 USHORT CCH_checksum(Jrd::BufferDesc*);
34 int CCH_down_grade_dbb(void*);
35 bool CCH_exclusive(Jrd::thread_db*, USHORT, SSHORT);
36 bool CCH_exclusive_attachment(Jrd::thread_db*, USHORT, SSHORT);
37 void CCH_expand(Jrd::thread_db*, ULONG);
38 Ods::pag* CCH_fake(Jrd::thread_db*, Jrd::win*, SSHORT);
39 Ods::pag* CCH_fetch(Jrd::thread_db*, Jrd::win*, USHORT, SCHAR, SSHORT, SSHORT, bool);
40 SSHORT CCH_fetch_lock(Jrd::thread_db*, Jrd::win*, USHORT, SSHORT, SSHORT, SCHAR);
41 void CCH_fetch_page(Jrd::thread_db*, Jrd::win*, SSHORT, bool);
42 void CCH_fini(Jrd::thread_db*);
43 void CCH_flush(Jrd::thread_db*, USHORT, SLONG);
44 bool CCH_free_page(Jrd::thread_db*);
45 SLONG CCH_get_incarnation(Jrd::win*);
46 Ods::pag* CCH_handoff(Jrd::thread_db*, Jrd::win*, SLONG, SSHORT, SCHAR, SSHORT, SSHORT);
47 void CCH_init(Jrd::thread_db*, ULONG);
48 void CCH_mark(Jrd::thread_db*, Jrd::win*, USHORT);
49 void CCH_mark_must_write(Jrd::thread_db*, Jrd::win*);
50 void CCH_must_write(Jrd::win*);
51 Jrd::Lock* CCH_page_lock(Jrd::thread_db*);
52 void CCH_precedence(Jrd::thread_db*, Jrd::win*, SLONG);
53 void CCH_precedence(Jrd::thread_db*, Jrd::win*, Jrd::PageNumber);
54 #ifdef SUPERSERVER_V2
55 void CCH_prefetch(Jrd::thread_db*, SLONG*, SSHORT);
56 bool CCH_prefetch_pages(Jrd::thread_db*);
57 #endif
58 void CCH_release(Jrd::thread_db*, Jrd::win*, bool);
59 void CCH_release_and_free(Jrd::win*);
60 void CCH_release_exclusive(Jrd::thread_db*);
61 bool CCH_rollover_to_shadow(Jrd::Database*, Jrd::jrd_file*, const bool);
62 void CCH_unwind(Jrd::thread_db*, bool);
63 bool CCH_validate(Jrd::win*);
64 void CCH_flush_database(Jrd::thread_db*);
65 bool CCH_write_all_shadows(Jrd::thread_db*, Jrd::Shadow*, Jrd::BufferDesc*,
66 ISC_STATUS*, USHORT, const bool);
67
68 /* macros for dealing with cache pages */
69
70 inline Ods::pag* CCH_FETCH(Jrd::thread_db* tdbb, Jrd::win* window, USHORT lock_type, SCHAR page_type)
71 {
72 return CCH_fetch (tdbb, window, lock_type, page_type, 1, 1, true);
73 }
74
75 inline Ods::pag* CCH_FETCH_NO_SHADOW(Jrd::thread_db* tdbb, Jrd::win* window, USHORT lock_type, SCHAR page_type)
76 {
77 return CCH_fetch (tdbb, window, lock_type, page_type, 1, 1, false);
78 }
79
80 inline Ods::pag* CCH_FETCH_NO_CHECKSUM(Jrd::thread_db* tdbb, Jrd::win* window, USHORT lock_type, SCHAR page_type)
81 {
82 return CCH_fetch (tdbb, window, lock_type, page_type, 0, 1, true);
83 }
84
85 inline Ods::pag* CCH_FETCH_TIMEOUT(Jrd::thread_db* tdbb, Jrd::win* window, USHORT lock_type, SCHAR page_type, SSHORT latch_wait)
86 {
87 return CCH_fetch (tdbb, window, lock_type, page_type, 0, latch_wait, true);
88 }
89
90 inline SSHORT CCH_FETCH_LOCK(Jrd::thread_db* tdbb, Jrd::win * window, USHORT lock_type, SSHORT wait, SSHORT latch_wait, SCHAR page_type)
91 {
92 return CCH_fetch_lock(tdbb, window, lock_type, wait, latch_wait, page_type);
93 }
94
95 inline void CCH_FETCH_PAGE(Jrd::thread_db* tdbb, Jrd::win * window, SSHORT compute_checksum, bool read_shadow)
96 {
97 CCH_fetch_page(tdbb, window, compute_checksum, read_shadow);
98 }
99
100 inline void CCH_RELEASE(Jrd::thread_db* tdbb, Jrd::win * window)
101 {
102 CCH_release(tdbb, window, false);
103 }
104
105 inline void CCH_RELEASE_TAIL(Jrd::thread_db* tdbb, Jrd::win * window)
106 {
107 CCH_release(tdbb, window, true);
108 }
109
110 inline void CCH_MARK(Jrd::thread_db* tdbb, Jrd::win * window)
111 {
112 CCH_mark (tdbb, window, 0);
113 }
114
115 inline void CCH_MARK_SYSTEM(Jrd::thread_db* tdbb, Jrd::win * window)
116 {
117 CCH_mark (tdbb, window, 1);
118 }
119
120 inline Ods::pag* CCH_HANDOFF(Jrd::thread_db* tdbb, Jrd::win* window, SLONG page, SSHORT lock, SCHAR page_type)
121 {
122 return CCH_handoff (tdbb, window, page, lock, page_type, 1, 0);
123 }
124
125 inline Ods::pag* CCH_HANDOFF_TIMEOUT(Jrd::thread_db* tdbb, Jrd::win* window, SLONG page, SSHORT lock, SCHAR page_type, SSHORT latch_wait)
126 {
127 return CCH_handoff (tdbb, window, page, lock, page_type, latch_wait, 0);
128 }
129
130 inline Ods::pag* CCH_HANDOFF_TAIL(Jrd::thread_db* tdbb, Jrd::win* window, SLONG page, SSHORT lock, SCHAR page_type)
131 {
132 return CCH_handoff (tdbb, window, page, lock, page_type, 1, 1);
133 }
134
135 inline void CCH_MARK_MUST_WRITE(Jrd::thread_db* tdbb, Jrd::win * window)
136 {
137 CCH_mark_must_write(tdbb, window);
138 }
139
140 #ifdef SUPERSERVER_V2
141 inline void CCH_PREFETCH(Jrd::thread_db* tdbb, SLONG * pages, SSHORT count)
142 {
143 CCH_prefetch (tdbb, pages, count);
144 }
145 #endif
146
147 //#define CCH_FETCH(tdbb, window, lock, type) CCH_fetch (tdbb, window, lock, type, 1, 1, true)
148 //#define CCH_FETCH_NO_SHADOW(tdbb, window, lock, type) CCH_fetch (tdbb, window, lock, type, 1, 1, false)
149 //#define CCH_FETCH_NO_CHECKSUM(tdbb, window, lock, type) CCH_fetch (tdbb, window, lock, type, 0, 1, true)
150 //#define CCH_FETCH_TIMEOUT(tdbb, window, lock, type, latch_wait) CCH_fetch (tdbb, window, lock, type, 0, latch_wait, true)
151 //#define CCH_FETCH_LOCK(tdbb, window, lock, wait, latch_wait, type) CCH_fetch_lock (tdbb, window, lock, wait, latch_wait, type)
152 //#define CCH_FETCH_PAGE(tdbb, window, checksum, read_shadow) CCH_fetch_page (tdbb, window, checksum, read_shadow)
153 //#define CCH_RELEASE(tdbb, window) CCH_release (tdbb, window, false)
154 //#define CCH_RELEASE_TAIL(tdbb, window) CCH_release (tdbb, window, true)
155 //#define CCH_MARK(tdbb, window) CCH_mark (tdbb, window, 0)
156 //#define CCH_MARK_SYSTEM(tdbb, window) CCH_mark (tdbb, window, 1)
157 //#define CCH_HANDOFF(tdbb, window, page, lock, type) CCH_handoff (tdbb, window, page, lock, type, 1, 0)
158 //#define CCH_HANDOFF_TIMEOUT(tdbb, window, page, lock, type, latch_wait) CCH_handoff (tdbb, window, page, lock, type, latch_wait, 0)
159 //#define CCH_HANDOFF_TAIL(tdbb, window, page, lock, type) CCH_handoff (tdbb, window, page, lock, type, 1, 1)
160 //#define CCH_MARK_MUST_WRITE(tdbb, window) CCH_mark_must_write (tdbb, window)
161 //#define CCH_PREFETCH(tdbb, pages, count) CCH_prefetch (tdbb, pages, count)
162
163 /* Flush flags */
164
165 const USHORT FLUSH_ALL = 1; /* flush all dirty buffers in cache */
166 const USHORT FLUSH_RLSE = 2; /* release page locks after flush */
167 const USHORT FLUSH_TRAN = 4; /* flush transaction dirty buffers from dirty btree */
168 const USHORT FLUSH_SWEEP = 8; /* flush dirty buffers from garbage collection */
169 const USHORT FLUSH_SYSTEM = 16; /* flush system transaction only from dirty btree */
170 const USHORT FLUSH_FINI = (FLUSH_ALL | FLUSH_RLSE);
171
172 #endif /* JRD_CCH_PROTO_H */
173

  ViewVC Help
Powered by ViewVC 1.1.5