Package org.entityfs.util.io

Examples of org.entityfs.util.io.ReadWritableFileAdapter


  @Override
  protected SimpleDatabase<Character, Character, Long> createCharacterDatabase()
  {
    File f = FileSupport.createTempFile();
    LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
    DatabaseBackend<Character, Character, Long> b = new ConstantRecordSizeHeapBackend<Character, Character>(new ReadWritableFileAdapter(f), false, CharacterSerializer.INSTANCE, CharacterSerializer.INSTANCE, 0L, 8192, lah);
    SimpleDatabase<Character, Character, Long> res = new SimpleDatabase<Character, Character, Long>(b, lah);
    m_dbFiles.put(System.identityHashCode(res), f);
    return res;
  }
View Full Code Here


  @Override
  protected SimpleDatabase<String, String, Long> createDatabase()
  {
    File f = FileSupport.createTempFile();
    LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
    DatabaseBackend<String, String, Long> b = new HeapBackend<String, String>(new ReadWritableFileAdapter(f), false, StringSerializer.INSTANCE, StringSerializer.INSTANCE, lah);
    SimpleDatabase<String, String, Long> res = new SimpleDatabase<String, String, Long>(b, lah);
    m_dbFiles.put(System.identityHashCode(res), f);
    return res;
  }
View Full Code Here

  protected SimpleDatabase<String, String, Long> createDatabase()
  {
    File f = FileSupport.createTempFile();
    File indf = FileSupport.createTempFile();
    LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
    BPlusTree<Long, Long> btr = new BPlusTree<Long, Long>(new LruCacheNodeRepository<Long, Long>(new FileBackedNodeRepository<Long, Long>(new ReadWritableFileAdapter(indf), false, 0, new NumberOfRecordsNodeSizeStrategy(3), true, LongNullSerializer.INSTANCE, LongSerializer.INSTANCE, 4, 8192, null, lah), 10), lah);
    DatabaseBackend<String, String, Long> b = new BPlusTreeIndexBackend<String, String, Long, Long>(new HeapBackend<String, String>(new ReadWritableFileAdapter(f), false, StringSerializer.INSTANCE, StringSerializer.INSTANCE, lah), false, btr, new StringToLongHasher(), lah);
    SimpleDatabase<String, String, Long> res = new SimpleDatabase<String, String, Long>(b, lah);
    m_dbFiles.put(System.identityHashCode(res), new File[] { f, indf });
    return res;
  }
