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
32void ai_btree_create(as_sindex_metadata *imd);
33
34void ai_btree_destroy(as_sindex_metadata *imd);
35
36int ai_btree_put(as_sindex_metadata *imd, as_sindex_pmetadata *pimd, void *key, cf_digest *value);
37
38int ai_btree_delete(as_sindex_metadata *imd, as_sindex_pmetadata *pimd, void *key, cf_digest *val);
39
40int ai_btree_query(as_sindex_metadata *imd, as_sindex_range *range, as_sindex_qctx *qctx);
41
42uint64_t ai_btree_get_isize(as_sindex_metadata *imd);
43
44uint64_t ai_btree_get_nsize(as_sindex_metadata *imd);
45
46uint64_t ai_btree_get_pimd_nsize(as_sindex_pmetadata *pimd);
47
48uint64_t ai_btree_get_pimd_isize(as_sindex_pmetadata *pimd);
49
50int ai_btree_list(char *ns, char *set, as_sindex_metadata **imds, int *num_indexes);
51
52uint64_t ai_btree_get_numkeys(as_sindex_metadata *imd);
53
54void ai_btree_dump(as_sindex_metadata *imd, char *fname, bool verbose);
55
56int 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
58bool ai_btree_defrag_list(as_sindex_metadata *imd, as_sindex_pmetadata *pimd, cf_ll *apk2d, ulong n2del, ulong *deleted);
59
60int ai_btree_key_hash_from_sbin(as_sindex_metadata *imd, as_sindex_bin_data *sbin);
61
62int ai_btree_key_hash(as_sindex_metadata *imd, void *skey);
63
64void ai_btree_delete_ibtr(bt *ibtr);
65
66void ai_btree_reinit_pimd(as_sindex_pmetadata *pimd, col_type_t sktype);
67
68void ai_btree_reset_pimd(as_sindex_pmetadata * pimd);
69