Contiki 3.x
db-options.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, Swedish Institute of Computer Science
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 
30 /**
31  * \file
32  * Database configuration options.
33  * \author
34  * Nicolas Tsiftes <nvt@sics.se>
35  */
36 
37 #ifndef DB_OPTIONS_H
38 #define DB_OPTIONS_H
39 
40 #include "contiki-conf.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
44 /* Optional Antelope features. Include only what is needed
45  in order to save space. */
46 
47 /* Support join operations on relations. */
48 #ifndef DB_FEATURE_JOIN
49 #define DB_FEATURE_JOIN 1
50 #endif /* DB_FEATURE_JOIN */
51 
52 /* Support tuple removals. */
53 #ifndef DB_FEATURE_REMOVE
54 #define DB_FEATURE_REMOVE 1
55 #endif /* DB_FEATURE_REMOVE */
56 
57 /* Support floating-point values in attributes. */
58 #ifndef DB_FEATURE_FLOATS
59 #define DB_FEATURE_FLOATS 0
60 #endif /* DB_FEATURE_FLOATS */
61 
62 /* Optimize storage access for the Coffee file system. */
63 #ifndef DB_FEATURE_COFFEE
64 #define DB_FEATURE_COFFEE 1
65 #endif /* DB_FEATURE_COFFEE */
66 
67 /* Enable basic data integrity checks. */
68 #ifndef DB_FEATURE_INTEGRITY
69 #define DB_FEATURE_INTEGRITY 0
70 #endif /* DB_FEATURE_INTEGRITY */
71 
72 /*----------------------------------------------------------------------------*/
73 
74 /* Configuration parameters that may be trimmed to save space. */
75 
76 /* The size of the error message buffer used by the parser. */
77 #ifndef DB_ERROR_BUF_SIZE
78 #define DB_ERROR_BUF_SIZE 50
79 #endif /* DB_ERROR_BUF_SIZE */
80 
81 /* The maximum number of indexes in use by all relations loaded in memory. */
82 #ifndef DB_INDEX_POOL_SIZE
83 #define DB_INDEX_POOL_SIZE 3
84 #endif /* DB_INDEX_POOL_SIZE */
85 
86 /* The maximum number of relations loaded in memory. */
87 #ifndef DB_RELATION_POOL_SIZE
88 #define DB_RELATION_POOL_SIZE 5
89 #endif /* DB_RELATION_POOL_SIZE */
90 
91 /* The maximum number of attributes loaded in memory. */
92 #ifndef DB_ATTRIBUTE_POOL_SIZE
93 #define DB_ATTRIBUTE_POOL_SIZE 16
94 #endif /* DB_ATTRIBUTE_POOL_SIZE */
95 
96 /* The maximum number of attributes in a relation. */
97 #ifndef DB_MAX_ATTRIBUTES_PER_RELATION
98 #define DB_MAX_ATTRIBUTES_PER_RELATION 6
99 #endif /* DB_MAX_ATTRIBUTES_PER_RELATION */
100 
101 /* The maximum physical storage size on an attribute value. */
102 #ifndef DB_MAX_ELEMENT_SIZE
103 #define DB_MAX_ELEMENT_SIZE 16
104 #endif /* DB_MAX_ELEMENT_SIZE */
105 
106 
107 /* The maximum size of the LVM bytecode compiled from a
108  single database query. */
109 #ifndef DB_VM_BYTECODE_SIZE
110 #define DB_VM_BYTECODE_SIZE 128
111 #endif /* DB_VM_BYTECODE_SIZE */
112 
113 /*----------------------------------------------------------------------------*/
114 
115 /* Language options. */
116 
117 /* The maximum length of a database query in AQL text format. */
118 #ifndef AQL_MAX_QUERY_LENGTH
119 #define AQL_MAX_QUERY_LENGTH 128
120 #endif /* AQL_MAX_QUERY_LENGTH */
121 
122 #ifndef AQL_MAX_VALUE_LENGTH
123 #define AQL_MAX_VALUE_LENGTH DB_MAX_ELEMENT_SIZE
124 #endif /* AQL_MAX_VALUE_LENGTH */
125 
126 /* The maximum number of relations used in a single query. */
127 #ifndef AQL_RELATION_LIMIT
128 #define AQL_RELATION_LIMIT 3
129 #endif /* AQL_RELATION_LIMIT */
130 
131 /* The maximum number of attributes used in a single query. */
132 #ifndef AQL_ATTRIBUTE_LIMIT
133 #define AQL_ATTRIBUTE_LIMIT 5
134 #endif /* AQL_ATTRIBUTE_LIMIT */
135 
136 /*----------------------------------------------------------------------------*/
137 
138 /*
139  * Physical storage options. Changing these options might cause
140  * compatibility problems if the database files are moved between
141  * different installations of Antelope.
142  */
143 
144 /* The default relation file size to reserve when using Coffee. */
145 #ifndef DB_COFFEE_RESERVE_SIZE
146 #define DB_COFFEE_RESERVE_SIZE (128 * 1024UL)
147 #endif /* DB_COFFEE_RESERVE_SIZE */
148 
149 /* The maximum size of the physical storage of a tuple (labelled a "row"
150  in Antelope's terminology. */
151 #ifndef DB_MAX_CHAR_SIZE_PER_ROW
152 #define DB_MAX_CHAR_SIZE_PER_ROW 64
153 #endif /* DB_MAX_CHAR_SIZE_PER_ROW */
154 
155 /* The maximum file name length to use for creating various database file. */
156 #ifndef DB_MAX_FILENAME_LENGTH
157 #define DB_MAX_FILENAME_LENGTH 16
158 #endif /* DB_MAX_FILENAME_LENGTH */
159 
160 /* The maximum length of an attribute name. */
161 #ifndef ATTRIBUTE_NAME_LENGTH
162 #define ATTRIBUTE_NAME_LENGTH 12
163 #endif /* ATTRIBUTE_NAME_LENGTH */
164 
165 /* The maximum length on a relation name. */
166 #ifndef RELATION_NAME_LENGTH
167 #define RELATION_NAME_LENGTH 10
168 #endif /* RELATION_NAME_LENGTH */
169 
170 /* The name of the intermediate "result" relation file, which is used
171  for presenting the result of a query to a user. */
172 #ifndef RESULT_RELATION
173 #define RESULT_RELATION "db-result"
174 #endif /* RESULT_RELATION */
175 
176 /* The name of the relation used for processing a REMOVE query. */
177 #ifndef REMOVE_RELATION
178 #define REMOVE_RELATION "db-remove"
179 #endif /* REMOVE_RELATION */
180 
181 /*----------------------------------------------------------------------------*/
182 
183 /* Index options. */
184 
185 #ifndef DB_INDEX_COST
186 #define DB_INDEX_COST 64
187 #endif /* DB_INDEX_COST */
188 
189 /* The maximum number of hash table indexes. */
190 #ifndef DB_MEMHASH_INDEX_LIMIT
191 #define DB_MEMHASH_INDEX_LIMIT 1
192 #endif /* DB_MEMHASH_INDEX_LIMIT */
193 
194 /* The default hash table index size. */
195 #ifndef DB_MEMHASH_TABLE_SIZE
196 #define DB_MEMHASH_TABLE_SIZE 61
197 #endif /* DB_MEMHASH_TABLE_SIZE */
198 
199 /* The maximum number of Maxheap indexes. */
200 #ifndef DB_HEAP_INDEX_LIMIT
201 #define DB_HEAP_INDEX_LIMIT 1
202 #endif /* DB_HEAP_INDEX_LIMIT */
203 
204 /* The maximum number of buckets cached in the MaxHeap index. */
205 #ifndef DB_HEAP_CACHE_LIMIT
206 #define DB_HEAP_CACHE_LIMIT 1
207 #endif /* DB_HEAP_CACHE_LIMIT */
208 
209 /*----------------------------------------------------------------------------*/
210 
211 /* LVM options. */
212 
213 /* The maximum length of a variable in LVM. This value should preferably
214  be identical to the maximum attribute name length. */
215 #ifndef LVM_MAX_NAME_LENGTH
216 #define LVM_MAX_NAME_LENGTH ATTRIBUTE_NAME_LENGTH
217 #endif /* LVM_MAX_NAME_LENGTH */
218 
219 /* The maximum variable identifier number in the LVM. The default
220  value corresponds to the highest attribute ID. */
221 #ifndef LVM_MAX_VARIABLE_ID
222 #define LVM_MAX_VARIABLE_ID AQL_ATTRIBUTE_LIMIT - 1
223 #endif /* LVM_MAX_VARIABLE_ID */
224 
225 /* Specify whether floats should be used or not inside the LVM. */
226 #ifndef LVM_USE_FLOATS
227 #define LVM_USE_FLOATS DB_FEATURE_FLOATS
228 #endif /* LVM_USE_FLOATS */
229 
230 
231 #endif /* !DB_OPTIONS_H */