Package org.entityfs.util.io

Examples of org.entityfs.util.io.ReadWritableFileAdapter


    m_dbFiles = new HashMap<Integer, File[]>(noOfDatabases);
    for (int i = 0; i < noOfDatabases; i++)
    {
      File f = FileSupport.createTempFile();
      File logf = FileSupport.createTempFile();
      NodeRepository<Integer> nr = new FileBackedNodeRepository<Integer, Long>(new ReadWritableFileAdapter(f), false, 0, new FixedSizeNodeSizeStrategy(m_nodeSize), true, IntegerNullSerializer.INSTANCE, LongSerializer.INSTANCE, 5, 8192, null, lah);
      if (m_lruCacheSize > 0)
      {
        nr = new LruCacheNodeRepository<Integer, Long>(nr, m_lruCacheSize);
      }
      ConstantRecordSizeBPlusTreeBackend<Integer, Long> b = new ConstantRecordSizeBPlusTreeBackend<Integer, Long>(nr, false, lah);
      LoggingTransactionalDatabase<Integer, Long, KeyAndValue<Integer, Long>> db = new LoggingTransactionalDatabase<Integer, Long, KeyAndValue<Integer, Long>>(b, new ReadWritableFileAdapter(logf), IntegerSerializer.INSTANCE, LongSerializer.INSTANCE, lah);
      m_dbFiles.put(System.identityHashCode(db), new File[] { f, logf });
      m_databases.add(db);
    }
  }
View Full Code Here


    m_databases = new ArrayList<SimpleDatabase<String, String, Long>>(noOfDatabases);
    m_dbFiles = new HashMap<Integer, File>(noOfDatabases);
    for (int i = 0; i < noOfDatabases; i++)
    {
      File f = FileSupport.createTempFile();
      HeapBackend<String, String> b = new HeapBackend<String, String>(new ReadWritableFileAdapter(f), false, StringSerializer.INSTANCE, StringSerializer.INSTANCE, 0, 8192, lah);
      SimpleDatabase<String, String, Long> db = new SimpleDatabase<String, String, Long>(b, lah);
      m_dbFiles.put(System.identityHashCode(db), f);
      m_databases.add(db);
    }
  }
