Java Code Examples for org.iq80.leveldb.Options#comparator()

The following examples show how to use org.iq80.leveldb.Options#comparator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WarpDB.java    From warp10-platform with Apache License 2.0 6 votes vote down vote up
public Options getOptions() {
  //
  // Clone the current options
  //
  
  Options opt = new Options();
  opt.blockRestartInterval(options.blockRestartInterval());
  opt.blockSize(options.blockSize());
  opt.cacheSize(options.cacheSize());
  opt.comparator(options.comparator());
  opt.compressionType(options.compressionType());
  opt.createIfMissing(options.createIfMissing());
  opt.errorIfExists(options.errorIfExists());
  opt.logger(options.logger());
  opt.maxOpenFiles(options.maxOpenFiles());
  opt.paranoidChecks(options.paranoidChecks());
  opt.verifyChecksums(options.verifyChecksums());
  opt.writeBufferSize(options.writeBufferSize());
  
  return opt;
}
 
Example 2
Source File: EzLevelDbTable.java    From ezdb with Apache License 2.0 6 votes vote down vote up
public EzLevelDbTable(File path, EzLevelDbFactory factory,
		Serde<H> hashKeySerde, Serde<R> rangeKeySerde, Serde<V> valueSerde,
		Comparator<byte[]> hashKeyComparator,
		Comparator<byte[]> rangeKeyComparator) {
	this.hashKeySerde = hashKeySerde;
	this.rangeKeySerde = rangeKeySerde;
	this.valueSerde = valueSerde;
	this.hashKeyComparator = hashKeyComparator;
	this.rangeKeyComparator = rangeKeyComparator;

	Options options = new Options();
	options.createIfMissing(true);
	options.comparator(new EzLevelDbComparator(hashKeyComparator,
			rangeKeyComparator));

	try {
		this.db = factory.open(path, options);
	} catch (IOException e) {
		throw new DbException(e);
	}
}