Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

modelstorage.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *
00003  * Verball Model Storage Library, Common Information Model Library 
00004  * for integration of Intelligent Services.
00005  * Copyright (C) 2005 Nikita Vinokurov, Orgway LLC.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; 
00010  * version 2.1 of the License.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00020  * Boston, MA  02110-1301  USA
00021  *
00022  * $Id: modelstorage.h,v 1.49 2006/12/10 10:21:26 yagel Exp $
00023  **********************************************************************/
00024 
00025 #ifndef _MODEL_STORAGE_H_
00026 #define _MODEL_STORAGE_H_
00027 
00028 #if defined(_WIN32) || defined(__declspec)
00029 #ifdef _MODEL_STORAGE_SOURCE
00030 #define MS_STORAGE_TYPE __declspec(dllexport)
00031 #else
00032 #define MS_STORAGE_TYPE __declspec(dllimport)
00033 #endif
00034 #else
00035 #define MS_STORAGE_TYPE extern
00036 #endif
00037 
00080 #include"stmt/statement.h"
00087 #define MODELSTORAGE_ERR_LOCKED    -2011
00088 #define MODELSTORAGE_ERR_ENCRYPTED -2014
00089 #define MODELSTORAGE_ERR_READING    -2015
00090 #define MODELSTORAGE_ERR_UNDECRYPTED -2016
00091 
00092 #define MODEL_STORAGE_MAX_READINGS 6000
00093 
00099 #define MODEL_STORAGE_MAX_UPDATINGS 400
00100 
00105 #define MODEL_STORAGE_MAX_TXNS 100
00106 
00109 #define MODEL_STORAGE_MAX_GRULES 100
00110 
00113 #define MODEL_STORAGE_MAX_SRULES 100
00114 
00117 #define MODEL_STORAGE_MAX_CLIENTS 100
00118 
00119 #define MS_MAX_PATH 1024
00120 #define MS_MAX_URI  1024
00121 
00122 #define ID_COUNTER_FILE ".ic"
00123 #define MODEL_STORAGE_LOG "modelstorage.log"
00124 #define MODEL_STORAGE_DB "modelstorage.db"
00125 
00128 typedef struct _ms_transaction MSTxn;
00130 typedef struct _ms_blob MSBlob;
00132 typedef struct _model_storage_env ModelStorageEnv;
00133 
00135 typedef struct _model_storage ModelStorage;
00136 
00143 typedef void (*MSNotify)(const Statement *list, void *data);
00144 
00145 
00146 
00149 typedef void (MSProgress)(double percent, char *message, void *data);
00150 
00153 typedef enum {
00154     MS_OPT_LOGFILE = 1,
00155     MS_OPT_IDFILE = 2,
00156     MS_OPT_SERVER = 3,
00157     MS_OPT_DBFILE = 4,  
00158 
00159 } MSOption;
00160 
00161 #ifdef __cplusplus
00162 extern "C"
00163 {
00164 #endif/* __cplusplus */
00165 
00170 MS_STORAGE_TYPE
00171 ModelStorage *model_storage_new(ModelStorageEnv *env);
00172 
00180 MS_STORAGE_TYPE
00181 int model_storage_init_env(const char *filename, ModelStorageEnv **env);
00182 
00183 
00185 MS_STORAGE_TYPE
00186 int model_storage_init_env_se(const char *filename, int descrypt, const char *passphrase, ModelStorageEnv **env);
00187 
00192 MS_STORAGE_TYPE
00193 int model_storage_set_context_key(ModelStorage *ms, const char *context_key);
00194 
00198 MS_STORAGE_TYPE
00199 const char *model_storage_get_context_key(ModelStorage *ms);
00200 
00229 MS_STORAGE_TYPE
00230 int notification_read(ModelStorage *ms, Statement *op);
00231 
00265 MS_STORAGE_TYPE int model_storage_get_new_id(ModelStorage *ms, Node *idnode);
00266 
00267 
00278 MS_STORAGE_TYPE
00279 int model_storage_set(ModelStorage *ms, MSTxn *txn, Statement *stmt);
00280 
00288 MS_STORAGE_TYPE
00289 int model_storage_get(ModelStorage *ms, MSTxn *txn, Statement *mask, Statement **result);
00290 
00292 MS_STORAGE_TYPE
00293 int model_storage_get_count(ModelStorage *ms, MSTxn *txn, Statement *mask, unsigned long *result_count);
00294 
00295 MS_STORAGE_TYPE
00296 int model_storage_batch_get(ModelStorage *ms, MSTxn *txn, Statement *mask_list, Statement **result);
00297 
00300 MS_STORAGE_TYPE
00301 int model_storage_free_env(ModelStorageEnv *env);
00302 
00307 MS_STORAGE_TYPE void model_storage_free(ModelStorage *ms);
00308 
00317 MS_STORAGE_TYPE
00318 int model_storage_begin_transaction(ModelStorageEnv *env, MSTxn **txn);
00319 
00325 MS_STORAGE_TYPE
00326 int model_storage_rollback_transaction(ModelStorage *ms, MSTxn *txn);
00327 
00332 MS_STORAGE_TYPE int model_storage_commit_transaction(ModelStorage *ms, MSTxn *txn);
00333 
00334 
00338 MS_STORAGE_TYPE void model_storage_dump(ModelStorageEnv *env);
00339 
00344 MS_STORAGE_TYPE int model_storage_restore(ModelStorageEnv *env);
00345 
00347 MS_STORAGE_TYPE int model_storage_set_time(ModelStorage *ms, time_t time);
00348 
00350 MS_STORAGE_TYPE int model_storage_get_time(ModelStorage *ms, time_t *time);
00351 
00352 
00355 MS_STORAGE_TYPE
00356 const char * model_storage_get_filename(ModelStorageEnv *env);
00357 
00359 MS_STORAGE_TYPE int model_storage_set_notify(ModelStorage *ms, MSNotify cb, void *data);
00360 
00362 MS_STORAGE_TYPE void model_storage_save(ModelStorageEnv *env);
00363 
00365 MS_STORAGE_TYPE int model_storage_save_se(ModelStorageEnv *env, const char *passphrase);
00366 
00367 MS_STORAGE_TYPE int model_storage_save_as(ModelStorageEnv *env, const char *filename);
00368 
00370 MS_STORAGE_TYPE ModelStorageEnv *model_storage_get_env(ModelStorage *ms);
00371 
00372 
00374 MS_STORAGE_TYPE int model_storage_blob_open(ModelStorage *ms, Node *n, MSBlob **blob);
00375 
00377 MS_STORAGE_TYPE int model_storage_blob_read(MSBlob *blob, void *buffer, size_t size, size_t *read);
00378 
00380 MS_STORAGE_TYPE int model_storage_blob_write(MSBlob *blob, void *buffer, size_t size);
00381 
00382 MS_STORAGE_TYPE int model_storage_blob_seek(MSBlob *blob, long offset);
00383 
00384 MS_STORAGE_TYPE int model_storage_blob_tell(MSBlob *blob, long *offset);
00385 
00386 MS_STORAGE_TYPE int model_storage_blob_truncate(MSBlob *blob, size_t size);
00387 
00388 MS_STORAGE_TYPE int model_storage_blob_close(MSBlob *blob);
00389 
00390 MS_STORAGE_TYPE int model_storage_configure(ModelStorageEnv *env, MSOption opt, void *value);
00391 
00392 MS_STORAGE_TYPE int model_storage_n4_export(ModelStorage *ms, char *filename, MSProgress cb, void *data);
00393 
00394 MS_STORAGE_TYPE int model_storage_n4_import(ModelStorage *ms, char *filename, MSProgress cb, void *data);
00395 
00396 
00397 #ifdef __cplusplus
00398 }
00399 #endif/* __cplusplus */
00400 
00401 #endif /* _MODEL_STORAGE_H */
00402 #ifdef DMALLOC
00403 #include <dmalloc.h>
00404 #endif

Generated on Wed Dec 27 16:52:17 2006 for VRB Online Server by  doxygen 1.4.4