.value(AttributeValue.builder().s(field[1]).build()) .action(AttributeAction.PUT) .build());
@Override public Map<String, AttributeValueUpdate> getDynamoEvictLeaseUpdate(final Lease lease) { Map<String, AttributeValueUpdate> result = new HashMap<>(); AttributeValue value = null; result.put(LEASE_OWNER_KEY, AttributeValueUpdate.builder().value(value).action(AttributeAction.DELETE).build()); return result; }
@Override public Map<String, AttributeValueUpdate> getDynamoEvictLeaseUpdate(final Lease lease) { Map<String, AttributeValueUpdate> result = new HashMap<>(); AttributeValue value = null; result.put(LEASE_OWNER_KEY, AttributeValueUpdate.builder().value(value).action(AttributeAction.DELETE).build()); return result; }
/** * <p> * Represents the data for an attribute. * </p> * <p> * Each attribute value is described as a name-value pair. The name is the data type, and the value is the data * itself. * </p> * <p> * For more information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes" * >Data Types</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * This is a convenience that creates an instance of the {@link AttributeValue.Builder} avoiding the need to * create one manually via {@link AttributeValue#builder()}. * * When the {@link Consumer} completes, {@link AttributeValue.Builder#build()} is called immediately and its * result is passed to {@link #value(AttributeValue)}. * * @param value * a consumer that will call methods on {@link AttributeValue.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #value(AttributeValue) */ default Builder value(Consumer<AttributeValue.Builder> value) { return value(AttributeValue.builder().applyMutation(value).build()); }
private AttributeValueUpdate putUpdate(AttributeValue attributeValue) { return AttributeValueUpdate.builder().value(attributeValue).action(AttributeAction.PUT).build(); }
private AttributeValueUpdate putUpdate(AttributeValue attributeValue) { return AttributeValueUpdate.builder().value(attributeValue).action(AttributeAction.PUT).build(); }
public Map<String, AttributeValueUpdate> getDynamoLeaseCounterUpdate(Long leaseCounter) { Map<String, AttributeValueUpdate> result = new HashMap<>(); AttributeValueUpdate avu = AttributeValueUpdate.builder().value(DynamoUtils.createAttributeValue(leaseCounter + 1)).action(AttributeAction.PUT).build(); result.put(LEASE_COUNTER_KEY, avu); return result; }
@Override public Map<String, AttributeValueUpdate> getDynamoTakeLeaseUpdate(final Lease lease, String owner) { Map<String, AttributeValueUpdate> result = new HashMap<>(); result.put(LEASE_OWNER_KEY, AttributeValueUpdate.builder().value(DynamoUtils.createAttributeValue(owner)).action(AttributeAction.PUT).build()); String oldOwner = lease.leaseOwner(); if (oldOwner != null && !oldOwner.equals(owner)) { result.put(OWNER_SWITCHES_KEY, AttributeValueUpdate.builder().value(DynamoUtils.createAttributeValue(1L)).action(AttributeAction.ADD).build()); } return result; }
public Map<String, AttributeValueUpdate> getDynamoLeaseCounterUpdate(Long leaseCounter) { Map<String, AttributeValueUpdate> result = new HashMap<>(); AttributeValueUpdate avu = AttributeValueUpdate.builder().value(DynamoUtils.createAttributeValue(leaseCounter + 1)).action(AttributeAction.PUT).build(); result.put(LEASE_COUNTER_KEY, avu); return result; }
@Override public Map<String, AttributeValueUpdate> getDynamoTakeLeaseUpdate(final Lease lease, String owner) { Map<String, AttributeValueUpdate> result = new HashMap<>(); result.put(LEASE_OWNER_KEY, AttributeValueUpdate.builder().value(DynamoUtils.createAttributeValue(owner)).action(AttributeAction.PUT).build()); String oldOwner = lease.leaseOwner(); if (oldOwner != null && !oldOwner.equals(owner)) { result.put(OWNER_SWITCHES_KEY, AttributeValueUpdate.builder().value(DynamoUtils.createAttributeValue(1L)).action(AttributeAction.ADD).build()); } return result; }