View Full Code Here

        b2.insert(34823, 348234823L);

        File f = FileSupport.createTempFile();
        try
        {
          RandomAccess ra = new ReadWritableFileAdapter(f).openForRandomAccess(RandomAccessMode.READ_WRITE);
          try
          {
            long dataSize = b1.writeContentsTo(ra);
            ra.seek(0);
            int contentsVersion = b2.getContentsVersion();
View Full Code Here

  {
    File dbFile = FileSupport.createTempFile();
    File indexFile = FileSupport.createTempFile();
    LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
    // Set a ridiculously low buffer size
    HeapBackend<String, String> hb = new HeapBackend<String, String>(new ReadWritableFileAdapter(dbFile), false, StringSerializer.INSTANCE, StringSerializer.INSTANCE, 0L, 4, lah);
    BPlusTreeIndexBackend<String, String, Long, Long> res = new BPlusTreeIndexBackend<String, String, Long, Long>(hb, false, new BPlusTree<Long, Long>(new FileBackedNodeRepository<Long, Long>(new ReadWritableFileAdapter(indexFile), false, 0, new NumberOfRecordsNodeSizeStrategy(5), true, LongNullSerializer.INSTANCE, LongSerializer.INSTANCE, 6, 8192, null, lah), lah), new StringToLongHasher(), lah);
    m_dbFiles.put(res, dbFile);
    m_indexFiles.put(res, indexFile);
    return res;
  }
View Full Code Here

  protected BPlusTreeIndexBackend<Integer, Long, Integer, Long> createBackend()
  {
    File dbFile = FileSupport.createTempFile();
    File indexFile = FileSupport.createTempFile();
    LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
    DatabaseBackend<Integer, Long, Long> db = new ConstantRecordSizeHeapBackend<Integer, Long>(new ReadWritableFileAdapter(dbFile), false, IntegerSerializer.INSTANCE, LongSerializer.INSTANCE, 0L, 8192, lah);
    BPlusTreeIndexBackend<Integer, Long, Integer, Long> res = new BPlusTreeIndexBackend<Integer, Long, Integer, Long>(db, false, new BPlusTree<Integer, Long>(new FileBackedNodeRepository<Integer, Long>(new ReadWritableFileAdapter(indexFile), false, 0, new NumberOfRecordsNodeSizeStrategy(5), true, IntegerNullSerializer.INSTANCE, LongSerializer.INSTANCE, 6, 8192, null, lah), lah), IntegerToIntegerHasher.INSTANCE, lah);
    m_dbFiles.put(res, dbFile);
    m_indexFiles.put(res, indexFile);
    return res;
  }
View Full Code Here

  protected BPlusTreeIndexBackend<Character, Character, Character, Long> createCharacterBackend()
  {
    File dbFile = FileSupport.createTempFile();
    File indexFile = FileSupport.createTempFile();
    LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
    DatabaseBackend<Character, Character, Long> db = new ConstantRecordSizeHeapBackend<Character, Character>(new ReadWritableFileAdapter(dbFile), false, CharacterSerializer.INSTANCE, CharacterSerializer.INSTANCE, 0L, 8192, lah);
    BPlusTreeIndexBackend<Character, Character, Character, Long> res = new BPlusTreeIndexBackend<Character, Character, Character, Long>(db, false, new BPlusTree<Character, Long>(new FileBackedNodeRepository<Character, Long>(new ReadWritableFileAdapter(indexFile), false, 0, new NumberOfRecordsNodeSizeStrategy(5), true, CharacterNullSerializer.INSTANCE, LongSerializer.INSTANCE, 6, 8192, null, lah), lah), CharacterToCharacterHasher.INSTANCE, lah);
    m_dbFiles.put(res, dbFile);
    m_indexFiles.put(res, indexFile);
    return res;
  }
View Full Code Here

  @Override
  protected LruCacheBackend<Integer, Long, Long> createBackend()
  {
    File dbFile = FileSupport.createTempFile();
    File indexFile = FileSupport.createTempFile();
    DatabaseBackend<Integer, Long, Long> db = new ConstantRecordSizeHeapBackend<Integer, Long>(new ReadWritableFileAdapter(dbFile), false, IntegerSerializer.INSTANCE, LongSerializer.INSTANCE, 0L, 8192, new LogAdapterHolder(new StdOutLogAdapter()));
    LruCacheBackend<Integer, Long, Long> res = new LruCacheBackend<Integer, Long, Long>(db, false, 5, 3);
    m_dbFiles.put(res, dbFile);
    m_indexFiles.put(res, indexFile);
    return res;
  }
View Full Code Here

  @Override
  protected LruCacheBackend<Character, Character, Long> createCharacterBackend()
  {
    File dbFile = FileSupport.createTempFile();
    File indexFile = FileSupport.createTempFile();
    DatabaseBackend<Character, Character, Long> db = new ConstantRecordSizeHeapBackend<Character, Character>(new ReadWritableFileAdapter(dbFile), false, CharacterSerializer.INSTANCE, CharacterSerializer.INSTANCE, 0L, 8192, new LogAdapterHolder(new StdOutLogAdapter()));
    LruCacheBackend<Character, Character, Long> res = new LruCacheBackend<Character, Character, Long>(db, false, 5, 3);
    m_dbFiles.put(res, dbFile);
    m_indexFiles.put(res, indexFile);
    return res;
  }
View Full Code Here

  @Override
  protected LruCacheBackend<String, String, Long> createBackend()
  {
    File dbFile = FileSupport.createTempFile();
    File indexFile = FileSupport.createTempFile();
    HeapBackend<String, String> hb = new HeapBackend<String, String>(new ReadWritableFileAdapter(dbFile), false, StringSerializer.INSTANCE, StringSerializer.INSTANCE, 0L, 4, new LogAdapterHolder(new StdOutLogAdapter()));
    LruCacheBackend<String, String, Long> res = new LruCacheBackend<String, String, Long>(hb, false, 5, 3);
    m_dbFiles.put(res, dbFile);
    m_indexFiles.put(res, indexFile);
    return res;
  }
View Full Code Here

TOP

Related Classes of org.entityfs.util.io.ReadWritableFileAdapter

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.