| 1 | /****************************************************** |
| 2 | XtraBackup: hot backup tool for InnoDB |
| 3 | (c) 2009-2012 Percona Inc. |
| 4 | Originally Created 3/3/2009 Yasufumi Kinoshita |
| 5 | Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko, |
| 6 | Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz. |
| 7 | |
| 8 | This program is free software; you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation; version 2 of the License. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 20 | |
| 21 | *******************************************************/ |
| 22 | |
| 23 | /* Data file read filter interface */ |
| 24 | |
| 25 | #ifndef XB_READ_FILT_H |
| 26 | #define XB_READ_FILT_H |
| 27 | |
| 28 | #include "changed_page_bitmap.h" |
| 29 | |
| 30 | typedef ulint space_id_t; |
| 31 | |
| 32 | struct xb_fil_cur_t; |
| 33 | |
| 34 | /* The read filter context */ |
| 35 | struct xb_read_filt_ctxt_t { |
| 36 | ib_int64_t offset; /*!< current file offset */ |
| 37 | ib_int64_t data_file_size; /*!< data file size */ |
| 38 | size_t buffer_capacity;/*!< read buffer capacity */ |
| 39 | space_id_t space_id; /*!< space id */ |
| 40 | /* The following fields used only in bitmap filter */ |
| 41 | /* Move these to union if any other filters are added in future */ |
| 42 | xb_page_bitmap_range *bitmap_range; /*!< changed page bitmap range |
| 43 | iterator for space_id */ |
| 44 | page_size_t page_size; /*!< page size */ |
| 45 | ulint filter_batch_end;/*!< the ending page id of the |
| 46 | current changed page block in |
| 47 | the bitmap */ |
| 48 | /** TODO: remove this default constructor */ |
| 49 | xb_read_filt_ctxt_t() : page_size(0) {} |
| 50 | }; |
| 51 | |
| 52 | /* The read filter */ |
| 53 | struct xb_read_filt_t { |
| 54 | void (*init)(xb_read_filt_ctxt_t* ctxt, |
| 55 | const xb_fil_cur_t* cursor, |
| 56 | ulint space_id); |
| 57 | void (*get_next_batch)(xb_read_filt_ctxt_t* ctxt, |
| 58 | ib_int64_t* read_batch_start, |
| 59 | ib_int64_t* read_batch_len); |
| 60 | void (*deinit)(xb_read_filt_ctxt_t* ctxt); |
| 61 | }; |
| 62 | |
| 63 | extern xb_read_filt_t rf_pass_through; |
| 64 | extern xb_read_filt_t rf_bitmap; |
| 65 | |
| 66 | #endif |
| 67 | |