Interface PageStore

    • Method Detail

      • addWriteListener

        void addWriteListener​(PageWriteListener lsnr)
        Parameters:
        lsnr - Page write listener to set.
      • removeWriteListener

        void removeWriteListener​(PageWriteListener lsnr)
        Parameters:
        lsnr - Page write listener to remove.
      • exists

        boolean exists()
        Checks if page exists.
        Returns:
        True if page exists.
      • pages

        int pages()
        Gets number of allocated pages.
        Returns:
        Number of allocated pages.
      • read

        boolean 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
        Returns:
        true if page has been read successfully, false if page hasn't been written yet.
        Throws:
        IgniteCheckedException - If reading failed (IO error occurred).
      • write

        void write​(long pageId,
                   ByteBuffer pageBuf,
                   int tag,
                   boolean calculateCrc)
            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.
        calculateCrc - if False crc calculation will be forcibly skipped.
        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.
      • version

        int version()
        Returns:
        Page store version.
      • beginRecover

        void beginRecover()
        Starts recover process.
      • truncate

        void truncate​(int tag)
               throws StorageException
        Truncates and deletes partition file.
        Parameters:
        tag - New partition tag.
        Throws:
        StorageException - If failed.
      • getPageSize

        int getPageSize()
        Returns:
        Page size in bytes.
      • getBlockSize

        int getBlockSize()
        Returns:
        Storage block size or negative value if unknown or not supported.
      • size

        long size()
        Returns:
        Size of the storage in bytes. May differ from pages() * getPageSize() due to delayed writes or due to other implementation specific details.
      • getSparseSize

        long getSparseSize()
        Returns:
        Size of the storage adjusted for sparsity in bytes or negative value if not supported. Should be less than or equal to size().
        See Also:
        punchHole(long, int)
      • punchHole

        void punchHole​(long pageId,
                       int usefulBytes)
        Should free all the extra storage space after the given number of useful bytes in the given page.
        Parameters:
        pageId - Page id.
        usefulBytes - Number of meaningful bytes from the beginning of the page.