Examples of ReadWritableFile


Examples of org.entityfs.ReadWritableFile

  public void testFindAddressToNodeWhereKeyShouldGo()
  {
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      byte[] barr = writeJunk(f);
      LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
      BPlusTree<Long, Long> btr = new BPlusTree<Long, Long>(new FileBackedNodeRepository<Long, Long>(f, false, f.getSize(), new NumberOfRecordsNodeSizeStrategy(2), false, LongNullSerializer.INSTANCE, LongSerializer.INSTANCE, 8, 8192, null, lah), lah);
      try
      {
        // A list with an odd size
        List<KeyAndValue<Long, Long>> records = new ArrayList<KeyAndValue<Long, Long>>(5);
        records.add(new KeyAndValue<Long, Long>(Long.valueOf(1L), Long.valueOf(3L)));
View Full Code Here

Examples of org.entityfs.ReadWritableFile

  public void testFindRecord()
  {
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      byte[] barr = writeJunk(f);
      LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
      BPlusTree<Long, Long> btr = new BPlusTree<Long, Long>(new FileBackedNodeRepository<Long, Long>(f, false, f.getSize(), new NumberOfRecordsNodeSizeStrategy(2), false, LongNullSerializer.INSTANCE, LongSerializer.INSTANCE, 8, 8192, null, lah), lah);
      try
      {
        // A list with an odd size
        List<KeyAndValue<Long, Long>> records = new ArrayList<KeyAndValue<Long, Long>>(5);
        records.add(new KeyAndValue<Long, Long>(Long.valueOf(1L), Long.valueOf(3L)));
View Full Code Here

Examples of org.entityfs.ReadWritableFile

  {
    LongConverter lconv = new LongConverter();
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      byte[] barr = writeJunk(f);
      LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
      BPlusTree<Long, Long> btr = new BPlusTree<Long, Long>(new FileBackedNodeRepository<Long, Long>(f, false, f.getSize(), new NumberOfRecordsNodeSizeStrategy(2), false, LongNullSerializer.INSTANCE, LongSerializer.INSTANCE, 8, 8192, null, lah), lah);
      try
      {
        assertNull(btr.getFirstRecord());
        assertNull(btr.getLastRecord());
View Full Code Here

Examples of org.entityfs.ReadWritableFile

  {
    LongConverter lconv = new LongConverter();
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      byte[] barr = writeJunk(f);
      LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
      BPlusTree<Long, Long> btr = new BPlusTree<Long, Long>(new FileBackedNodeRepository<Long, Long>(f, false, f.getSize(), new NumberOfRecordsNodeSizeStrategy(2), false, LongNullSerializer.INSTANCE, LongSerializer.INSTANCE, 8, 8192, null, lah), lah);
      try
      {
        KeyAndValue<Long, Long> r1 = createLRecord(lconv, lconv, 2, 2);
        btr.insert(r1.getKey(), r1.getValue());
View Full Code Here

Examples of org.entityfs.ReadWritableFile

  {
    LongConverter lconv = new LongConverter();
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      byte[] barr = writeJunk(f);
      LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
      BPlusTree<Long, Long> btr = new BPlusTree<Long, Long>(new FileBackedNodeRepository<Long, Long>(f, false, f.getSize(), new NumberOfRecordsNodeSizeStrategy(2), true, LongNullSerializer.INSTANCE, LongSerializer.INSTANCE, 8, 8192, null, lah), lah);
      try
      {
        assertNull(btr.getNextRecord(1L));
        assertNull(btr.getPreviousRecord(1L));
View Full Code Here

Examples of org.entityfs.ReadWritableFile

  private <K extends Comparable<K>, V> void testInsertFromOneToNineWithTwoRecordsPerNodeAndLruCacheInternal(Serializer<K> keySerializer, ValueConverter<K> kconv, Serializer<V> valueSerializer, ValueConverter<V> vconv, int cacheSize, int pointerSize, boolean leafNodePointers)
  {
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      byte[] barr = writeJunk(f);
      LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
      NodeRepository<K> nr = new FileBackedNodeRepository<K, V>(f, false, f.getSize(), new NumberOfRecordsNodeSizeStrategy(2), leafNodePointers, keySerializer, valueSerializer, pointerSize, 8192, null, lah);
      if (cacheSize > 0)
      {
        nr = new LruCacheNodeRepository<K, V>(nr, cacheSize);
      }
      testInsertFromOneToNineWithTwoRecordsPerNodeInternal(nr, kconv, vconv, getNonLeafNodeSize(keySerializer.getSerializedSize(), pointerSize, 2), getLeafNodeSize(keySerializer.getSerializedSize(), valueSerializer.getSerializedSize(), pointerSize, 2, leafNodePointers));
View Full Code Here

Examples of org.entityfs.ReadWritableFile

  private <K extends Comparable<K>, V> void testInsertFrom15ToOneWithTwoRecordsPerNodeAndLruCacheInternal(Serializer<K> keySerializer, ValueConverter<K> kconv, Serializer<V> valueSerializer, ValueConverter<V> vconv, int cacheSize, int pointerSize, boolean leafNodePointers)
  {
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      byte[] barr = writeJunk(f);
      NodeRepository<K> nr = new FileBackedNodeRepository<K, V>(f, false, f.getSize(), new NumberOfRecordsNodeSizeStrategy(2), leafNodePointers, keySerializer, valueSerializer, pointerSize, 8192, null, new LogAdapterHolder(new StdOutLogAdapter()));
      if (cacheSize > 0)
      {
        nr = new LruCacheNodeRepository<K, V>(nr, cacheSize);
      }
      testInsertFrom15ToOneWithTwoRecordsPerNodeInternal(nr, kconv, vconv, getNonLeafNodeSize(keySerializer.getSerializedSize(), pointerSize, 2), getLeafNodeSize(keySerializer.getSerializedSize(), valueSerializer.getSerializedSize(), pointerSize, 2, leafNodePointers));
View Full Code Here

Examples of org.entityfs.ReadWritableFile

  private <K extends Comparable<K>, V> void testInsertFromOneToTenInRandomOrderWithTwoRecordsPerNodeInternal(Serializer<K> keySerializer, ValueConverter<K> kconv, Serializer<V> valueSerializer, ValueConverter<V> vconv, int cacheSize, int pointerSize, boolean leafNodePointers)
  {
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      byte[] barr = writeJunk(f);
      NodeRepository<K> nr = new FileBackedNodeRepository<K, V>(f, false, f.getSize(), new NumberOfRecordsNodeSizeStrategy(2), leafNodePointers, keySerializer, valueSerializer, pointerSize, 8192, null, new LogAdapterHolder(new StdOutLogAdapter()));
      if (cacheSize > 0)
      {
        nr = new LruCacheNodeRepository<K, V>(nr, cacheSize);
      }
      testInsertFromOneToTenInRandomOrderWithTwoRecordsPerNodeInternal(nr, kconv, vconv, getNonLeafNodeSize(keySerializer.getSerializedSize(), pointerSize, 2), getLeafNodeSize(keySerializer.getSerializedSize(), valueSerializer.getSerializedSize(), pointerSize, 2, leafNodePointers));
View Full Code Here

Examples of org.entityfs.ReadWritableFile

  private <K extends Comparable<K>, V> void testInsertWithThreeRecordsPerNodeInternal(Serializer<K> keySerializer, ValueConverter<K> kconv, Serializer<V> valueSerializer, ValueConverter<V> vconv, int cacheSize, int pointerSize, boolean leafNodePointers)
  {
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      byte[] barr = writeJunk(f);
      NodeRepository<K> nr = new FileBackedNodeRepository<K, V>(f, false, f.getSize(), new NumberOfRecordsNodeSizeStrategy(3), leafNodePointers, keySerializer, valueSerializer, pointerSize, 8192, null, new LogAdapterHolder(new StdOutLogAdapter()));
      if (cacheSize > 0)
      {
        nr = new LruCacheNodeRepository<K, V>(nr, cacheSize);
      }
      testInsertWithTreeRecordsPerNodeInternal(nr, kconv, vconv, getNonLeafNodeSize(keySerializer.getSerializedSize(), pointerSize, 3), getLeafNodeSize(keySerializer.getSerializedSize(), valueSerializer.getSerializedSize(), pointerSize, 3, leafNodePointers));
View Full Code Here

Examples of org.entityfs.ReadWritableFile

  public void testInsertWithFourRecordsPerNodeAndASlightlyTooBigNodeSize()
  {
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      byte[] barr = writeJunk(f);
      int nodeSize = new NumberOfRecordsNodeSizeStrategy(4).getNodeSize(9, 2 * LongSerializer.DATA_SIZE, 0) + 3;
      NodeRepository<Long> nr = new FileBackedNodeRepository<Long, Long>(f, false, f.getSize(), new FixedSizeNodeSizeStrategy(nodeSize), false, LongNullSerializer.INSTANCE, LongSerializer.INSTANCE, 8, 8192, null, new LogAdapterHolder(new StdOutLogAdapter()));
      testInsertWithFourRecordsPerNodeInternal(nr, new NodePositions(nodeSize, nodeSize, nr.getPositionOfRootNode()), LONG_CONVERTER, LONG_CONVERTER);
      assertJunkUntouched(f, barr);
    }
    finally
    {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.