@Override
 public void accept(List<String> keys, ReadOnlyStringVisitor visitor) {
   errorHandler.wrapVoidCall(
       delegate.accept_bulk(
           stringListTo2DByteArray(keys),
           new ReadOnlyStringVisitorAdapter(visitor, this),
           AccessType.READ_ONLY.value()));
 }
 @Override
 public void accept(String key, WritableStringVisitor visitor) {
   errorHandler.wrapVoidCall(
       delegate.accept(
           stringToByteArray(key),
           new WritableStringVisitorAdapter(visitor, this),
           AccessType.READ_WRITE.value()));
 }
 @Override
 public void accept(String key, ReadOnlyStringVisitor visitor) {
   errorHandler.wrapVoidCall(
       delegate.accept(
           stringToByteArray(key),
           new ReadOnlyStringVisitorAdapter(visitor, this),
           AccessType.READ_ONLY.value()));
 }
 @Override
 public synchronized void close() throws IOException {
   if (!open) {
     throw new IOException("Connection already closed: " + this);
   }
   errorHandler.wrapVoidIoCall(delegate.close(), "Could not close db: " + descriptor);
   open = false;
 }
 @Override
 public synchronized void open() throws IOException {
   if (open) {
     throw new IllegalStateException("Connection already open: " + this);
   }
   errorHandler.wrapVoidIoCall(
       delegate.open(descriptor, buildModeMask()), "Could not open database: " + descriptor);
   open = true;
 }
 @Override
 public void mergeWith(MergeType mergeType, KyotoDb... dbs) {
   DB[] internal = new DB[dbs.length];
   for (int index = 0; index < dbs.length; index++) {
     internal[index] = ((KyotoDbImpl) dbs[index]).getDelegate();
   }
   errorHandler.wrapVoidCall(
       delegate.merge(internal, mergeType.value()),
       "Could not merge DBs: " + Arrays.toString(dbs));
 }
 @Override
 public void synchronize(Synchronization synchronization, KyotoFileProcessor fileProcessor) {
   FileProcessor adapted = null;
   if (fileProcessor != null) {
     adapted = new FileProcessorAdapter(fileProcessor);
   }
   errorHandler.wrapVoidCall(
       delegate.synchronize(synchronization.value(), adapted),
       "Could not "
           + synchronization
           + " synchronize DB "
           + descriptor
           + " with "
           + fileProcessor);
 }
 @Override
 public void set(byte[] key, byte[] value) {
   errorHandler.wrapVoidCall(delegate.set(key, value));
 }
 @Override
 public long set(Map<String, String> keyValues, Atomicity atomicity) {
   return errorHandler.wrapLongCall(delegate.set_bulk(keyValues, atomicity.value()), -1);
 }
示例#10
0
 @Override
 public boolean replace(byte[] key, byte[] newValue) {
   return errorHandler.wrapBooleanCall(delegate.replace(key, newValue));
 }
示例#11
0
 @Override
 public boolean replace(String key, String newValue) {
   return errorHandler.wrapBooleanCall(delegate.replace(key, newValue));
 }
示例#12
0
 @Override
 public double increment(String key, double delta) {
   return errorHandler.wrapDoubleCall(delegate.increment_double(key, delta), Double.NaN);
 }
示例#13
0
 @Override
 public boolean remove(String key) {
   return errorHandler.wrapBooleanCall(delegate.remove(key));
 }
示例#14
0
 @Override
 public Map<String, String> status() {
   return errorHandler.wrapObjectCall(delegate.status());
 }
示例#15
0
 @Override
 public void iterate(ReadOnlyStringVisitor visitor) {
   errorHandler.wrapVoidCall(
       delegate.iterate(
           new ReadOnlyStringVisitorAdapter(visitor, this), AccessType.READ_ONLY.value()));
 }
示例#16
0
 @Override
 public List<String> matchKeysByRegex(String regex, long limit) {
   return errorHandler.wrapObjectCall(delegate.match_regex(regex, limit));
 }
示例#17
0
 @Override
 public List<String> matchKeysByRegex(String regex) {
   return errorHandler.wrapObjectCall(delegate.match_regex(regex, NO_LIMIT));
 }
示例#18
0
 @Override
 public List<String> matchKeysByPrefix(String prefix) {
   return errorHandler.wrapObjectCall(delegate.match_prefix(prefix, NO_LIMIT));
 }
示例#19
0
 @Override
 public void loadSnapshotFrom(File source) throws IOException {
   errorHandler.wrapVoidIoCall(
       delegate.load_snapshot(source.getAbsolutePath()),
       "Could not load snapshot from: " + source.getAbsolutePath());
 }
示例#20
0
 @Override
 public void iterate(WritableStringVisitor visitor) {
   errorHandler.wrapVoidCall(
       delegate.iterate(
           new WritableStringVisitorAdapter(visitor, this), AccessType.READ_WRITE.value()));
 }
示例#21
0
 @Override
 public void set(String key, String value) {
   errorHandler.wrapVoidCall(delegate.set(key, value));
 }
示例#22
0
 @Override
 public void setEncoding(String encoding) {
   errorHandler.wrapVoidCall(
       delegate.tune_encoding(encoding), "Could not set encoding: " + encoding);
   this.encoding = encoding;
 }
示例#23
0
 @Override
 public long sizeInBytes() {
   return errorHandler.wrapLongCall(delegate.size(), -1);
 }
示例#24
0
 @Override
 public long increment(String key, long delta) {
   return errorHandler.wrapLongCall(delegate.increment(key, delta), Long.MIN_VALUE);
 }
示例#25
0
 @Override
 public Map<String, String> get(List<String> keys, Atomicity atomicity) {
   return errorHandler.wrapObjectCall(delegate.get_bulk(keys, atomicity.value()));
 }
示例#26
0
 @Override
 public byte[][] get(byte[][] keys, Atomicity atomicity) {
   return errorHandler.wrapObjectCall(delegate.get_bulk(keys, atomicity.value()));
 }
示例#27
0
 @Override
 public void accept(byte[][] keys, ReadOnlyVisitor visitor) {
   errorHandler.wrapVoidCall(
       delegate.accept_bulk(
           keys, new ReadOnlyVisitorAdapter(visitor), AccessType.READ_ONLY.value()));
 }
示例#28
0
 @Override
 public String get(String key) {
   return errorHandler.wrapObjectCall(delegate.get(key));
 }
示例#29
0
 @Override
 public long remove(List<String> keys, Atomicity atomicity) {
   return errorHandler.wrapLongCall(delegate.remove_bulk(keys, atomicity.value()), -1);
 }
示例#30
0
 @Override
 public byte[] get(byte[] key) {
   return errorHandler.wrapObjectCall(delegate.get(key));
 }