| 1 | /* |
| 2 | * ai_btree.h |
| 3 | * |
| 4 | * Copyright (C) 2013-2014 Aerospike, Inc. |
| 5 | * |
| 6 | * Portions may be licensed to Aerospike, Inc. under one or more contributor |
| 7 | * license agreements. |
| 8 | * |
| 9 | * This program is free software: you can redistribute it and/or modify it under |
| 10 | * the terms of the GNU Affero General Public License as published by the Free |
| 11 | * Software Foundation, either version 3 of the License, or (at your option) any |
| 12 | * later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 16 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
| 17 | * details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Affero General Public License |
| 20 | * along with this program. If not, see http://www.gnu.org/licenses/ |
| 21 | */ |
| 22 | |
| 23 | #pragma once |
| 24 | |
| 25 | #include "base/secondary_index.h" |
| 26 | |
| 27 | #include "ai_obj.h" |
| 28 | #include "btreepriv.h" |
| 29 | |
| 30 | #include <citrusleaf/cf_ll.h> |
| 31 | |
| 32 | void ai_btree_create(as_sindex_metadata *imd); |
| 33 | |
| 34 | void ai_btree_destroy(as_sindex_metadata *imd); |
| 35 | |
| 36 | int ai_btree_put(as_sindex_metadata *imd, as_sindex_pmetadata *pimd, void *key, cf_digest *value); |
| 37 | |
| 38 | int ai_btree_delete(as_sindex_metadata *imd, as_sindex_pmetadata *pimd, void *key, cf_digest *val); |
| 39 | |
| 40 | int ai_btree_query(as_sindex_metadata *imd, as_sindex_range *range, as_sindex_qctx *qctx); |
| 41 | |
| 42 | uint64_t ai_btree_get_isize(as_sindex_metadata *imd); |
| 43 | |
| 44 | uint64_t ai_btree_get_nsize(as_sindex_metadata *imd); |
| 45 | |
| 46 | uint64_t ai_btree_get_pimd_nsize(as_sindex_pmetadata *pimd); |
| 47 | |
| 48 | uint64_t ai_btree_get_pimd_isize(as_sindex_pmetadata *pimd); |
| 49 | |
| 50 | int ai_btree_list(char *ns, char *set, as_sindex_metadata **imds, int *num_indexes); |
| 51 | |
| 52 | uint64_t ai_btree_get_numkeys(as_sindex_metadata *imd); |
| 53 | |
| 54 | void ai_btree_dump(as_sindex_metadata *imd, char *fname, bool verbose); |
| 55 | |
| 56 | int ai_btree_build_defrag_list(as_sindex_metadata *imd, as_sindex_pmetadata *pimd, struct ai_obj *icol, ulong *nofst, ulong lim, uint64_t * tot_processed, uint64_t * tot_found, cf_ll *apk2d); |
| 57 | |
| 58 | bool ai_btree_defrag_list(as_sindex_metadata *imd, as_sindex_pmetadata *pimd, cf_ll *apk2d, ulong n2del, ulong *deleted); |
| 59 | |
| 60 | int ai_btree_key_hash_from_sbin(as_sindex_metadata *imd, as_sindex_bin_data *sbin); |
| 61 | |
| 62 | int ai_btree_key_hash(as_sindex_metadata *imd, void *skey); |
| 63 | |
| 64 | void ai_btree_delete_ibtr(bt *ibtr); |
| 65 | |
| 66 | void ai_btree_reinit_pimd(as_sindex_pmetadata *pimd, col_type_t sktype); |
| 67 | |
| 68 | void ai_btree_reset_pimd(as_sindex_pmetadata * pimd); |
| 69 | |