Пример #1
0
 @Override
 public void accept(List<String> keys, ReadOnlyStringVisitor visitor) {
   errorHandler.wrapVoidCall(
       delegate.accept_bulk(
           stringListTo2DByteArray(keys),
           new ReadOnlyStringVisitorAdapter(visitor, this),
           AccessType.READ_ONLY.value()));
 }
Пример #2
0
 @Override
 public void accept(String key, WritableStringVisitor visitor) {
   errorHandler.wrapVoidCall(
       delegate.accept(
           stringToByteArray(key),
           new WritableStringVisitorAdapter(visitor, this),
           AccessType.READ_WRITE.value()));
 }
Пример #3
0
 @Override
 public void accept(String key, ReadOnlyStringVisitor visitor) {
   errorHandler.wrapVoidCall(
       delegate.accept(
           stringToByteArray(key),
           new ReadOnlyStringVisitorAdapter(visitor, this),
           AccessType.READ_ONLY.value()));
 }
Пример #4
0
 @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;
 }
Пример #5
0
 @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;
 }
Пример #6
0
 @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));
 }
Пример #7
0
 @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);
 }
Пример #8
0
 @Override
 public void set(byte[] key, byte[] value) {
   errorHandler.wrapVoidCall(delegate.set(key, value));
 }
Пример #9
0
 @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));
 }