pageFile.assertLoaded();
public Transaction tx() { assertLoaded(); return new Transaction(this); }
public long getFreePageCount() { assertLoaded(); return freeList.rangeSize(); }
/** * Loads a page from disk. * * @param pageId * the id of the page to load * @param marshaller * the marshaler to use to load the data portion of the Page, may be null if you do not wish to load the data. * @return The page with the given id * @throws IOException * If an disk error occurred. * @throws IllegalStateException * if the PageFile is not loaded */ public <T> Page<T> load(long pageId, Marshaller<T> marshaller) throws IOException { pageFile.assertLoaded(); Page<T> page = new Page<T>(pageId); load(page, marshaller); return page; }
/** * Frees up a previously allocated sequence of pages so that it can be re-allocated again. * * @param page the initial page of the sequence that will be getting freed * @param count the number of pages in the sequence * * @throws IOException * If an disk error occurred. * @throws IllegalStateException * if the PageFile is not loaded */ public <T> void free(Page<T> page, int count) throws IOException { pageFile.assertLoaded(); long offsetPage = page.getPageId(); while (count-- > 0) { if (page == null) { page = load(offsetPage, null); } free(page); page = null; // Increment the offsetPage value since using it depends on the current count. offsetPage++; } }
assertLoaded(); if (count <= 0) { throw new IllegalArgumentException("The allocation count must be larger than zero");
pageFile.assertLoaded();
pageFile.assertLoaded();
pageFile.assertLoaded();
public Transaction tx() { assertLoaded(); return new Transaction(this); }
public long getFreePageCount() { assertLoaded(); return freeList.rangeSize(); }
public Transaction tx() { assertLoaded(); return new Transaction(this); }
public Transaction tx() { assertLoaded(); return new Transaction(this); }
public long getFreePageCount() { assertLoaded(); return freeList.rangeSize(); }
public long getFreePageCount() { assertLoaded(); return freeList.rangeSize(); }
/** * Loads a page from disk. * * @param pageId * the id of the page to load * @param marshaller * the marshaler to use to load the data portion of the Page, may be null if you do not wish to load the data. * @return The page with the given id * @throws IOException * If an disk error occurred. * @throws IllegalStateException * if the PageFile is not loaded */ public <T> Page<T> load(long pageId, Marshaller<T> marshaller) throws IOException { pageFile.assertLoaded(); Page<T> page = new Page<T>(pageId); load(page, marshaller); return page; }
/** * Loads a page from disk. * * @param pageId * the id of the page to load * @param marshaller * the marshaler to use to load the data portion of the Page, may be null if you do not wish to load the data. * @return The page with the given id * @throws IOException * If an disk error occurred. * @throws IllegalStateException * if the PageFile is not loaded */ public <T> Page<T> load(long pageId, Marshaller<T> marshaller) throws IOException { pageFile.assertLoaded(); Page<T> page = new Page<T>(pageId); load(page, marshaller); return page; }
/** * Loads a page from disk. * * @param pageId * the id of the page to load * @param marshaller * the marshaler to use to load the data portion of the Page, may be null if you do not wish to load the data. * @return The page with the given id * @throws IOException * If an disk error occurred. * @throws IllegalStateException * if the PageFile is not loaded */ public <T> Page<T> load(long pageId, Marshaller<T> marshaller) throws IOException { pageFile.assertLoaded(); Page<T> page = new Page<T>(pageId); load(page, marshaller); return page; }
/** * Frees up a previously allocated sequence of pages so that it can be re-allocated again. * * @param page the initial page of the sequence that will be getting freed * @param count the number of pages in the sequence * * @throws IOException * If an disk error occurred. * @throws IllegalStateException * if the PageFile is not loaded */ public <T> void free(Page<T> page, int count) throws IOException { pageFile.assertLoaded(); long offsetPage = page.getPageId(); while (count-- > 0) { if (page == null) { page = load(offsetPage, null); } free(page); page = null; // Increment the offsetPage value since using it depends on the current count. offsetPage++; } }
/** * Frees up a previously allocated sequence of pages so that it can be re-allocated again. * * @param page the initial page of the sequence that will be getting freed * @param count the number of pages in the sequence * * @throws IOException * If an disk error occurred. * @throws IllegalStateException * if the PageFile is not loaded */ public <T> void free(Page<T> page, int count) throws IOException { pageFile.assertLoaded(); long offsetPage = page.getPageId(); while (count-- > 0) { if (page == null) { page = load(offsetPage, null); } free(page); page = null; // Increment the offsetPage value since using it depends on the current count. offsetPage++; } }