Package net.sf.joafip.kvstore.record.entity

Examples of net.sf.joafip.kvstore.record.entity.DataRecordIdentifier


    assertFalse("must not be referenced", isReferenced(1));
    assertFalse("must not be referenced", isReferenced(2));
  }

  private void addLink(final long referencing, final long referenced) {
    final DataRecordIdentifier referencingDataRecordIdentifier = new DataRecordIdentifier(
        referencing);
    final DataRecordIdentifier referencedDataRecordIdentifier = new DataRecordIdentifier(
        referenced);
    linkManager.addLink(referencingDataRecordIdentifier,
        referencedDataRecordIdentifier);
  }
View Full Code Here


    linkManager.addLink(referencingDataRecordIdentifier,
        referencedDataRecordIdentifier);
  }

  private void removeLink(final long referencing, final long referenced) {
    final DataRecordIdentifier referencingDataRecordIdentifier = new DataRecordIdentifier(
        referencing);
    final DataRecordIdentifier referencedDataRecordIdentifier = new DataRecordIdentifier(
        referenced);
    linkManager.removeLink(referencingDataRecordIdentifier,
        referencedDataRecordIdentifier);
  }
View Full Code Here

        referencedDataRecordIdentifier);
  }

  private boolean isReferenced(final long identifier)
      throws GarbageException, ReferenceLinkGarbageException {
    final DataRecordIdentifier dataRecordIdentifier = new DataRecordIdentifier(
        identifier);
    return linkManager.isReferenced(dataRecordIdentifier);
  }
View Full Code Here

    while ((operation = reader.readLine()) != null) {// NOPMD
      lineNumber++;
      final String[] opElt = operation.split(";");
      final String instruction = opElt[0];
      if ("read".equals(instruction)) {
        final DataRecordIdentifier dataRecordIdentifier =
        /**/new DataRecordIdentifier(Integer.parseInt(opElt[1]));// NOPMD
        final byte[] opData;
        if (opElt.length < 3) {
          opData = null;
        } else {
          opData = dataFromString(opElt[2]);
        }
        final byte[] read = heapDataManager
            .readDataRecord(dataRecordIdentifier);
        if (opData == null) {
          assertNull(lineNumber + ": bad data read\n"
              + dataToString(read), read);
        } else {
          assertTrue(lineNumber + ": bad data read "
              + dataRecordIdentifier + "\n" + dataToString(read),
              Arrays// NOPMD
              .equals(opData, read));
        }
      } else if ("new".equals(instruction)) {
        final DataRecordIdentifier dataRecordIdentifier =
        /**/new DataRecordIdentifier(Integer.parseInt(opElt[1]));// NOPMD
        final DataRecordIdentifier newId = heapDataManager
            .getNewDataRecordIdentifier();
        assertEquals(lineNumber + ": bad id created",
            dataRecordIdentifier, newId);
      } else if ("write".equals(instruction)) {
        final DataRecordIdentifier dataRecordIdentifier =
        /**/new DataRecordIdentifier(Integer.parseInt(opElt[1]));// NOPMD
        final byte[] opData = dataFromString(opElt[2]);
        heapDataManager.writeDataRecord(dataRecordIdentifier, opData);
      } else if ("flush".equals(instruction)) {
        heapDataManager.flush();
        checkIntegrity();
View Full Code Here

    final List<DataRecordIdentifierRBTNode> list = toGarbageRecordManager
        .getToGarbage();

    for (DataRecordIdentifierRBTNode node : list) {
      final DataRecordIdentifier identifier = node.getElement();
      assertTrue("must exist for remove identifier=" + identifier,
          toGarbageRecordManager.removeToGarbage(identifier));
      set.add(identifier);
    }
    heapRecordableManager.save();
View Full Code Here

      outputStream.writeObject(key);
      outputStream.close();
      final byte[] keyData = byteArrayOutputStream.toByteArray();
      final DataRecordKey dataRecordKey = new DataRecordKey(this, keyData);
      dataRecordKey.setKey(key);
      return new DataRecordIdentifier(dataRecordKey);
    } catch (Exception exception) {
      throw new HeapException("creating key", exception);
    }
  }
View Full Code Here

    final List<DataRecordIdentifierRBTNode> list = garbageCandidateRecordManager
        .getCandidate();

    for (DataRecordIdentifierRBTNode node : list) {
      final DataRecordIdentifier identifier = node.getElement();
      assertTrue("must exist for remove identifier=" + identifier,
          garbageCandidateRecordManager.removeCandidate(identifier));
      set.add(identifier);
    }
    heapRecordableManager.save();
View Full Code Here

   * @throws ReferenceLinkGarbageException
   */
  private void checkNumberOfLink() throws GarbageException,
      ReferenceLinkGarbageException {
    for (int[] numberOfRefDef : numberOfReferencingList) {
      final DataRecordIdentifier referencedDataRecordIdentifier =
      /**/newDataRecordIdentifier(numberOfRefDef[0]);
      final int expectedNumberOfReferencing = numberOfRefDef[1];
      final ReferenceLink referenceLink = linkRecordManager
          .searchByReferenced(referencedDataRecordIdentifier);
      assertNotNull("reference link must exist for "
View Full Code Here

  public void testDuplicate() throws HeapException, HeapRecordableException,
      RBTException, GarbageException, ReferenceLinkGarbageException {
    storeHeaderSetup();
    addReferenceLink();
    final DataRecordIdentifier referencingDataRecordIdentifier =
    /**/newDataRecordIdentifier(referenceList[0][0]);
    final DataRecordIdentifier referencedDataRecordIdentifier =
    /**/newDataRecordIdentifier(referenceList[0][1]);

    appendOrUpdateReferenceLink(referencingDataRecordIdentifier,
        referencedDataRecordIdentifier);

 
View Full Code Here

  public void testAddRemoved() throws HeapException, HeapRecordableException,// NOPMD
      RBTException, GarbageException, ReferenceLinkGarbageException {
    storeHeaderSetup();
    addReferenceLink();
    final DataRecordIdentifier referencingDataRecordIdentifier =
    /**/newDataRecordIdentifier(referenceList[0][0]);
    final DataRecordIdentifier referencedDataRecordIdentifier =
    /**/newDataRecordIdentifier(referenceList[0][1]);
    linkManager.removeLink(referencingDataRecordIdentifier,
        referencedDataRecordIdentifier);
    linkManager.addLink(referencingDataRecordIdentifier,
        referencedDataRecordIdentifier);
 
View Full Code Here

TOP

Related Classes of net.sf.joafip.kvstore.record.entity.DataRecordIdentifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.