~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/archive/azio.h

  • Committer: Brian Aker
  • Date: 2010-12-18 02:06:13 UTC
  • Revision ID: brian@tangent.org-20101218020613-8lxhcvsy812bu960
Formatting + remove default from switch/case.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
#include <drizzled/common.h>
43
43
#include "drizzled/internal/my_sys.h"
44
 
 
 
44
#include <string.h>
45
45
#include <zlib.h>
46
46
 
47
47
#ifdef  __cplusplus
224
224
  AZ_METHOD_MAX
225
225
} az_method;
226
226
 
227
 
typedef struct azio_container_st azio_container_st;
 
227
typedef class azio_container azio_container;
228
228
 
229
 
struct azio_container_st {
 
229
class azio_container {
 
230
public:
230
231
  int fd;
231
232
  az_thread_type ready;
232
233
  size_t offset;
235
236
  pthread_mutex_t thresh_mutex;
236
237
  pthread_cond_t threshhold;
237
238
  pthread_t mainthread;            /* Thread descriptor */
 
239
 
 
240
  azio_container():
 
241
    fd(0),
 
242
    offset(0),
 
243
    read_size(0),
 
244
    buffer(NULL),
 
245
    mainthread(0)
 
246
  {}
 
247
 
238
248
};
239
249
 
240
250
 
241
 
typedef struct azio_stream {
 
251
typedef class azio_stream {
 
252
public:
242
253
  z_stream stream;
243
 
  int      z_err;   /* error code for last stream operation */
244
 
  int      z_eof;   /* set if end of input file */
245
 
  int     file;   /* .gz file */
246
 
  Byte     *inbuf;  /* input buffer */
247
 
  Byte     buffer1[AZ_BUFSIZE_READ];  /* input buffer */
248
 
  Byte     buffer2[AZ_BUFSIZE_READ];  /* input buffer */
249
 
  Byte     outbuf[AZ_BUFSIZE_WRITE]; /* output buffer */
250
 
  int      aio_inited; /* Are we good to go */
251
 
  uLong    crc;     /* crc32 of uncompressed data */
252
 
  char     *msg;    /* error message */
253
 
  char     mode;    /* 'w' or 'r' */
254
 
  size_t  start;   /* start of compressed data in file (header skipped) */
255
 
  size_t  in;      /* bytes into deflate or inflate */
256
 
  size_t  out;     /* bytes out of deflate or inflate */
257
 
  size_t  pos;     /* bytes out of deflate or inflate */
258
 
  int      back;    /* one character push-back */
259
 
  int      last;    /* true if push-back is last character */
 
254
  int z_err;    /* error code for last stream operation */
 
255
  int z_eof;    /* set if end of input file */
 
256
  int file;     /* .gz file */
 
257
  Byte *inbuf;  /* input buffer */
 
258
  Byte buffer1[AZ_BUFSIZE_READ];  /* input buffer */
 
259
  Byte buffer2[AZ_BUFSIZE_READ];  /* input buffer */
 
260
  Byte outbuf[AZ_BUFSIZE_WRITE]; /* output buffer */
 
261
  int aio_inited; /* Are we good to go */
 
262
  uLong crc;      /* crc32 of uncompressed data */
 
263
  char *msg;      /* error message */
 
264
  char mode;      /* 'w' or 'r' */
 
265
  size_t start;   /* start of compressed data in file (header skipped) */
 
266
  size_t in;      /* bytes into deflate or inflate */
 
267
  size_t out;     /* bytes out of deflate or inflate */
 
268
  size_t pos;     /* bytes out of deflate or inflate */
 
269
  int back;    /* one character push-back */
 
270
  int last;    /* true if push-back is last character */
260
271
  unsigned char version;   /* Version */
261
272
  unsigned char minor_version;   /* Version */
262
273
  unsigned int block_size;   /* Block Size */
271
282
  unsigned int frm_length;   /* Position for start of FRM */
272
283
  unsigned int comment_start_pos;   /* Position for start of comment */
273
284
  unsigned int comment_length;   /* Position for start of comment */
 
285
 
274
286
#ifdef AZIO_AIO
275
 
  azio_container_st container;
 
287
  azio_container container;
276
288
#endif
277
289
  az_method method;
278
290
  char *row_ptr;
 
291
 
 
292
  azio_stream():
 
293
    z_err(0),
 
294
    z_eof(0),
 
295
    file(0),
 
296
    inbuf(NULL),
 
297
    aio_inited(0),
 
298
    crc(0),
 
299
    msg(NULL),
 
300
    mode(0),
 
301
    start(0),
 
302
    in(0),
 
303
    out(0),
 
304
    pos(0),
 
305
    back(0),
 
306
    last(0),
 
307
    version(0),
 
308
    minor_version(0),
 
309
    block_size(0),
 
310
    check_point(0),
 
311
    forced_flushes(0),
 
312
    rows(0),
 
313
    auto_increment(0),
 
314
    longest_row(0),
 
315
    shortest_row(0),
 
316
    dirty(0),
 
317
    frm_start_pos(0),
 
318
    frm_length(0),
 
319
    comment_start_pos(0),
 
320
    comment_length(0),
 
321
    row_ptr(NULL)
 
322
 {
 
323
    memset(buffer1, 0, AZ_BUFSIZE_READ);
 
324
    memset(buffer2, 0, AZ_BUFSIZE_READ);
 
325
    memset(outbuf, 0, AZ_BUFSIZE_WRITE);
 
326
 }
 
327
 
279
328
} azio_stream;
280
329
 
281
330
                        /* basic functions */