All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dataspray.runner.StateManager Maven / Gradle / Ivy

There is a newer version: 0.0.14
Show newest version
// SPDX-FileCopyrightText: 2019-2022 Matus Faro 
// SPDX-License-Identifier: Apache-2.0
package io.dataspray.runner;

import java.math.BigDecimal;
import java.util.Optional;
import java.util.Set;

/**
 * A state manager that allows for easy and efficient access to a particular item in a DynamoDB table.
 * 

* This class is thread-safe, but is not safe across tasks as it delays writes and reads with weak consistency. * Updates are grouped together and flushed only when necessary. */ public interface StateManager extends AutoCloseable { /** * Get the key of the item this state manager is managing. */ String[] getKey(); /** * Update the TTL to reset the expiration time. */ void touch(); Optional getJson(String key, Class type); void setJson(String key, T item); String getString(String key); void setString(String key, String value); boolean getBoolean(String key); void setBoolean(String key, boolean value); BigDecimal getNumber(String key); void setNumber(String key, Number number); void addToNumber(String key, Number increment); Set getStringSet(String key); void setStringSet(String key, Set set); void addToStringSet(String key, String... values); void deleteFromStringSet(String key, String... values); void delete(String key); void flush(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy