~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/iocache.h

  • Committer: Brian Aker
  • Date: 2011-02-12 08:10:17 UTC
  • mto: This revision was merged to the branch mainline in revision 2161.
  • Revision ID: brian@tangent.org-20110212081017-7793i41ybt7gp5ty
More removal of session from includes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#pragma once
 
21
#ifndef DRIZZLED_INTERNAL_IOCACHE_H
 
22
#define DRIZZLED_INTERNAL_IOCACHE_H
22
23
 
23
 
#include <drizzled/internal/my_sys.h>
 
24
#include "drizzled/internal/my_sys.h"
24
25
 
25
26
namespace drizzled
26
27
{
27
28
namespace internal
28
29
{
29
30
 
30
 
struct io_cache_st;
31
 
typedef int (*IO_CACHE_CALLBACK)(struct io_cache_st*);
 
31
struct st_io_cache;
 
32
typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
32
33
 
33
 
struct io_cache_st    /* Used when cacheing files */
 
34
struct st_io_cache    /* Used when cacheing files */
34
35
{
35
36
  /* Offset in file corresponding to the first byte of unsigned char* buffer. */
36
37
  my_off_t pos_in_file;
77
78
    my_b_read() will call read_function to fetch the data. read_function
78
79
    must never be invoked directly.
79
80
  */
80
 
  int (*read_function)(struct io_cache_st *,unsigned char *,size_t);
 
81
  int (*read_function)(struct st_io_cache *,unsigned char *,size_t);
81
82
  /*
82
83
    Same idea as in the case of read_function, except my_b_write() needs to
83
84
    be replaced with my_b_append() for a SEQ_READ_APPEND cache
84
85
  */
85
 
  int (*write_function)(struct io_cache_st *,const unsigned char *,size_t);
 
86
  int (*write_function)(struct st_io_cache *,const unsigned char *,size_t);
86
87
  /*
87
88
    Specifies the type of the cache. Depending on the type of the cache
88
89
    certain operations might not be available and yield unpredicatable
94
95
    Callbacks when the actual read I/O happens. These were added and
95
96
    are currently used for binary logging of LOAD DATA INFILE - when a
96
97
    block is read from the file, we create a block create/append event, and
97
 
    when io_cache_st is closed, we create an end event. These functions could,
 
98
    when IO_CACHE is closed, we create an end event. These functions could,
98
99
    of course be used for other things
99
100
  */
100
101
  IO_CACHE_CALLBACK pre_read;
124
125
    somewhere else
125
126
  */
126
127
  bool alloced_buffer;
 
128
#ifdef HAVE_AIOWAIT
 
129
  /*
 
130
    As inidicated by ifdef, this is for async I/O, which is not currently
 
131
    used (because it's not reliable on all systems)
 
132
  */
 
133
  uint32_t inited;
 
134
  my_off_t aio_read_pos;
 
135
  my_aio_result aio_result;
 
136
#endif
127
137
 
128
 
  io_cache_st() :
 
138
  st_io_cache() :
129
139
    pos_in_file(0),
130
140
    end_of_file(0),
131
141
    read_pos(0),
155
165
    read_length(0),
156
166
    myflags(0),
157
167
    alloced_buffer(0)
 
168
#ifdef HAVE_AIOWAIT
 
169
    ,
 
170
    inited(0),
 
171
    aio_read_pos(0),
 
172
    aio_result(0)
 
173
#endif
158
174
  { }
159
175
 
160
 
  ~io_cache_st()
 
176
  ~st_io_cache()
161
177
  { }
162
178
 
163
179
  void close_cached_file();
179
195
 
180
196
};
181
197
 
182
 
typedef struct io_cache_st IO_CACHE;    /* Used when cacheing files */
183
 
 
184
 
extern int _my_b_get(io_cache_st *info);
185
 
extern int _my_b_async_read(io_cache_st *info,unsigned char *Buffer,size_t Count);
186
 
 
187
 
extern int my_block_write(io_cache_st *info, const unsigned char *Buffer,
 
198
typedef struct st_io_cache IO_CACHE;    /* Used when cacheing files */
 
199
 
 
200
extern int _my_b_get(st_io_cache *info);
 
201
extern int _my_b_async_read(st_io_cache *info,unsigned char *Buffer,size_t Count);
 
202
 
 
203
extern int my_block_write(st_io_cache *info, const unsigned char *Buffer,
188
204
                          size_t Count, my_off_t pos);
189
 
extern int my_b_flush_io_cache(io_cache_st *info, int need_append_buffer_lock);
 
205
extern int my_b_flush_io_cache(st_io_cache *info, int need_append_buffer_lock);
190
206
 
191
207
#define flush_io_cache(info) my_b_flush_io_cache((info),1)
192
208
 
193
209
} /* namespace internal */
194
210
} /* namespace drizzled */
195
211
 
 
212
#endif /* DRIZZLED_INTERNAL_IOCACHE_H */