| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (C) 2013, 2017 MariaDB Corporation. All Rights Reserved. |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify it under |
| 6 | the terms of the GNU General Public License as published by the Free Software |
| 7 | Foundation; version 2 of the License. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU General Public License along with |
| 14 | this program; if not, write to the Free Software Foundation, Inc., |
| 15 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 16 | |
| 17 | *****************************************************************************/ |
| 18 | |
| 19 | #ifndef fil0pagecompress_h |
| 20 | #define fil0pagecompress_h |
| 21 | |
| 22 | #include "fsp0fsp.h" |
| 23 | #include "fsp0pagecompress.h" |
| 24 | |
| 25 | /******************************************************************//** |
| 26 | @file include/fil0pagecompress.h |
| 27 | Helper functions for extracting/storing page compression and |
| 28 | atomic writes information to table space. |
| 29 | |
| 30 | Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com |
| 31 | ***********************************************************************/ |
| 32 | |
| 33 | /****************************************************************//** |
| 34 | For page compressed pages compress the page before actual write |
| 35 | operation. |
| 36 | @return compressed page to be written*/ |
| 37 | UNIV_INTERN |
| 38 | byte* |
| 39 | fil_compress_page( |
| 40 | /*==============*/ |
| 41 | fil_space_t* space, /*!< in,out: tablespace (NULL during IMPORT) */ |
| 42 | byte* buf, /*!< in: buffer from which to write; in aio |
| 43 | this must be appropriately aligned */ |
| 44 | byte* out_buf, /*!< out: compressed buffer */ |
| 45 | ulint len, /*!< in: length of input buffer.*/ |
| 46 | ulint level, /* in: compression level */ |
| 47 | ulint block_size, /*!< in: block size */ |
| 48 | bool encrypted, /*!< in: is page also encrypted */ |
| 49 | ulint* out_len); /*!< out: actual length of compressed |
| 50 | page */ |
| 51 | |
| 52 | /****************************************************************//** |
| 53 | For page compressed pages decompress the page after actual read |
| 54 | operation. */ |
| 55 | UNIV_INTERN |
| 56 | void |
| 57 | fil_decompress_page( |
| 58 | /*================*/ |
| 59 | byte* page_buf, /*!< in: preallocated buffer or NULL */ |
| 60 | byte* buf, /*!< out: buffer from which to read; in aio |
| 61 | this must be appropriately aligned */ |
| 62 | ulong len, /*!< in: length of output buffer.*/ |
| 63 | ulint* write_size, /*!< in/out: Actual payload size of |
| 64 | the compressed data. */ |
| 65 | bool return_error=false); |
| 66 | /*!< in: true if only an error should |
| 67 | be produced when decompression fails. |
| 68 | By default this parameter is false. */ |
| 69 | #endif |
| 70 | |