77
77
my_b_read() will call read_function to fetch the data. read_function
78
78
must never be invoked directly.
80
int (*read_function)(struct io_cache_st *,unsigned char *,size_t);
80
int (*read_function)(io_cache_st* ,unsigned char *,size_t);
82
82
Same idea as in the case of read_function, except my_b_write() needs to
83
83
be replaced with my_b_append() for a SEQ_READ_APPEND cache
85
int (*write_function)(struct io_cache_st *,const unsigned char *,size_t);
85
int (*write_function)(io_cache_st* ,const unsigned char *,size_t);
87
87
Specifies the type of the cache. Depending on the type of the cache
88
88
certain operations might not be available and yield unpredicatable
89
89
results. Details to be documented later
94
94
Callbacks when the actual read I/O happens. These were added and
157
157
alloced_buffer(0)
161
int block_write(const void*, size_t, my_off_t);
163
162
void close_cached_file();
164
163
bool real_open_cached_file();
165
164
int end_io_cache();
166
int init_io_cache(int file, size_t cachesize,
167
enum cache_type type, my_off_t seek_offset,
168
bool use_async_io, myf cache_myflags);
165
int init_io_cache(int file, size_t cachesize, cache_type type, my_off_t seek_offset, bool use_async_io, myf cache_myflags);
169
166
void init_functions();
171
bool reinit_io_cache(enum cache_type type_arg,
172
my_off_t seek_offset,
168
bool reinit_io_cache(cache_type type_arg, my_off_t seek_offset, bool use_async_io, bool clear_cache);
175
169
void setup_io_cache();
176
bool open_cached_file(const char *dir,
177
const char *prefix, size_t cache_size,
170
bool open_cached_file(const char *dir, const char *prefix, size_t cache_size, myf cache_myflags);
171
int flush(int need_append_buffer_lock= 1);
183
my_off_t tell() const
185
return pos_in_file + *current_pos - request_pos;
188
int read(void* Buffer0, size_t Count)
190
unsigned char* Buffer= reinterpret_cast<unsigned char*>(Buffer0);
191
if (read_pos + Count > read_end)
192
return read_function(this, Buffer, Count);
193
memcpy(Buffer, read_pos, Count);
198
int write(const void* Buffer0, size_t Count)
200
const unsigned char* Buffer= reinterpret_cast<const unsigned char*>(Buffer0);
201
if (write_pos + Count > write_end)
202
return write_function(this, Buffer, Count);
203
memcpy(write_pos, Buffer, Count);
182
typedef struct io_cache_st IO_CACHE; /* Used when cacheing files */
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);
187
extern int my_block_write(io_cache_st *info, const unsigned char *Buffer,
188
size_t Count, my_off_t pos);
189
extern int my_b_flush_io_cache(io_cache_st *info, int need_append_buffer_lock);
191
#define flush_io_cache(info) my_b_flush_io_cache((info),1)
193
209
} /* namespace internal */
194
210
} /* namespace drizzled */