source: tags/svn.1.5.4/ARBDB/gb_main.h

Last change on this file was 6656, checked in by westram, 15 years ago
  • removed unneeded 'struct' keyword
  • renamed several structs (especially things like 'blabla_struct')
File size: 4.4 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : gb_main.h                                         //
4//   Purpose   : GB_MAIN_TYPE                                      //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11#ifndef GB_MAIN_H
12#define GB_MAIN_H
13
14#ifndef GB_LOCAL_H
15#include "gb_local.h"
16#endif
17
18// ------------------
19//      constants
20
21#define GB_MAX_PROJECTS 256
22
23// ------------------------------
24//      forward declare types
25
26struct g_b_undo_mgr;
27struct gb_close_callback_list;
28struct gb_callback_list;
29struct gb_user;
30struct gb_project;
31struct gb_Key;
32struct gb_server_data;
33
34// --------------------------------------------------------------------------------
35
36enum gb_open_types {
37    gb_open_all             = 0,
38    gb_open_read_only_all   = 16,
39    gb_open_read_only_small = 17
40};
41
42struct gb_quick_save {
43    char *quick_save_disabled;                      // if set, quick save is not possible and text describes reason why
44    int   last_index;
45};
46
47// --------------------------------------------------------------------------------
48
49#if defined(DEBUG)
50// #define GEN_CACHE_STATS
51#endif // DEBUG
52
53typedef uint16_t gb_cache_idx;
54
55struct gb_cache_entry;
56struct gb_cache {
57    gb_cache_entry *entries;
58
59    gb_cache_idx firstfree_entry;
60    gb_cache_idx newest_entry;
61    gb_cache_idx oldest_entry;
62   
63    size_t sum_data_size;
64    size_t max_data_size;
65    size_t big_data_min_size;
66
67    size_t max_entries;
68
69#if defined(GEN_CACHE_STATS)
70    GB_HASH *not_reused;                            // key = DB_path, value = number of cache entries not reused
71    GB_HASH *reused;                                // key = DB_path, value = number of cache entries reused
72    GB_HASH *reuse_sum;                             // key = DB_path, value = how often entries were reused
73#endif
74};
75
76// --------------------------------------------------------------------------------
77//      root structure (one for each database)
78
79#define ALLOWED_KEYS  15000
80#define ALLOWED_DATES 256
81
82struct GB_MAIN_TYPE {
83    int transaction;
84    int aborted_transaction;
85    int local_mode;                                 // 1 = server, 0 = client
86    int client_transaction_socket;
87
88    gbcmc_comm     *c_link;
89    gb_server_data *server_data;
90    GBCONTAINER    *dummy_father;
91    GBCONTAINER    *data;
92    GBDATA         *gb_key_data;
93    char           *path;
94    gb_open_types   opentype;
95    char           *disabled_path;
96    int             allow_corrupt_file_recovery;
97
98    gb_quick_save qs;
99    gb_cache      cache;
100    int           compression_mask;
101
102    int      keycnt;                                // first non used key
103    long     sizeofkeys;                            // malloc size
104    long     first_free_key;                        // index of first gap
105    gb_Key  *keys;
106    GB_HASH *key_2_index_hash;
107    long     key_clock;                             // trans. nr. of last change
108
109    char         *keys_new[256];
110    unsigned int  last_updated;
111    long          last_saved_time;
112    long          last_saved_transaction;
113    long          last_main_saved_transaction;
114
115    GB_UNDO_TYPE requested_undo_type;
116    GB_UNDO_TYPE undo_type;
117
118    g_b_undo_mgr *undo;
119
120    char         *dates[ALLOWED_DATES];           // @@@ saved to DB, but never used
121    unsigned int  security_level;
122    int           old_security_level;
123    int           pushed_security_level;
124    long          clock;
125    GB_NUMHASH   *remote_hash;
126
127    GB_HASH *command_hash;
128    GB_HASH *resolve_link_hash;
129    GB_HASH *table_hash;
130
131    gb_close_callback_list *close_callbacks;
132
133    gb_callback_list *cbl;                          // contains change-callbacks (after change, until callbacks are done)
134    gb_callback_list *cbl_last;
135
136    gb_callback_list *cbld;                         // contains delete-callbacks (after delete, until callbacks are done)
137    gb_callback_list *cbld_last;
138
139    gb_user    *users[GB_MAX_USERS];                // user 0 is server
140    gb_project *projects[GB_MAX_PROJECTS];          // projects
141
142    gb_user    *this_user;
143    gb_project *this_project;
144};
145
146
147#else
148#error gb_main.h included twice
149#endif // GB_MAIN_H
Note: See TracBrowser for help on using the repository browser.