com.emc.mongoose.load.generator.StorageItemInput Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongoose-load-generator Show documentation
Show all versions of mongoose-load-generator Show documentation
Mongoose is a high-load storage performance testing tool
package com.emc.mongoose.load.generator;
import com.emc.mongoose.common.io.collection.BufferingInputBase;
import com.emc.mongoose.model.io.task.IoTask;
import com.emc.mongoose.model.item.DataItemFactory;
import com.emc.mongoose.model.item.Item;
import com.emc.mongoose.model.item.ItemFactory;
import com.emc.mongoose.model.storage.StorageDriver;
import java.io.IOException;
import java.util.List;
/**
Created by andrey on 02.12.16.
*/
public final class StorageItemInput
extends BufferingInputBase {
private final StorageDriver> storageDriver;
private final ItemFactory itemFactory;
private final String path;
private final String prefix;
private final int idRadix;
public StorageItemInput(
final StorageDriver> storageDriver, final int batchSize,
final ItemFactory itemFactory, final String path, final String prefix, final int idRadix
) {
super(batchSize);
this.storageDriver = storageDriver;
this.itemFactory = itemFactory;
this.path = path;
this.prefix = prefix;
this.idRadix = idRadix;
}
@Override
protected final int loadMoreItems(final I lastItem)
throws IOException {
final List
newItems = storageDriver.list(itemFactory, path, prefix, idRadix, lastItem, capacity);
for(final I item : newItems) {
items.add(item);
}
return items.size();
}
@Override
public final String toString() {
return (itemFactory instanceof DataItemFactory ? "Data" : "") +
"ItemsFromPath(" + path + ")";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy