Package org.entityfs.util.io

Examples of org.entityfs.util.io.ReadWritableFileAdapter


  @Override
  protected ConstantRecordSizeBPlusTreeBackend<Integer, Long> createBackend()
  {
    File dbFile = FileSupport.createTempFile();
    LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
    ConstantRecordSizeBPlusTreeBackend<Integer, Long> res = new ConstantRecordSizeBPlusTreeBackend<Integer, Long>(new LruCacheNodeRepository<Integer, Long>(new FileBackedNodeRepository<Integer, Long>(new ReadWritableFileAdapter(dbFile), false, 0, new NumberOfRecordsNodeSizeStrategy(2), true, IntegerNullSerializer.INSTANCE, LongSerializer.INSTANCE, 4, 8192, null, lah), 10), false, lah);
    m_dbFiles.put(res, dbFile);
    return res;
  }
View Full Code Here


  @Override
  protected ConstantRecordSizeBPlusTreeBackend<Character, Character> createCharacterBackend()
  {
    File dbFile = FileSupport.createTempFile();
    LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
    ConstantRecordSizeBPlusTreeBackend<Character, Character> res = new ConstantRecordSizeBPlusTreeBackend<Character, Character>(new LruCacheNodeRepository<Character, Character>(new FileBackedNodeRepository<Character, Character>(new ReadWritableFileAdapter(dbFile), false, 0, new NumberOfRecordsNodeSizeStrategy(2), true, CharacterNullSerializer.INSTANCE, CharacterSerializer.INSTANCE, 4, 8192, null, lah), 10), false, lah);
    m_dbFiles.put(res, dbFile);
    return res;
  }
View Full Code Here

    File f = FileSupport.createTempFile();
    FileBackedNodeRepository<Integer, Long> fbnr = null;
    try
    {
      LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
      fbnr = new FileBackedNodeRepository<Integer, Long>(new ReadWritableFileAdapter(f), false, 0, new NumberOfRecordsNodeSizeStrategy(2), false, IntegerNullSerializer.INSTANCE, LongSerializer.INSTANCE, 4, 8192, null, lah);
      new ConstantRecordSizeBPlusTreeBackend<Integer, Long>(fbnr, false, lah).close();
      fail();
    }
    catch (IllegalArgumentException e)
    {
View Full Code Here

    File f1l = FileSupport.createTempFile();
    File f2 = FileSupport.createTempFile();
    File f2l = FileSupport.createTempFile();
    try
    {
      LoggingTransactionalDatabase<String, String, Long> db1 = new LoggingTransactionalDatabase<String, String, Long>(new HeapBackend<String, String>(new ReadWritableFileAdapter(f1), false, StringSerializer.INSTANCE, StringSerializer.INSTANCE, lah), new ReadWritableFileAdapter(f1l), StringSerializer.INSTANCE, StringSerializer.INSTANCE, lah);
      try
      {
        LoggingTransactionalDatabase<String, String, Long> db2 = new LoggingTransactionalDatabase<String, String, Long>(new HeapBackend<String, String>(new ReadWritableFileAdapter(f2), false, StringSerializer.INSTANCE, StringSerializer.INSTANCE, lah), new ReadWritableFileAdapter(f2l), StringSerializer.INSTANCE, StringSerializer.INSTANCE, lah);
        try
        {
          Transaction txn = Transaction.startTransaction(false);
          db2.insert("years", "2007");
          txn.commit();
View Full Code Here

    Database<Integer, String> db = null;
    File f = FileSupport.createTempFile();
    File indf = FileSupport.createTempFile();
    try
    {
      NodeRepository<Integer> nr = new FileBackedNodeRepositoryBuilder<Integer, Long>().setNodeSizeStrategy(new FixedSizeNodeSizeStrategy(4096)).setKeySerializer(IntegerNullSerializer.INSTANCE).setValueSerializer(LongSerializer.INSTANCE).setInternalPointerSize(1).setLogAdapterHolder(lah).create(new ReadWritableFileAdapter(indf), false);

      BPlusTree<Integer, Long> bt = new BPlusTree<Integer, Long>(nr, lah);

      DatabaseBackend<Integer, String, Long> hb = new HeapBackendBuilder<Integer, String>().setKeySerializer(IntegerSerializer.INSTANCE).setLogAdapterHolder(lah).setValueSerializer(StringSerializer.INSTANCE).create(new ReadWritableFileAdapter(f));

      DatabaseBackend<Integer, String, Long> b = new BPlusTreeIndexBackendBuilder<Integer, Integer>().setKeyHasher(IntegerToIntegerHasher.INSTANCE).setLogAdapterHolder(lah).create(hb, bt);
      db = new SimpleDatabase<Integer, String, Long>(b, lah);

      db.insert(10, "Roger");
View Full Code Here

  @Override
  protected HeapBackend<String, String> createBackend()
  {
    File dbFile = FileSupport.createTempFile();
    // Set a ridiculously low buffer size
    HeapBackend<String, String> res = new HeapBackend<String, String>(new ReadWritableFileAdapter(dbFile), false, StringSerializer.INSTANCE, StringSerializer.INSTANCE, 0L, 4, new LogAdapterHolder(new StdOutLogAdapter()));
    m_dbFiles.put(res, dbFile);
    return res;
  }
View Full Code Here

        b2.insert("b2 key 2", "b2 value 2");

        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

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

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

    m_databases = new ArrayList<ShadowCopyTransactionalDatabase<Integer, Long, Long>>(noOfDatabases);
    m_dbFiles = new HashMap<Integer, File[]>(noOfDatabases);
    for (int i = 0; i < noOfDatabases; i++)
    {
      File f = FileSupport.createTempFile();
      ReadWritableFile ff = new ReadWritableFileAdapter(f);
      File indf = FileSupport.createTempFile();
      ReadWritableFile indff = new ReadWritableFileAdapter(indf);
      File tmpDir = FileSupport.createTempDirectory();
      Directory tmpDirD = new FSRWFileSystemBuilder().setRoot(tmpDir).create().getRootDirectory();

      NodeRepositoryBuilder<Integer> nrb = new FileBackedNodeRepositoryBuilder<Integer, Long>().setNodeSizeStrategy(new FixedSizeNodeSizeStrategy(m_bTreeNodeSize)).setKeySerializer(IntegerNullSerializer.INSTANCE).setValueSerializer(LongSerializer.INSTANCE);
      if (m_bTreeLruNodeCacheSize > 0)
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.