Beispiel #1
0
 PerPageCopy(PerPageCopy const& that)
 {
   store_ = that.store_;
   pagenos_ = that.pagenos_;
   for (std::size_t pageno : pagenos_)
     store_->ref_page(pageno);
 }
Beispiel #2
0
 // Copy and move
 ChunkedData(ChunkedData const& that)
 {
   store_ = that.store_;
   pagenos_ = that.pagenos_;
   for (std::size_t pageno : pagenos_)
     store_->ref_page(pageno);
 }
Beispiel #3
0
 PerPageCopy& operator=(PerPageCopy const& that)
 {
   this->clear();
   store_ = that.store_;
   pagenos_ = that.pagenos_;
   for (std::size_t pageno : pagenos_)
     store_->ref_page(pageno);
   return *this;
 }
Beispiel #4
0
 ChunkedData& operator=(ChunkedData const& that)
 {
   this->clear();
   store_ = that.store_;
   pagenos_ = that.pagenos_;
   for (std::size_t pageno : pagenos_)
     store_->ref_page(pageno);
   return *this;
 }
Beispiel #5
0
 const void* page(std::size_t i) const
 {
   return store_->get_page(pagenos_[i]);
 }
Beispiel #6
0
 void clear()
 {
   for (std::size_t pageno : pagenos_)
     store_->unref_page(pageno);
   pagenos_.clear();
 }
Beispiel #7
0
  void testPageStore(PageStore& uut)
  {
    CPPUNIT_ASSERT_EQUAL(0, uut.getPageCount());
    int pageSize = uut.getPageSize();

    boost::shared_ptr<Page> p = uut.createPage();
    CPPUNIT_ASSERT_EQUAL(pageSize, p->getDataSize());

    populatePage(p);
    verifyPage(p);

    
    _ids.push_back(p->getId());

    for (int i = 1; i < 100; i++)
    {
      CPPUNIT_ASSERT_EQUAL(i, uut.getPageCount());
      p = uut.createPage();
      populatePage(p);
      _ids.push_back(i);
    }
    CPPUNIT_ASSERT_EQUAL(100, uut.getPageCount());

    for (int i = 0; i < 100; i++)
    {
      p = uut.getPage(_ids[i]);
      verifyPage(p);
    }

    uut.save();

    for (int i = 0; i < 100; i++)
    {
      p = uut.getPage(_ids[i]);
      verifyPage(p);
    }

    uut.flush();

    for (int i = 0; i < 100; i++)
    {
      p = uut.getPage(_ids[i]);
      verifyPage(p);
    }
  }