@Override public boolean delete(final String zoneName) { try { return runWithRetries( new Callable<Boolean>() { @Override public Boolean call() { return dnsRpc.deleteZone(zoneName); } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelper.RetryHelperException ex) { throw DnsException.translateAndThrow(ex); } }
@Override public boolean deleteDefaultAcl(final String bucket, final Entity entity) { try { return runWithRetries( new Callable<Boolean>() { @Override public Boolean call() { return storageRpc.deleteDefaultAcl(bucket, entity.toPb()); } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException e) { throw StorageException.translateAndThrow(e); } }
@Override public boolean deleteAcl(final BlobId blob, final Entity entity) { try { return runWithRetries( new Callable<Boolean>() { @Override public Boolean call() { return storageRpc.deleteAcl( blob.getBucket(), blob.getName(), blob.getGeneration(), entity.toPb()); } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException e) { throw StorageException.translateAndThrow(e); } }
com.google.datastore.v1.RunQueryResponse runQuery( final com.google.datastore.v1.RunQueryRequest requestPb) { try { return RetryHelper.runWithRetries( new Callable<com.google.datastore.v1.RunQueryResponse>() { @Override public com.google.datastore.v1.RunQueryResponse call() throws DatastoreException { return datastoreRpc.runQuery(requestPb); } }, retrySettings, EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException e) { throw DatastoreException.translateAndThrow(e); } }
com.google.datastore.v1.LookupResponse lookup( final com.google.datastore.v1.LookupRequest requestPb) { try { return RetryHelper.runWithRetries( new Callable<com.google.datastore.v1.LookupResponse>() { @Override public com.google.datastore.v1.LookupResponse call() throws DatastoreException { return datastoreRpc.lookup(requestPb); } }, retrySettings, EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException e) { throw DatastoreException.translateAndThrow(e); } }
private com.google.datastore.v1.AllocateIdsResponse allocateIds( final com.google.datastore.v1.AllocateIdsRequest requestPb) { try { return RetryHelper.runWithRetries( new Callable<com.google.datastore.v1.AllocateIdsResponse>() { @Override public com.google.datastore.v1.AllocateIdsResponse call() throws DatastoreException { return datastoreRpc.allocateIds(requestPb); } }, retrySettings, EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException e) { throw DatastoreException.translateAndThrow(e); } }
com.google.datastore.v1.CommitResponse commit( final com.google.datastore.v1.CommitRequest requestPb) { try { return RetryHelper.runWithRetries( new Callable<com.google.datastore.v1.CommitResponse>() { @Override public com.google.datastore.v1.CommitResponse call() throws DatastoreException { return datastoreRpc.commit(requestPb); } }, retrySettings, EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException e) { throw DatastoreException.translateAndThrow(e); } }
void rollback(final com.google.datastore.v1.RollbackRequest requestPb) { try { RetryHelper.runWithRetries( new Callable<Void>() { @Override public Void call() throws DatastoreException { datastoreRpc.rollback(requestPb); return null; } }, retrySettings, EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException e) { throw DatastoreException.translateAndThrow(e); } } }
com.google.datastore.v1.BeginTransactionResponse beginTransaction( final com.google.datastore.v1.BeginTransactionRequest requestPb) { try { return RetryHelper.runWithRetries( new Callable<com.google.datastore.v1.BeginTransactionResponse>() { @Override public com.google.datastore.v1.BeginTransactionResponse call() throws DatastoreException { return datastoreRpc.beginTransaction(requestPb); } }, retrySettings, EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException e) { throw DatastoreException.translateAndThrow(e); } }
@Override public ServiceAccount getServiceAccount(final String projectId) { try { com.google.api.services.storage.model.ServiceAccount answer = runWithRetries( new Callable<com.google.api.services.storage.model.ServiceAccount>() { @Override public com.google.api.services.storage.model.ServiceAccount call() { return storageRpc.getServiceAccount(projectId); } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()); return answer == null ? null : ServiceAccount.fromPb(answer); } catch (RetryHelperException e) { throw StorageException.translateAndThrow(e); } }
@Override public <T> T runInTransaction(final TransactionCallable<T> callable) { final DatastoreImpl self = this; try { return RetryHelper.runWithRetries( new ReadWriteTransactionCallable<T>(self, callable, null), retrySettings, TRANSACTION_EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException e) { throw DatastoreException.translateAndThrow(e); } }
@Override public <T> T runInTransaction( final TransactionCallable<T> callable, TransactionOptions transactionOptions) { final DatastoreImpl self = this; try { return RetryHelper.runWithRetries( new ReadWriteTransactionCallable<T>(self, callable, transactionOptions), retrySettings, TRANSACTION_EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException e) { throw DatastoreException.translateAndThrow(e); } }
@Override public List<Translation> translate(final List<String> texts, final TranslateOption... options) { try { return Lists.transform( runWithRetries( new Callable<List<TranslationsResource>>() { @Override public List<TranslationsResource> call() { return translateRpc.translate(texts, optionMap(options)); } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()), Translation.FROM_PB_FUNCTION); } catch (RetryHelperException e) { throw TranslateException.translateAndThrow(e); } }
@Override public List<Boolean> testPermissions(final String projectId, final List<String> permissions) { try { return runWithRetries( new Callable<List<Boolean>>() { @Override public List<Boolean> call() { return resourceManagerRpc.testPermissions(projectId, permissions); } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException ex) { throw ResourceManagerException.translateAndThrow(ex); } }
@Override public boolean deleteNotification(final String bucket, final String notification) { try { return runWithRetries( new Callable<Boolean>() { @Override public Boolean call() { return ((StorageRpc) storage.getOptions().getRpc()) .deleteNotification(bucket, notification); } }, storage.getOptions().getRetrySettings(), EXCEPTION_HANDLER, storage.getOptions().getClock()); } catch (RetryHelperException e) { throw StorageException.translateAndThrow(e); } }
@Override public void delete(final String projectId) { try { runWithRetries( new Callable<Void>() { @Override public Void call() { resourceManagerRpc.delete(projectId); return null; } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException ex) { throw ResourceManagerException.translateAndThrow(ex); } }
@Override public void undelete(final String projectId) { try { runWithRetries( new Callable<Void>() { @Override public Void call() { resourceManagerRpc.undelete(projectId); return null; } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException ex) { throw ResourceManagerException.translateAndThrow(ex); } }
@Override public String getSerialPortOutput(final InstanceId instance) { try { return runWithRetries( new Callable<String>() { @Override public String call() { return computeRpc.getSerialPortOutput( instance.getZone(), instance.getInstance(), null, optionMap()); } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelper.RetryHelperException e) { throw ComputeException.translateAndThrow(e); } }
@Override public String getSerialPortOutput(final InstanceId instance, final int port) { try { return runWithRetries( new Callable<String>() { @Override public String call() { return computeRpc.getSerialPortOutput( instance.getZone(), instance.getInstance(), port, optionMap()); } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelper.RetryHelperException e) { throw ComputeException.translateAndThrow(e); } }
@Override public boolean delete(String bucket, BucketSourceOption... options) { final com.google.api.services.storage.model.Bucket bucketPb = BucketInfo.of(bucket).toPb(); final Map<StorageRpc.Option, ?> optionsMap = optionMap(options); try { return runWithRetries( new Callable<Boolean>() { @Override public Boolean call() { return storageRpc.delete(bucketPb, optionsMap); } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelperException e) { throw StorageException.translateAndThrow(e); } }