Class PageHandler<X,​R>

    • Constructor Detail

      • PageHandler

        public PageHandler()
    • Method Detail

      • run

        public abstract R run​(int cacheId,
                              long pageId,
                              long page,
                              long pageAddr,
                              PageIO io,
                              Boolean walPlc,
                              X arg,
                              int intArg,
                              IoStatisticsHolder statHolder)
                       throws IgniteCheckedException
        Parameters:
        cacheId - Cache ID.
        pageId - Page ID.
        page - Page absolute pointer.
        pageAddr - Page address.
        io - IO.
        walPlc - Full page WAL record policy.
        arg - Argument.
        intArg - Argument of type int.
        statHolder - Statistics holder to track IO operations.
        Returns:
        Result.
        Throws:
        IgniteCheckedException - If failed.
      • releaseAfterWrite

        public boolean releaseAfterWrite​(int cacheId,
                                         long pageId,
                                         long page,
                                         long pageAddr,
                                         X arg,
                                         int intArg)
        Parameters:
        cacheId - Cache ID.
        pageId - Page ID.
        page - Page pointer.
        pageAddr - Page address.
        arg - Argument.
        intArg - Argument of type int.
        Returns:
        true If release.
      • readPage

        public static <X,​R> R readPage​(PageMemory pageMem,
                                             int cacheId,
                                             long pageId,
                                             PageLockListener lsnr,
                                             PageHandler<X,​R> h,
                                             X arg,
                                             int intArg,
                                             R lockFailed,
                                             IoStatisticsHolder statHolder,
                                             PageIoResolver pageIoRslvr)
                                      throws IgniteCheckedException
        Parameters:
        pageMem - Page memory.
        cacheId - Cache ID.
        pageId - Page ID.
        lsnr - Lock listener.
        h - Handler.
        arg - Argument.
        intArg - Argument of type int.
        lockFailed - Result in case of lock failure due to page recycling.
        statHolder - Statistics holder to track IO operations.
        Returns:
        Handler result.
        Throws:
        IgniteCheckedException - If failed.
      • readPage

        public static <X,​R> R readPage​(PageMemory pageMem,
                                             int cacheId,
                                             long pageId,
                                             long page,
                                             PageLockListener lsnr,
                                             PageHandler<X,​R> h,
                                             X arg,
                                             int intArg,
                                             R lockFailed,
                                             IoStatisticsHolder statHolder,
                                             PageIoResolver pageIoRslvr)
                                      throws IgniteCheckedException
        Parameters:
        pageMem - Page memory.
        cacheId - Cache ID.
        pageId - Page ID.
        page - Page pointer.
        lsnr - Lock listener.
        h - Handler.
        arg - Argument.
        intArg - Argument of type int.
        lockFailed - Result in case of lock failure due to page recycling.
        statHolder - Statistics holder to track IO operations.
        Returns:
        Handler result.
        Throws:
        IgniteCheckedException - If failed.
      • readLock

        public static long readLock​(PageMemory pageMem,
                                    int cacheId,
                                    long pageId,
                                    long page,
                                    PageLockListener lsnr)
        Parameters:
        pageMem - Page memory.
        cacheId - Cache ID.
        pageId - Page ID.
        page - Page pointer.
        lsnr - Lock listener.
        Returns:
        Page address.
      • readUnlock

        public static void readUnlock​(PageMemory pageMem,
                                      int cacheId,
                                      long pageId,
                                      long page,
                                      long pageAddr,
                                      PageLockListener lsnr)
        Parameters:
        pageMem - Page memory.
        cacheId - Cache ID.
        pageId - Page ID.
        page - Page pointer.
        pageAddr - Page address (for-write pointer)
        lsnr - Lock listener.
      • writePage

        public static <X,​R> R writePage​(PageMemory pageMem,
                                              int grpId,
                                              long pageId,
                                              PageLockListener lsnr,
                                              PageHandler<X,​R> h,
                                              PageIO init,
                                              IgniteWriteAheadLogManager wal,
                                              Boolean walPlc,
                                              X arg,
                                              int intArg,
                                              R lockFailed,
                                              IoStatisticsHolder statHolder,
                                              PageIoResolver pageIoRslvr)
                                       throws IgniteCheckedException
        Parameters:
        pageMem - Page memory.
        grpId - Group ID.
        pageId - Page ID.
        lsnr - Lock listener.
        h - Handler.
        init - IO for new page initialization or null if it is an existing page.
        wal - Write ahead log.
        walPlc - Full page WAL record policy.
        arg - Argument.
        intArg - Argument of type int.
        lockFailed - Result in case of lock failure due to page recycling.
        statHolder - Statistics holder to track IO operations.
        Returns:
        Handler result.
        Throws:
        IgniteCheckedException - If failed.
      • writePage

        public static <X,​R> R writePage​(PageMemory pageMem,
                                              int grpId,
                                              long pageId,
                                              long page,
                                              PageLockListener lsnr,
                                              PageHandler<X,​R> h,
                                              PageIO init,
                                              IgniteWriteAheadLogManager wal,
                                              Boolean walPlc,
                                              X arg,
                                              int intArg,
                                              R lockFailed,
                                              IoStatisticsHolder statHolder,
                                              PageIoResolver pageIoRslvr)
                                       throws IgniteCheckedException
        Parameters:
        pageMem - Page memory.
        grpId - Group ID.
        pageId - Page ID.
        page - Page pointer.
        lsnr - Lock listener.
        h - Handler.
        init - IO for new page initialization or null if it is an existing page.
        wal - Write ahead log.
        walPlc - Full page WAL record policy.
        arg - Argument.
        intArg - Argument of type int.
        lockFailed - Result in case of lock failure due to page recycling.
        statHolder - Statistics holder to track IO operations.
        Returns:
        Handler result.
        Throws:
        IgniteCheckedException - If failed.
      • writeUnlock

        public static void writeUnlock​(PageMemory pageMem,
                                       int cacheId,
                                       long pageId,
                                       long page,
                                       long pageAddr,
                                       PageLockListener lsnr,
                                       Boolean walPlc,
                                       boolean dirty)
        Parameters:
        pageMem - Page memory.
        cacheId - Cache ID.
        pageId - Page ID.
        page - Page pointer.
        pageAddr - Page address.
        lsnr - Lock listener.
        walPlc - Full page WAL record policy.
        dirty - Page is dirty.
      • writeLock

        public static long writeLock​(PageMemory pageMem,
                                     int cacheId,
                                     long pageId,
                                     long page,
                                     PageLockListener lsnr,
                                     boolean tryLock)
        Parameters:
        pageMem - Page memory.
        cacheId - Cache ID.
        pageId - Page ID.
        page - Page pointer.
        lsnr - Lock listener.
        tryLock - Only try to lock without waiting.
        Returns:
        Page address or 0 if failed to lock due to recycling.
      • isWalDeltaRecordNeeded

        public static boolean isWalDeltaRecordNeeded​(PageSupport pageMem,
                                                     int cacheId,
                                                     long pageId,
                                                     long page,
                                                     IgniteWriteAheadLogManager wal,
                                                     @Nullable
                                                     @Nullable Boolean walPlc)
        Parameters:
        pageMem - Page memory.
        cacheId - Cache ID.
        pageId - Page ID.
        page - Page pointer.
        wal - Write ahead log.
        walPlc - Full page WAL record policy.
        Returns:
        true If we need to make a delta WAL record for the change in this page.
      • copyMemory

        public static void copyMemory​(ByteBuffer src,
                                      long srcOff,
                                      ByteBuffer dst,
                                      long dstOff,
                                      long cnt)
        Parameters:
        src - Source.
        srcOff - Source offset in bytes.
        dst - Destination.
        dstOff - Destination offset in bytes.
        cnt - Bytes count to copy.
      • zeroMemory

        public static void zeroMemory​(ByteBuffer buf,
                                      int off,
                                      int len)
        Will zero memory in buf
        Parameters:
        buf - Buffer.
        off - Offset.
        len - Length.
      • copyMemory

        public static void copyMemory​(long srcAddr,
                                      long srcOff,
                                      long dstAddr,
                                      long dstOff,
                                      long cnt)
        Parameters:
        srcAddr - Source.
        srcOff - Source offset in bytes.
        dstAddr - Destination.
        dstOff - Destination offset in bytes.
        cnt - Bytes count to copy.