View Full Code Here

  public void testDelete()
  {
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
      FileBackedNodeRepository<Long, Long> nr = new FileBackedNodeRepository<Long, Long>(f, false, 0, new NumberOfRecordsNodeSizeStrategy(2), false, LongNullSerializer.INSTANCE, LongSerializer.INSTANCE, 8, 8192, null, lah);
      BPlusTree<Long, Long> mgr = new BPlusTree<Long, Long>(nr, lah);
      try
      {
View Full Code Here

  public void testCompactWithDeletedLeafNode()
  {
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
      FileBackedNodeRepository<Long, Integer> nr = new FileBackedNodeRepository<Long, Integer>(f, false, 0, new NumberOfRecordsNodeSizeStrategy(2), false, LongNullSerializer.INSTANCE, IntegerSerializer.INSTANCE, 8, 8192, null, lah);
      BPlusTree<Long, Integer> mgr = new BPlusTree<Long, Integer>(nr, lah);
      try
      {
View Full Code Here

  public void testCreateRepositoryOnNonEmptyFileWithDeletedNodes()
  {
    File tmpFile = FileSupport.createTempFile();
    try
    {
      ReadWritableFile f = new ReadWritableFileAdapter(tmpFile);
      LogAdapterHolder lah = new LogAdapterHolder(new StdOutLogAdapter());
      NodeSizeStrategy nss = new NumberOfRecordsNodeSizeStrategy(2);
      FileBackedNodeRepository<Long, Long> nr = new FileBackedNodeRepository<Long, Long>(f, false, 0, nss, false, LongNullSerializer.INSTANCE, LongSerializer.INSTANCE, 8, 8192, null, lah);
      BPlusTree<Long, Long> mgr = new BPlusTree<Long, Long>(nr, lah);
      try
View Full Code Here

    m_dbFiles = new HashMap<Integer, File[]>(noOfDatabases);
    for (int i = 0; i < noOfDatabases; i++)
    {
      File f = FileSupport.createTempFile();
      File treef = FileSupport.createTempFile();
      DatabaseBackend<String, String, Long> b = new HeapBackend<String, String>(new ReadWritableFileAdapter(f), false, StringSerializer.INSTANCE, StringSerializer.INSTANCE, 0, 8192, lah);

      // Maximum pointer needed: approx 1,000,000 * node size
      // approx: 1,000,000 * 20 = 20,000,000 < 4294967296 =
      // 2 ^ (4 * 8). i.e pointer size = 4 bytes
      NodeRepository<BigInteger> nr = new FileBackedNodeRepository<BigInteger, Long>(new ReadWritableFileAdapter(treef), false, 0, new FixedSizeNodeSizeStrategy(m_bTreeNodeSize), true, new FixedSizeBigIntegerNullSerializer(STRING_HASH_SIZE + 1), LongSerializer.INSTANCE, 4, 8192, null, lah);
      if (m_bTreeLruNodeCacheSize > 0)
      {
        nr = new LruCacheNodeRepository<BigInteger, Long>(nr, m_bTreeLruNodeCacheSize);
      }
      BPlusTree<BigInteger, Long> btree = new BPlusTree<BigInteger, Long>(nr, lah);
View Full Code Here

    for (int i = 0; i < noOfDatabases; i++)
    {
      File f = FileSupport.createTempFile();
      File treef = FileSupport.createTempFile();
      File logf = FileSupport.createTempFile();
      DatabaseBackend<Integer, Long, Long> b = new ConstantRecordSizeHeapBackend<Integer, Long>(new ReadWritableFileAdapter(f), false, IntegerSerializer.INSTANCE, LongSerializer.INSTANCE, 0, 8192, lah);

      // Maximum pointer needed: approx 1,000,000 * node size
      // approx: 1,000,000 * 20 = 20,000,000 < 4294967296 =
      // 2 ^ (4 * 8). i.e pointer size = 4 bytes
      NodeRepository<Integer> nr = new FileBackedNodeRepository<Integer, Long>(new ReadWritableFileAdapter(treef), false, 0, new FixedSizeNodeSizeStrategy(m_bTreeNodeSize), true, IntegerNullSerializer.INSTANCE, LongSerializer.INSTANCE, 4, 8192, null, lah);
      if (m_bTreeLruNodeCacheSize > 0)
      {
        nr = new LruCacheNodeRepository<Integer, Long>(nr, m_bTreeLruNodeCacheSize);
      }
      BPlusTree<Integer, Long> btree = new BPlusTree<Integer, Long>(nr, lah);
      b = new BPlusTreeIndexBackend<Integer, Long, Integer, Long>(b, false, btree, IntegerToIntegerHasher.INSTANCE, lah);

      LoggingTransactionalDatabase<Integer, Long, Long> db = new LoggingTransactionalDatabase<Integer, Long, Long>(b, new ReadWritableFileAdapter(logf), IntegerSerializer.INSTANCE, LongSerializer.INSTANCE, lah);
      m_dbFiles.put(System.identityHashCode(db), new File[] { f, treef, logf });
      m_databases.add(db);
    }
  }
View Full Code Here

    m_databases = new ArrayList<ShadowCopyTransactionalDatabase<String, String, 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<BigInteger> nrb = new FileBackedNodeRepositoryBuilder<BigInteger, Long>().setNodeSizeStrategy(new FixedSizeNodeSizeStrategy(m_bTreeNodeSize)).setKeySerializer(new FixedSizeBigIntegerNullSerializer(STRING_HASH_SIZE + 1)).setValueSerializer(LongSerializer.INSTANCE);
      if (m_bTreeLruNodeCacheSize > 0)
View Full Code Here

    m_dbFiles = new HashMap<Integer, File[]>(noOfDatabases);
    for (int i = 0; i < noOfDatabases; i++)
    {
      File f = FileSupport.createTempFile();
      File logf = FileSupport.createTempFile();
      HeapBackend<String, String> b = new HeapBackend<String, String>(new ReadWritableFileAdapter(f), false, StringSerializer.INSTANCE, StringSerializer.INSTANCE, 0, 8192, lah);
      LoggingTransactionalDatabase<String, String, Long> db = new LoggingTransactionalDatabase<String, String, Long>(b, new ReadWritableFileAdapter(logf), StringSerializer.INSTANCE, StringSerializer.INSTANCE, lah);
      m_dbFiles.put(System.identityHashCode(db), new File[] { f, logf });
      m_databases.add(db);
    }
  }
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.