~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/mf_iocache.cc

  • Committer: Olaf van der Spek
  • Date: 2011-08-13 15:57:32 UTC
  • mto: This revision was merged to the branch mainline in revision 2407.
  • Revision ID: olafvdspek@gmail.com-20110813155732-jrr1aq3gyeyxl9qv
Move flush() into iocache

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
 
64
64
using namespace std;
65
65
 
66
 
namespace drizzled
67
 
{
68
 
namespace internal
69
 
{
 
66
namespace drizzled {
 
67
namespace internal {
70
68
 
71
69
static int _my_b_read(io_cache_st *info, unsigned char *Buffer, size_t Count);
72
70
static int _my_b_write(io_cache_st *info, const unsigned char *Buffer, size_t Count);
329
327
    if (type == WRITE_CACHE && type_arg == READ_CACHE)
330
328
      end_of_file=my_b_tell(this);
331
329
    /* flush cache if we want to reuse it */
332
 
    if (!clear_cache && my_b_flush_io_cache(this, 1))
 
330
    if (!clear_cache && flush(1))
333
331
      return 1;
334
332
    pos_in_file=seek_offset;
335
333
    /* Better to do always do a seek */
341
339
    }
342
340
    else
343
341
    {
344
 
      write_end=(buffer + buffer_length -
345
 
                       (seek_offset & (IO_SIZE-1)));
 
342
      write_end= (buffer + buffer_length - (seek_offset & (IO_SIZE-1)));
346
343
      end_of_file= ~(my_off_t) 0;
347
344
    }
348
345
  }
514
511
  Count-=rest_length;
515
512
  info->write_pos+=rest_length;
516
513
 
517
 
  if (my_b_flush_io_cache(info,1))
 
514
  if (info->flush(1))
518
515
    return 1;
519
516
  if (Count >= IO_SIZE)
520
517
  {                                     /* Fill first intern buffer */
599
596
 * @brief
600
597
 *   Flush write cache 
601
598
 */
602
 
int my_b_flush_io_cache(io_cache_st *info, int need_append_buffer_lock)
 
599
static int my_b_flush_io_cache(io_cache_st *info, int need_append_buffer_lock)
603
600
{
604
601
  size_t length_local;
605
602
  bool append_cache= false;
661
658
  return 0;
662
659
}
663
660
 
 
661
int io_cache_st::flush(int need_append_buffer_lock)
 
662
{
 
663
  return my_b_flush_io_cache(this, need_append_buffer_lock);
 
664
}
 
665
 
664
666
/**
665
667
 * @brief
666
668
 *   Free an io_cache_st object