| 1 | /* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
| 2 | // vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: |
| 3 | #ident "$Id$" |
| 4 | /*====== |
| 5 | This file is part of PerconaFT. |
| 6 | |
| 7 | |
| 8 | Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. |
| 9 | |
| 10 | PerconaFT is free software: you can redistribute it and/or modify |
| 11 | it under the terms of the GNU General Public License, version 2, |
| 12 | as published by the Free Software Foundation. |
| 13 | |
| 14 | PerconaFT is distributed in the hope that it will be useful, |
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | GNU General Public License for more details. |
| 18 | |
| 19 | You should have received a copy of the GNU General Public License |
| 20 | along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. |
| 21 | |
| 22 | ---------------------------------------- |
| 23 | |
| 24 | PerconaFT is free software: you can redistribute it and/or modify |
| 25 | it under the terms of the GNU Affero General Public License, version 3, |
| 26 | as published by the Free Software Foundation. |
| 27 | |
| 28 | PerconaFT is distributed in the hope that it will be useful, |
| 29 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 30 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 31 | GNU Affero General Public License for more details. |
| 32 | |
| 33 | You should have received a copy of the GNU Affero General Public License |
| 34 | along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. |
| 35 | ======= */ |
| 36 | |
| 37 | #ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved." |
| 38 | |
| 39 | #pragma once |
| 40 | |
| 41 | #include "toku_portability.h" |
| 42 | #include "ft/txn/txn.h" |
| 43 | #include "ft/cachetable/cachetable.h" |
| 44 | #include "ft/comparator.h" |
| 45 | #include "ft/ft-ops.h" |
| 46 | |
| 47 | // The loader callbacks are C functions and need to be defined as such |
| 48 | |
| 49 | typedef void (*ft_loader_error_func)(DB *, int which_db, int err, DBT *key, DBT *val, void *); |
| 50 | |
| 51 | typedef int (*ft_loader_poll_func)(void *, float progress); |
| 52 | |
| 53 | typedef struct ft_loader_s *FTLOADER; |
| 54 | |
| 55 | int toku_ft_loader_open (FTLOADER *bl, |
| 56 | CACHETABLE cachetable, |
| 57 | generate_row_for_put_func g, |
| 58 | DB *src_db, |
| 59 | int N, |
| 60 | FT_HANDLE ft_hs[/*N*/], DB* dbs[/*N*/], |
| 61 | const char * new_fnames_in_env[/*N*/], |
| 62 | ft_compare_func bt_compare_functions[/*N*/], |
| 63 | const char *temp_file_template, |
| 64 | LSN load_lsn, |
| 65 | TOKUTXN txn, |
| 66 | bool reserve_memory, |
| 67 | uint64_t reserve_memory_size, |
| 68 | bool compress_intermediates, |
| 69 | bool allow_puts); |
| 70 | |
| 71 | int toku_ft_loader_put (FTLOADER bl, DBT *key, DBT *val); |
| 72 | |
| 73 | int toku_ft_loader_close (FTLOADER bl, |
| 74 | ft_loader_error_func error_callback, void *, |
| 75 | ft_loader_poll_func poll_callback, void *); |
| 76 | |
| 77 | int toku_ft_loader_abort(FTLOADER bl, |
| 78 | bool is_error); |
| 79 | |
| 80 | // For test purposes only |
| 81 | void toku_ft_loader_set_size_factor(uint32_t factor); |
| 82 | |
| 83 | size_t ft_loader_leafentry_size(size_t key_size, size_t val_size, TXNID xid); |
| 84 | |