upscaledb  2.2.1
upscaledb_int.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 Christoph Rupp (chris@crupp.de).
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * See the file COPYING for License information.
17  */
18 
30 #ifndef UPS_UPSCALEDB_INT_H
31 #define UPS_UPSCALEDB_INT_H
32 
33 #include <ups/types.h>
34 #include <ups/upscaledb.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
46 #define ups_key_get_intflags(key) (key)->_flags
47 
55 #define ups_key_set_intflags(key, f) (key)->_flags=(f)
56 
82 
103 
105 #define UPS_PRINT_GRAPH 1
106 
119 ups_set_context_data(ups_db_t *db, void *data);
120 
136 
146 
147 typedef struct min_max_avg_u32_t {
151  uint32_t _total; /* for calculating the average */
152  uint32_t _instances; /* for calculating the average */
154 
155 /* btree metrics */
156 typedef struct btree_metrics_t {
157  /* the database name of the btree */
159 
160  /* number of pages */
162 
163  /* number of keys */
165 
166  /* total btree space, including overhead */
168 
169  /* static overhead per page */
171 
172  /* number of keys stored per page (w/o duplicates) */
174 
175  /* payload storage assigned to the KeyLists */
177 
178  /* payload storage assigned to the RecordLists */
180 
181  /* storage assigned to the Indices (if available) */
183 
184  /* storage assigned to the Indices (if available) */
186 
187  /* unused storage (i.e. gaps between pages, underfilled blocks etc) */
189 
190  /* unused storage (i.e. gaps between pages, underfilled blocks etc) */
192 
193  /* number of blocks per page (if available) */
195 
196  /* block sizes (if available) */
199 
212 #define UPS_METRICS_VERSION 9
213 
214 typedef struct ups_env_metrics_t {
215  /* the version indicator - must be UPS_METRICS_VERSION */
217 
218  /* number of total allocations for the whole lifetime of the process */
220 
221  /* currently active allocations for the whole process */
223 
224  /* current amount of memory allocated and tracked by the process
225  * (excludes memory used by the kernel or not allocated with
226  * malloc/free) */
228 
229  /* peak usage of memory (for the whole process) */
231 
232  /* the heap size of this process */
234 
235  /* amount of pages fetched from disk */
237 
238  /* amount of pages written to disk */
240 
241  /* number of index pages in this Environment */
243 
244  /* number of blob pages in this Environment */
246 
247  /* number of page-manager pages in this Environment */
249 
250  /* number of successful freelist hits */
252 
253  /* number of freelist misses */
255 
256  /* number of successful cache hits */
258 
259  /* number of cache misses */
261 
262  /* number of blobs allocated */
264 
265  /* number of blobs read */
267 
268  /* (global) number of btree page splits */
270 
271  /* (global) number of btree page merges */
273 
274  /* (global) number of extended keys */
276 
277  /* (global) number of extended duplicate tables */
279 
280  /* number of bytes that the log/journal flushes to disk */
282 
283  /* log/journal bytes before compression */
285 
286  /* log/journal bytes after compression */
288 
289  /* record bytes before compression */
291 
292  /* record bytes after compression */
294 
295  /* key bytes before compression */
297 
298  /* key bytes after compression */
300 
301  /* btree metrics for leaf nodes */
303 
304  /* btree metrics for internal nodes */
306 
307  // set to true if AVX is enabled
309 
311 
317 
323 ups_is_debug();
324 
329 ups_calc_compare_name_hash(const char *zname);
330 
336 
342 
348 
354 
359 ups_set_committed_flush_threshold(int threshold);
360 
368 ups_at_exit();
369 
375  int type;
376 
379 
382 
385 
388 };
389 
390 #define UPS_OP_INSERT 1
391 #define UPS_OP_ERASE 2
392 #define UPS_OP_FIND 3
393 
406  struct ups_operation_t *operations,
407  size_t operations_length, uint32_t flags);
408 
413 #ifdef __cplusplus
414 } // extern "C"
415 #endif
416 
417 #endif /* UPS_UPSCALEDB_INT_H */
uint64_t page_count_type_page_manager
UPS_EXPORT uint32_t UPS_CALLCONV ups_calc_compare_name_hash(const char *zname)
uint64_t blob_total_read
struct ups_txn_t ups_txn_t
Definition: upscaledb.h:1167
int ups_bool_t
Definition: types.h:132
min_max_avg_u32_t keylist_blocks_per_page
Portable typedefs for upscaledb.
min_max_avg_u32_t keylist_unused
UPS_EXPORT void UPS_CALLCONV ups_set_context_data(ups_db_t *db, void *data)
unsigned short uint16_t
Definition: msstdint.h:84
UPS_EXPORT void UPS_CALLCONV ups_at_exit()
uint64_t freelist_hits
struct ups_env_metrics_t ups_env_metrics_t
UPS_EXPORT uint32_t UPS_CALLCONV ups_db_get_flags(ups_db_t *hdb)
UPS_EXPORT uint32_t UPS_CALLCONV ups_db_get_compare_name_hash(ups_db_t *db)
unsigned __int64 uint64_t
Definition: msstdint.h:95
uint64_t btree_smo_split
uint64_t mem_peak_usage
uint64_t key_bytes_before_compression
uint64_t page_count_type_blob
min_max_avg_u32_t recordlist_index
min_max_avg_u32_t recordlist_ranges
struct min_max_avg_u32_t min_max_avg_u32_t
uint16_t database_name
uint64_t blob_total_allocated
unsigned int uint32_t
Definition: msstdint.h:85
uint64_t journal_bytes_after_compression
uint64_t number_of_keys
UPS_EXPORT void UPS_CALLCONV ups_set_committed_flush_threshold(int threshold)
ups_status_t result
Include file for upscaledb embedded database.
uint64_t number_of_pages
uint64_t btree_smo_merge
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_bulk_operations(ups_db_t *db, ups_txn_t *txn, struct ups_operation_t *operations, size_t operations_length, uint32_t flags)
uint64_t mem_current_allocations
UPS_EXPORT ups_db_t *UPS_CALLCONV ups_env_get_open_database(ups_env_t *env, uint16_t name)
struct ups_db_t ups_db_t
Definition: upscaledb.h:156
UPS_EXPORT void *UPS_CALLCONV ups_get_context_data(ups_db_t *db, ups_bool_t dont_lock)
struct ups_cursor_t ups_cursor_t
Definition: upscaledb.h:177
min_max_avg_u32_t keylist_index
#define UPS_CALLCONV
Definition: types.h:98
btree_metrics_t btree_leaf_metrics
uint64_t freelist_misses
uint64_t mem_heap_size
uint64_t page_count_type_index
uint64_t extended_keys
UPS_EXPORT ups_bool_t UPS_CALLCONV ups_is_debug()
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_get_metrics(ups_env_t *env, ups_env_metrics_t *metrics)
UPS_EXPORT int UPS_CALLCONV ups_key_get_approximate_match_type(ups_key_t *key)
uint64_t page_count_flushed
uint64_t extended_duptables
uint64_t record_bytes_after_compression
uint64_t mem_total_allocations
struct btree_metrics_t btree_metrics_t
min_max_avg_u32_t keylist_ranges
#define UPS_EXPORT
Definition: types.h:90
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_check_integrity(ups_db_t *db, uint32_t flags)
int ups_status_t
Definition: types.h:139
UPS_EXPORT ups_db_t *UPS_CALLCONV ups_cursor_get_database(ups_cursor_t *cursor)
uint64_t mem_current_usage
btree_metrics_t btree_internal_metrics
min_max_avg_u32_t keylist_block_sizes
uint64_t journal_bytes_flushed
ups_bool_t is_avx_enabled
uint64_t journal_bytes_before_compression
min_max_avg_u32_t keys_per_page
uint64_t page_count_fetched
UPS_EXPORT uint16_t UPS_CALLCONV ups_db_get_name(ups_db_t *hdb)
uint64_t total_btree_space
uint64_t record_bytes_before_compression
uint64_t key_bytes_after_compression
min_max_avg_u32_t recordlist_unused
uint32_t overhead_per_page
struct ups_env_t ups_env_t
Definition: upscaledb.h:165
ups_record_t record