385.1.1
by Alexey Kopytov
Rebase of the parallel compression patch on new trunk + post-review |
1 |
/******************************************************
|
391.64.6
by Alexey Kopytov
s/Percona Inc/Percona Ireland Ltd/g |
2 |
Copyright (c) 2011 Percona Ireland Ltd.
|
385.1.1
by Alexey Kopytov
Rebase of the parallel compression patch on new trunk + post-review |
3 |
|
4 |
The xbstream format interface.
|
|
5 |
||
6 |
This program is free software; you can redistribute it and/or modify
|
|
7 |
it under the terms of the GNU General Public License as published by
|
|
8 |
the Free Software Foundation; version 2 of the License.
|
|
9 |
||
10 |
This program is distributed in the hope that it will be useful,
|
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
GNU General Public License for more details.
|
|
14 |
||
15 |
You should have received a copy of the GNU General Public License
|
|
16 |
along with this program; if not, write to the Free Software
|
|
17 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18 |
||
19 |
*******************************************************/
|
|
20 |
||
21 |
#ifndef XBSTREAM_H
|
|
22 |
#define XBSTREAM_H
|
|
23 |
||
24 |
#include <my_base.h> |
|
25 |
||
26 |
/* Magic value in a chunk header */
|
|
27 |
#define XB_STREAM_CHUNK_MAGIC "XBSTCK01"
|
|
28 |
||
29 |
/* Chunk flags */
|
|
30 |
/* Chunk can be ignored if unknown version/format */
|
|
31 |
#define XB_STREAM_FLAG_IGNORABLE 0x01
|
|
32 |
||
33 |
typedef struct xb_wstream_struct xb_wstream_t; |
|
34 |
||
35 |
typedef struct xb_wstream_file_struct xb_wstream_file_t; |
|
36 |
||
488
by Laurynas Biveinis
Merge C++ build support from 2.0 |
37 |
typedef enum { |
38 |
XB_STREAM_FMT_NONE, |
|
39 |
XB_STREAM_FMT_TAR, |
|
40 |
XB_STREAM_FMT_XBSTREAM
|
|
41 |
} xb_stream_fmt_t; |
|
42 |
||
385.1.1
by Alexey Kopytov
Rebase of the parallel compression patch on new trunk + post-review |
43 |
/************************************************************************
|
44 |
Write interface. */
|
|
45 |
||
516.1.1
by George O. Lorch III
Introducing xtrabackup with encryption. |
46 |
typedef ssize_t xb_stream_write_callback(xb_wstream_file_t *file, |
47 |
void *userdata, |
|
48 |
const void *buf, size_t len); |
|
49 |
||
385.1.1
by Alexey Kopytov
Rebase of the parallel compression patch on new trunk + post-review |
50 |
xb_wstream_t *xb_stream_write_new(void); |
51 |
||
52 |
xb_wstream_file_t *xb_stream_write_open(xb_wstream_t *stream, const char *path, |
|
516.1.1
by George O. Lorch III
Introducing xtrabackup with encryption. |
53 |
MY_STAT *mystat, void *userdata, |
54 |
xb_stream_write_callback *onwrite); |
|
385.1.1
by Alexey Kopytov
Rebase of the parallel compression patch on new trunk + post-review |
55 |
|
56 |
int xb_stream_write_data(xb_wstream_file_t *file, const void *buf, size_t len); |
|
57 |
||
58 |
int xb_stream_write_close(xb_wstream_file_t *file); |
|
59 |
||
60 |
int xb_stream_write_done(xb_wstream_t *stream); |
|
61 |
||
62 |
/************************************************************************
|
|
63 |
Read interface. */
|
|
64 |
||
65 |
typedef enum { |
|
66 |
XB_STREAM_READ_CHUNK, |
|
67 |
XB_STREAM_READ_EOF, |
|
68 |
XB_STREAM_READ_ERROR
|
|
69 |
} xb_rstream_result_t; |
|
70 |
||
71 |
typedef enum { |
|
72 |
XB_CHUNK_TYPE_UNKNOWN = '\0', |
|
73 |
XB_CHUNK_TYPE_PAYLOAD = 'P', |
|
74 |
XB_CHUNK_TYPE_EOF = 'E' |
|
75 |
} xb_chunk_type_t; |
|
76 |
||
77 |
typedef struct xb_rstream_struct xb_rstream_t; |
|
78 |
||
79 |
typedef struct { |
|
80 |
uchar flags; |
|
81 |
xb_chunk_type_t type; |
|
82 |
uint pathlen; |
|
83 |
char path[FN_REFLEN]; |
|
84 |
size_t length; |
|
85 |
my_off_t offset; |
|
86 |
void *data; |
|
87 |
ulong checksum; |
|
88 |
} xb_rstream_chunk_t; |
|
89 |
||
90 |
xb_rstream_t *xb_stream_read_new(void); |
|
91 |
||
92 |
xb_rstream_result_t xb_stream_read_chunk(xb_rstream_t *stream, |
|
93 |
xb_rstream_chunk_t *chunk); |
|
94 |
||
95 |
int xb_stream_read_done(xb_rstream_t *stream); |
|
96 |
||
97 |
#endif
|