Esempio n. 1
0
  @Inject
  public HeapStore(ShardId shardId, @IndexSettings Settings indexSettings) {
    super(shardId, indexSettings);

    this.bufferSize = componentSettings.getAsSize("buffer_size", new SizeValue(100, SizeUnit.KB));
    this.cacheSize = componentSettings.getAsSize("cache_size", new SizeValue(20, SizeUnit.MB));
    this.warmCache = componentSettings.getAsBoolean("warm_cache", true);

    this.directory = new HeapDirectory(bufferSize, cacheSize, warmCache);
    logger.debug(
        "Using [heap] Store with buffer_size[{}], cache_size[{}], warm_cache[{}]",
        new Object[] {directory.bufferSize(), directory.cacheSize(), warmCache});
  }
Esempio n. 2
0
  public HeapIndexInput(HeapDirectory dir, HeapRamFile file) throws IOException {
    this.bufferSize = dir.bufferSizeInBytes();
    this.file = file;

    length = file.length();
    if (length / dir.bufferSizeInBytes() >= Integer.MAX_VALUE) {
      throw new IOException("Too large RAMFile! " + length);
    }

    // make sure that we switch to the
    // first needed buffer lazily
    currentBufferIndex = -1;
    currentBuffer = null;
  }