NodePageReadOnlyTrx implements PageReadOnlyTrx { @Override public long pageKey(@Nonnegative final long recordKey, @Nonnull final IndexType indexType) { assertNotClosed(); checkArgument(recordKey >= 0, "recordKey must not be negative!"); return switch (indexType) { case PATH_SUMMARY -> recordKey >> Constants.PATHINP_REFERENCE_COUNT_EXPONENT; case REVISIONS -> recordKey >> Constants.UBPINP_REFERENCE_COUNT_EXPONENT; case PATH, DOCUMENT, CAS, NAME -> recordKey >> Constants.INP_REFERENCE_COUNT_EXPONENT; default -> recordKey >> Constants.NDP_NODE_COUNT_EXPONENT; }; } NodePageReadOnlyTrx(final long trxId,
      final InternalResourceManager<? extends NodeReadOnlyTrx, ? extends NodeTrx> resourceManager,
      final UberPage uberPage, final @Nonnegative int revision, final Reader reader,
      final @Nullable TransactionIntentLog trxIntentLog, final BufferManager resourceBufferManager,
      final @Nonnull RevisionRootPageReader revisionRootPageReader); @Override long getTrxId(); @Override ResourceManager<? extends NodeReadOnlyTrx, ? extends NodeTrx> getResourceManager(); @Override Optional<V> getRecord(@Nonnull final K key, @Nonnull final IndexType indexType,
      @Nonnegative final int index); @Override String getName(final int nameKey, @Nonnull final NodeKind nodeKind); @Override byte[] getRawName(final int nameKey, @Nonnull final NodeKind nodeKind); @Override RevisionRootPage loadRevRoot(@Nonnegative final int revisionKey); @Override NamePage getNamePage(@Nonnull final RevisionRootPage revisionRoot); @Override PathSummaryPage getPathSummaryPage(@Nonnull final RevisionRootPage revisionRoot); @Override PathPage getPathPage(@Nonnull final RevisionRootPage revisionRoot); @Override CASPage getCASPage(@Nonnull final RevisionRootPage revisionRoot); @Override DeweyIDPage getDeweyIDPage(@Nonnull final RevisionRootPage revisionRoot); @Override final UberPage getUberPage(); @Override Optional<Page> getRecordPage(@Nonnull final IndexLogKey indexLogKey); @Override IndirectPage dereferenceIndirectPageReference(final PageReference reference); @Nullable @Override PageReference getReferenceToLeafOfSubtree(final PageReference startReference, final @Nonnegative long pageKey,
      final int indexNumber, final @Nonnull IndexType indexType); @Override long pageKey(@Nonnegative final long recordKey, @Nonnull final IndexType indexType); @Override int getCurrentMaxIndirectPageTreeLevel(final IndexType indexType, final int index,
      final RevisionRootPage revisionRootPage); @Override RevisionRootPage getActualRevisionRootPage(); @Override String toString(); @Override void close(); @Override int getNameCount(final int key, @Nonnull final NodeKind kind); @Override boolean isClosed(); @Override int getRevisionNumber(); @Override Reader getReader(); @Override CommitCredentials getCommitCredentials(); @Override int recordPageOffset(final long key);  }
@Test public void testPageKey() { final var trx = new NodePageReadOnlyTrx(1, mock(InternalResourceManager.class), new UberPage(), 0, mock(Reader.class), mock(TransactionIntentLog.class), mock(BufferManager.class), mock(RevisionRootPageReader.class)); assertEquals(0, trx.pageKey(1, IndexType.DOCUMENT)); assertEquals(1023 / Constants.NDP_NODE_COUNT, trx.pageKey(1023, IndexType.DOCUMENT)); assertEquals(1024 / Constants.NDP_NODE_COUNT, trx.pageKey(1024, IndexType.DOCUMENT)); }