org.neo4j.kernel.impl.store.NodeStore.getRecordByCursor()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(63)

本文整理了Java中org.neo4j.kernel.impl.store.NodeStore.getRecordByCursor()方法的一些代码示例,展示了NodeStore.getRecordByCursor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NodeStore.getRecordByCursor()方法的具体详情如下:
包路径:org.neo4j.kernel.impl.store.NodeStore
类名称:NodeStore
方法名:getRecordByCursor

NodeStore.getRecordByCursor介绍

暂无

代码示例

代码示例来源:origin: neo4j/neo4j

private void node( NodeRecord record, long reference, PageCursor pageCursor )
{
  read.getRecordByCursor( reference, record, RecordLoad.CHECK, pageCursor );
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldBeAbleToForceStoreScan() throws Exception
{
  when( labelScanStore.newReader() ).thenThrow( new RuntimeException( "Should not be used" ) );
  when( nodeStore.getHighestPossibleIdInUse() ).thenReturn( 200L );
  when( nodeStore.getHighId() ).thenReturn( 20L );
  when( nodeStore.openPageCursorForReading( anyLong() ) ).thenReturn( mock( PageCursor.class ) );
  mockLabelNodeCount( countStore, 2 );
  mockLabelNodeCount( countStore, 6 );
  DynamicIndexStoreView storeView = dynamicIndexStoreView();
  StoreScan<Exception> storeScan = storeView
      .visitNodes( new int[]{2, 6}, propertyKeyIdFilter, propertyUpdateVisitor, labelUpdateVisitor, true );
  storeScan.run();
  Mockito.verify( nodeStore, times( 1 ) )
      .getRecordByCursor( anyLong(), any( NodeRecord.class ), any( RecordLoad.class ), any( PageCursor.class ) );
  Mockito.verify( nodeStore, times( 200 ) )
      .nextRecordByCursor( any( NodeRecord.class ), any( RecordLoad.class ), any( PageCursor.class ) );
}

代码示例来源:origin: neo4j/neo4j

@Before
public void setUp()
{
  NodeRecord nodeRecord = getNodeRecord();
  when( labelScanStore.allNodeLabelRanges()).thenReturn( nodeLabelRanges );
  when( neoStores.getCounts() ).thenReturn( countStore );
  when( neoStores.getNodeStore() ).thenReturn( nodeStore );
  when( nodeStore.newRecord() ).thenReturn( nodeRecord );
  doAnswer( invocation ->
  {
    NodeRecord record = invocation.getArgument( 1 );
    record.initialize( true, 1L, false, 1L, 0L );
    record.setId( invocation.getArgument( 0 ) );
    return null;
  } ).when( nodeStore ).getRecordByCursor( anyLong(), any( NodeRecord.class ), any( RecordLoad.class ), any( PageCursor.class ) );
  doAnswer( invocation ->
  {
    NodeRecord record = invocation.getArgument( 0 );
    record.initialize( true, 1L, false, 1L, 0L );
    record.setId( record.getId() + 1 );
    return null;
  } ).when( nodeStore ).nextRecordByCursor( any( NodeRecord.class ), any( RecordLoad.class ), any( PageCursor.class ) );
}

代码示例来源:origin: neo4j/neo4j

@Test
public void visitOnlyLabeledNodes() throws Exception
{
  LabelScanReader labelScanReader = mock( LabelScanReader.class );
  when( labelScanStore.newReader() ).thenReturn( labelScanReader );
  when( nodeLabelRanges.maxCount() ).thenReturn( 1L );
  PrimitiveLongResourceIterator labeledNodesIterator = PrimitiveLongResourceCollections.iterator( null, 1, 2, 3, 4, 5, 6, 7, 8 );
  when( nodeStore.getHighestPossibleIdInUse() ).thenReturn( 200L );
  when( nodeStore.getHighId() ).thenReturn( 20L );
  when( labelScanReader.nodesWithAnyOfLabels( new int[] {2, 6} ) ).thenReturn( labeledNodesIterator );
  when( nodeStore.openPageCursorForReading( anyLong() ) ).thenReturn( mock( PageCursor.class ) );
  mockLabelNodeCount( countStore, 2 );
  mockLabelNodeCount( countStore, 6 );
  DynamicIndexStoreView storeView = dynamicIndexStoreView();
  StoreScan<Exception> storeScan = storeView
      .visitNodes( new int[]{2, 6}, propertyKeyIdFilter, propertyUpdateVisitor, labelUpdateVisitor, false );
  storeScan.run();
  Mockito.verify( nodeStore, times( 8 ) )
      .getRecordByCursor( anyLong(), any( NodeRecord.class ), any( RecordLoad.class ), any( PageCursor.class ) );
}

代码示例来源:origin: neo4j/neo4j

@Override
protected void process( RelationshipGroupRecord[] batch, BatchSender sender )
{
  for ( RelationshipGroupRecord group : batch )
  {
    if ( !group.inUse() )
    {
      continue;
    }
    long nodeId = group.getOwningNode();
    if ( cache.getByte( nodeId, 0 ) == 0 )
    {
      cache.setByte( nodeId, 0, (byte) 1 );
      NodeRecord nodeRecord = nodeStore.newRecord();
      nodeStore.getRecordByCursor( nodeId, nodeRecord, NORMAL, nodeCursor );
      nodeRecord.setNextRel( group.getId() );
      nodeRecord.setDense( true );
      current[cursor++] = nodeRecord;
      if ( cursor == batchSize )
      {
        sender.send( current );
        newBatch();
      }
    }
  }
  control.recycle( batch );
}

代码示例来源:origin: neo4j/neo4j

nodeStore.getRecordByCursor( duplicateNodeId, nodeRecord, NORMAL, cursor );
assert nodeRecord.inUse() : nodeRecord;

代码示例来源:origin: org.neo4j/neo4j-kernel

private void node( NodeRecord record, long reference, PageCursor pageCursor )
{
  read.getRecordByCursor( reference, record, RecordLoad.CHECK, pageCursor );
}

代码示例来源:origin: org.neo4j/neo4j-kernel

@Override
protected void process( RelationshipGroupRecord[] batch, BatchSender sender )
{
  for ( RelationshipGroupRecord group : batch )
  {
    if ( !group.inUse() )
    {
      continue;
    }
    long nodeId = group.getOwningNode();
    if ( cache.getByte( nodeId, 0 ) == 0 )
    {
      cache.setByte( nodeId, 0, (byte) 1 );
      NodeRecord nodeRecord = nodeStore.newRecord();
      nodeStore.getRecordByCursor( nodeId, nodeRecord, NORMAL, nodeCursor );
      nodeRecord.setNextRel( group.getId() );
      nodeRecord.setDense( true );
      current[cursor++] = nodeRecord;
      if ( cursor == batchSize )
      {
        sender.send( current );
        newBatch();
      }
    }
  }
  control.recycle( batch );
}

代码示例来源:origin: org.neo4j/neo4j-kernel

nodeStore.getRecordByCursor( duplicateNodeId, nodeRecord, NORMAL, cursor );
assert nodeRecord.inUse() : nodeRecord;

相关文章