| 1 | /* -*- c-basic-offset: 2 -*- */ |
| 2 | /* |
| 3 | Copyright(C) 2011-2017 Brazil |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License version 2.1 as published by the Free Software Foundation. |
| 8 | |
| 9 | This library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with this library; if not, write to the Free Software |
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | */ |
| 18 | |
| 19 | #pragma once |
| 20 | |
| 21 | #include "grn.h" |
| 22 | #include "grn_db.h" |
| 23 | |
| 24 | #ifdef __cplusplus |
| 25 | extern "C" { |
| 26 | #endif |
| 27 | |
| 28 | struct _grn_dat { |
| 29 | grn_db_obj obj; |
| 30 | grn_io *io; |
| 31 | struct grn_dat_header *; |
| 32 | uint32_t file_id; |
| 33 | grn_encoding encoding; |
| 34 | void *trie; |
| 35 | void *old_trie; |
| 36 | grn_obj *tokenizer; |
| 37 | grn_obj *normalizer; |
| 38 | grn_obj token_filters; |
| 39 | grn_critical_section lock; |
| 40 | grn_bool is_dirty; |
| 41 | }; |
| 42 | |
| 43 | struct { |
| 44 | uint32_t ; |
| 45 | grn_encoding ; |
| 46 | grn_id ; |
| 47 | uint32_t ; |
| 48 | grn_id ; |
| 49 | uint32_t ; |
| 50 | uint32_t [234]; |
| 51 | }; |
| 52 | |
| 53 | struct _grn_dat_cursor { |
| 54 | grn_db_obj obj; |
| 55 | grn_dat *dat; |
| 56 | void *cursor; |
| 57 | const void *key; |
| 58 | grn_id curr_rec; |
| 59 | }; |
| 60 | |
| 61 | GRN_API grn_id grn_dat_curr_id(grn_ctx *ctx, grn_dat *dat); |
| 62 | |
| 63 | /* |
| 64 | Currently, grn_dat_truncate() is available if the grn_dat object is |
| 65 | associated with a file. |
| 66 | */ |
| 67 | GRN_API grn_rc grn_dat_truncate(grn_ctx *ctx, grn_dat *dat); |
| 68 | |
| 69 | GRN_API const char *_grn_dat_key(grn_ctx *ctx, grn_dat *dat, grn_id id, |
| 70 | uint32_t *key_size); |
| 71 | GRN_API grn_id grn_dat_next(grn_ctx *ctx, grn_dat *dat, grn_id id); |
| 72 | GRN_API grn_id grn_dat_at(grn_ctx *ctx, grn_dat *dat, grn_id id); |
| 73 | |
| 74 | GRN_API grn_rc grn_dat_clear_status_flags(grn_ctx *ctx, grn_dat *dat); |
| 75 | |
| 76 | /* |
| 77 | Currently, grn_dat_repair() is available if the grn_dat object is associated |
| 78 | with a file. |
| 79 | */ |
| 80 | GRN_API grn_rc grn_dat_repair(grn_ctx *ctx, grn_dat *dat); |
| 81 | |
| 82 | GRN_API grn_rc grn_dat_flush(grn_ctx *ctx, grn_dat *dat); |
| 83 | |
| 84 | grn_rc grn_dat_dirty(grn_ctx *ctx, grn_dat *dat); |
| 85 | grn_bool grn_dat_is_dirty(grn_ctx *ctx, grn_dat *dat); |
| 86 | grn_rc grn_dat_clean(grn_ctx *ctx, grn_dat *dat); |
| 87 | grn_rc grn_dat_clear_dirty(grn_ctx *ctx, grn_dat *dat); |
| 88 | |
| 89 | grn_bool grn_dat_is_corrupt(grn_ctx *ctx, grn_dat *dat); |
| 90 | |
| 91 | size_t grn_dat_get_disk_usage(grn_ctx *ctx, grn_dat *dat); |
| 92 | |
| 93 | #ifdef __cplusplus |
| 94 | } |
| 95 | #endif |
| 96 | |