public void testMaxCapacity() throws Exception {
    StoreConfig config = new StoreConfig(getHomeDir(), Integer.MAX_VALUE);
    config.setIndexesCached(false); // Do not cache indexes in memory

    StaticDataStore store = StoreFactory.createStaticDataStore(config);

    // Check store capacity
    assertEquals(Integer.MAX_VALUE, store.capacity());
    assertEquals(Integer.MAX_VALUE, store.getDataArray().length());

    store.close();
  }
Пример #2
0
  /**
   * Creates a {@link krati.store.ArrayStorePartition ArrayStorePartition} with the default
   * parameters below.
   *
   * <pre>
   *   batchSize            : 10000
   *   numSyncBatches       : 5
   *   segmentCompactFactor : 0.5
   * </pre>
   *
   * @param homeDir - the store home directory
   * @param idStart - the partition idStart (i.e. the first index)
   * @param idCount - the partition idCount (i.e. capacity) which cannot be changed after the store
   *     is created
   * @param segmentFileSizeMB - the segment size in MB
   * @param segmentFactory - the segment factory
   * @return A range-based ArrayStore.
   * @throws Exception if the store cannot be created.
   */
  public static ArrayStorePartition createArrayStorePartition(
      File homeDir, int idStart, int idCount, int segmentFileSizeMB, SegmentFactory segmentFactory)
      throws Exception {
    int batchSize = StoreParams.BATCH_SIZE_DEFAULT;
    int numSyncBatches = StoreParams.NUM_SYNC_BATCHES_DEFAULT;
    double segmentCompactFactor = StoreParams.SEGMENT_COMPACT_FACTOR_DEFAULT;

    return StoreFactory.createArrayStorePartition(
        homeDir,
        idStart,
        idCount,
        batchSize,
        numSyncBatches,
        segmentFileSizeMB,
        segmentFactory,
        segmentCompactFactor);
  }