org.apache.ignite.internal.pagemem.store

## Interface PageStore

All Known Implementing Classes:
  FilePageStore

    public interface PageStore

Persistent store of pages.

### Method Summary

Methods
`long` `allocatePage()` Allocates next page index.
`void` `ensure()`
`boolean` `exists()` Checks if page exists.
`long` `pageOffset(long pageId)` Gets page offset within the store file.
`int` `pages()` Gets number of allocated pages.
`void` `read(long pageId, ByteBuffer pageBuf, boolean keepCrc)` Reads a page.
`void` `readHeader(ByteBuffer buf)` Reads a header.
`void` `sync()` Sync method used to ensure that the given pages are guaranteed to be written to the store.
`void` `write(long pageId, ByteBuffer pageBuf, int tag)` Writes a page.

### Method Detail

#### exists

    boolean exists()

Checks if page exists.

Returns:
  `True` if page exists.

#### allocatePage

    long allocatePage()
                      throws IgniteCheckedException

Allocates next page index.

Returns:
  Next page index.
Throws:
  `IgniteCheckedException` - If failed to allocate.

#### pages

    int pages()

Gets number of allocated pages.

Returns:
  Number of allocated pages.

#### read

    void read(long pageId,
            ByteBuffer pageBuf,
            boolean keepCrc)
              throws IgniteCheckedException

Reads a page.

Parameters:
  `pageId` - Page ID.
  `pageBuf` - Page buffer to read into.
  `keepCrc` - by default reading zeroes CRC which was on file, but you can keep it in pageBuf if set keepCrc
Throws:
  `IgniteCheckedException` - If reading failed (IO error occurred).

#### readHeader

    void readHeader(ByteBuffer buf)
                    throws IgniteCheckedException

Reads a header.

Parameters:
  `buf` - Buffer to write to.
Throws:
  `IgniteCheckedException` - If failed.

#### write

    void write(long pageId,
             ByteBuffer pageBuf,
             int tag)
               throws IgniteCheckedException

Writes a page.

Parameters:
  `pageId` - Page ID.
  `pageBuf` - Page buffer to write.
  `tag` - Partition file version, 1-based incrementing counter. For outdated pages `tag` has lower value, and write does nothing
Throws:
  `IgniteCheckedException` - If page writing failed (IO error occurred).

#### pageOffset

    long pageOffset(long pageId)

Gets page offset within the store file.

Parameters:
  `pageId` - Page ID.
Returns:
  Page offset.

#### sync

    void sync()
              throws IgniteCheckedException

Sync method used to ensure that the given pages are guaranteed to be written to the store.

Throws:
  `IgniteCheckedException` - If sync failed (IO error occurred).

#### ensure

    void ensure()
                throws IgniteCheckedException

Throws:
  `IgniteCheckedException` - If sync failed (IO error occurred).

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.1.0
Release Date | : July 20 2017