db.deleteItem(applyUserAgent(req));
private DeleteItemOutcome doDeleteItem(DeleteItemSpec spec) { // set the table name final String tableName = getTable().getTableName(); // set up the keys DeleteItemRequest req = spec.getRequest().withTableName(tableName) .withKey(InternalUtils.toAttributeValueMap(spec.getKeyComponents())); // set up the expected attribute map, if any final Collection<Expected> expected = spec.getExpected(); final Map<String, ExpectedAttributeValue> expectedMap = InternalUtils.toExpectedAttributeValueMap(expected); // set up the value map, if any (when expression API is used) final Map<String,AttributeValue> attrValMap = InternalUtils.fromSimpleMap(spec.getValueMap()); // set up the request req.withExpected(expectedMap) .withExpressionAttributeNames(spec.getNameMap()) .withExpressionAttributeValues(attrValMap) ; DeleteItemResult result = getClient().deleteItem(req); return new DeleteItemOutcome(result); }
private Document deleteItem(Key key, DeleteItemOperationConfig config) { final DeleteItemRequest request = new DeleteItemRequest(tableName, key); if (config != null) { request.setReturnValues(config.getReturnValue()); } Table.appendDynamoDBDocumentUserAgentString(request); final DeleteItemResult result = this.client.deleteItem(request); final Document returnDocument = this.fromAttributeMap(result.getAttributes()); returnDocument.commit(); return returnDocument; }
@Override public DeleteItemResult deleteItem(DeleteItemRequest request) throws AmazonServiceException, AmazonClientException { return getBackend().deleteItem(request); }
@Override public DeleteItemResult deleteItem(String tableName, Map<String, AttributeValue> key) throws AmazonServiceException, AmazonClientException { return getBackend().deleteItem(tableName, key); }
@Override public DeleteItemResult deleteItem(String tableName, Map<String, AttributeValue> key, String returnValues) throws AmazonServiceException, AmazonClientException { return getBackend().deleteItem(tableName, key, returnValues); }
db.deleteItem(applyUserAgent(req));
/** * {@inheritDoc} */ public void deleteAll() throws DependencyException, InvalidStateException, ProvisionedThroughputException { List<T> allLeases = listLeases(); LOG.warn("Deleting " + allLeases.size() + " items from table " + table); for (T lease : allLeases) { DeleteItemRequest deleteRequest = new DeleteItemRequest(); deleteRequest.setTableName(table); deleteRequest.setKey(serializer.getDynamoHashKey(lease)); dynamoDBClient.deleteItem(deleteRequest); } }
private void deleteRow(String key, String appid) { if (StringUtils.isBlank(key) || StringUtils.isBlank(appid)) { return; } try { DeleteItemRequest delItemRequest = new DeleteItemRequest(getTableNameForAppid(appid), Collections.singletonMap(Config._KEY, new AttributeValue(getKeyForAppid(key, appid)))); client().deleteItem(delItemRequest); } catch (Exception e) { logger.error("Could not delete row from DB - appid={}, key={}", appid, key, e); throwIfNecessary(e); } }
private void deleteRow(String key, String appid) { if (StringUtils.isBlank(key) || StringUtils.isBlank(appid)) { return; } try { DeleteItemRequest delItemRequest = new DeleteItemRequest(getTableNameForAppid(appid), Collections.singletonMap(Config._KEY, new AttributeValue(getKeyForAppid(key, appid)))); client().deleteItem(delItemRequest); } catch (Exception e) { logger.error("Could not delete row from DB - appid={}, key={}", appid, key, e); throwIfNecessary(e); } }
public void removeState(final String streamName, final String applicationName, final String namespace, final String shardId) throws Exception { DeleteItemRequest req = new DeleteItemRequest().withTableName(TABLE_NAME).withKey( getKey(streamName, applicationName, namespace, shardId)); dynamoClient.deleteItem(req); }
/** * Deletes the old version of the item. Item images are immutable - it's just create + delete, so there is no need for * concurrent modification checks. * * @param rid */ public void deleteItemImage(int rid) { txAssert(rid > 0, txId, "Expected rid > 0"); Map<String, AttributeValue> key = new HashMap<String, AttributeValue>(1); key.put(AttributeName.IMAGE_ID.toString(), new AttributeValue(txId + "#" + rid)); txManager.getClient().deleteItem(new DeleteItemRequest() .withTableName(txManager.getItemImageTableName()) .withKey(key)); }
/** * {@inheritDoc} */ @Override public void deleteLease(T lease) throws DependencyException, InvalidStateException, ProvisionedThroughputException { verifyNotNull(lease, "lease cannot be null"); if (LOG.isDebugEnabled()) { LOG.debug(String.format("Deleting lease with leaseKey %s", lease.getLeaseKey())); } DeleteItemRequest deleteRequest = new DeleteItemRequest(); deleteRequest.setTableName(table); deleteRequest.setKey(serializer.getDynamoHashKey(lease)); try { dynamoDBClient.deleteItem(deleteRequest); } catch (AmazonClientException e) { throw convertAndRethrowExceptions("delete", lease.getLeaseKey(), e); } }
/** * Deletes the tx item, only if it was in the "finalized" state. * * @throws ConditionalCheckFailedException if the item does not exist or is not finalized */ public void delete() throws ConditionalCheckFailedException { Map<String, ExpectedAttributeValue> expected = new HashMap<String, ExpectedAttributeValue>(1); expected.put(AttributeName.FINALIZED.toString(), new ExpectedAttributeValue().withValue(new AttributeValue(Transaction.BOOLEAN_TRUE_ATTR_VAL))); DeleteItemRequest completeRequest = new DeleteItemRequest() .withTableName(txManager.getTransactionTableName()) .withKey(txKey) .withExpected(expected); txManager.getClient().deleteItem(completeRequest); }
request.setReturnValues(ReturnValue.NONE); request.setReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); final DeleteItemResult result = aws.deleteItem(request); final long start = System.currentTimeMillis(); Logger.info(
request.setReturnValues(ReturnValue.NONE); request.setReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); final DeleteItemResult result = aws.deleteItem(request); final long start = System.currentTimeMillis(); Logger.info(
DeleteItemResult deleteItem(final DeleteItemRequest request) throws BackendException { setUserAgent(request); DeleteItemResult result; final int wcu = estimateCapacityUnits(DELETE_ITEM, request.getTableName()); timedWriteThrottle(DELETE_ITEM, request.getTableName(), wcu); final Timer.Context apiTimerContext = getTimerContext(DELETE_ITEM, request.getTableName()); try { result = client.deleteItem(request); } catch (Exception e) { throw processDynamoDbApiException(e, DELETE_ITEM, request.getTableName()); } finally { apiTimerContext.stop(); } meterConsumedCapacity(DELETE_ITEM, result.getConsumedCapacity()); return result; }
items.remove(this.position); final long start = System.currentTimeMillis(); final DeleteItemResult res = aws.deleteItem( new DeleteItemRequest() .withTableName(this.name)
.withKey(key) .withExpected(expected); txManager.getClient().deleteItem(delete); } catch (ConditionalCheckFailedException e1) {
private DeleteItemOutcome doDeleteItem(DeleteItemSpec spec) { // set the table name final String tableName = getTable().getTableName(); // set up the keys DeleteItemRequest req = spec.getRequest().withTableName(tableName) .withKey(InternalUtils.toAttributeValueMap(spec.getKeyComponents())); // set up the expected attribute map, if any final Collection<Expected> expected = spec.getExpected(); final Map<String, ExpectedAttributeValue> expectedMap = InternalUtils.toExpectedAttributeValueMap(expected); // set up the value map, if any (when expression API is used) final Map<String,AttributeValue> attrValMap = InternalUtils.fromSimpleMap(spec.getValueMap()); // set up the request req.withExpected(expectedMap) .withExpressionAttributeNames(spec.getNameMap()) .withExpressionAttributeValues(attrValMap) ; DeleteItemResult result = getClient().deleteItem(req); return new DeleteItemOutcome(result); }