1/*****************************************************************************
2
3Copyright (C) 2013, 2017 MariaDB Corporation. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc.,
1551 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
27Helper functions for extracting/storing page compression and
28atomic writes information to table space.
29
30Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com
31***********************************************************************/
32
33/****************************************************************//**
34For page compressed pages compress the page before actual write
35operation.
36@return compressed page to be written*/
37UNIV_INTERN
38byte*
39fil_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/****************************************************************//**
53For page compressed pages decompress the page after actual read
54operation. */
55UNIV_INTERN
56void
57fil_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