18
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef DRIZZLED_INTERNAL_IOCACHE_H
22
#define DRIZZLED_INTERNAL_IOCACHE_H
24
#include "drizzled/internal/my_sys.h"
21
#ifndef mysys_iocache_h
22
#define mysys_iocache_h
24
#include <mysys/my_sys.h>
26
#if defined(__cplusplus)
31
30
struct st_io_cache;
32
31
typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
133
132
void* arg; /* for use by pre/post_read */
134
133
char *file_name; /* if used with 'open_cached_file' */
135
134
char *dir,*prefix;
136
int file; /* file descriptor */
135
File file; /* file descriptor */
138
137
seek_not_done is set by my_b_seek() to inform the upcoming read/write
139
138
operation that a seek needs to be preformed prior to the actual I/O
168
extern int init_io_cache(IO_CACHE *info,int file,size_t cachesize,
167
/* tell write offset in the SEQ_APPEND cache */
168
int my_b_copy_to_file(IO_CACHE *cache, FILE *file);
169
my_off_t my_b_append_tell(IO_CACHE* info);
170
my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
172
extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize,
169
173
enum cache_type type,my_off_t seek_offset,
170
174
bool use_async_io, myf cache_myflags);
171
175
extern bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
172
176
my_off_t seek_offset,bool use_async_io,
173
177
bool clear_cache);
174
178
extern void setup_io_cache(IO_CACHE* info);
179
extern int _my_b_read(IO_CACHE *info,unsigned char *Buffer,size_t Count);
180
extern int _my_b_read_r(IO_CACHE *info,unsigned char *Buffer,size_t Count);
175
181
extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare,
176
182
IO_CACHE *write_cache, uint32_t num_threads);
177
183
extern void remove_io_thread(IO_CACHE *info);
184
extern int _my_b_seq_read(IO_CACHE *info,unsigned char *Buffer,size_t Count);
178
185
extern int _my_b_get(IO_CACHE *info);
179
186
extern int _my_b_async_read(IO_CACHE *info,unsigned char *Buffer,size_t Count);
187
extern int _my_b_write(IO_CACHE *info,const unsigned char *Buffer,
189
extern int my_b_append(IO_CACHE *info,const unsigned char *Buffer,
191
extern int my_b_safe_write(IO_CACHE *info,const unsigned char *Buffer,
181
194
extern int my_block_write(IO_CACHE *info, const unsigned char *Buffer,
182
195
size_t Count, my_off_t pos);
185
198
#define flush_io_cache(info) my_b_flush_io_cache((info),1)
187
200
extern int end_io_cache(IO_CACHE *info);
201
extern size_t my_b_fill(IO_CACHE *info);
202
extern void my_b_seek(IO_CACHE *info,my_off_t pos);
203
extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length);
204
extern my_off_t my_b_filelength(IO_CACHE *info);
205
extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...);
206
extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
188
207
extern bool open_cached_file(IO_CACHE *cache,const char *dir,
189
208
const char *prefix, size_t cache_size,
190
209
myf cache_myflags);
191
210
extern bool real_open_cached_file(IO_CACHE *cache);
192
211
extern void close_cached_file(IO_CACHE *cache);
194
} /* namespace internal */
195
} /* namespace drizzled */
213
#if defined(__cplusplus)
197
#endif /* DRIZZLED_INTERNAL_IOCACHE_H */