Interface DocumentStore<K>

Type Parameters:
K - the type of keys
All Superinterfaces:
KeyValueStore<K,Map>, PStateStore, Store

public interface DocumentStore<K> extends KeyValueStore<K,Map>
DocumentStore is like a key-value store where each value is a document (map) that can contain nested fields. Stores are distributed, durable, and replicated. Document stores are created using AgentTopology.declareDocumentStore(String, Class, Object...).
  • Method Details

    • getDocumentField

      Object getDocumentField(K key, Object docKey)
      Gets a field value from a document.
      Parameters:
      key - the document key
      docKey - the field key within the document
      Returns:
      the field value, or null if not found
    • getDocumentFieldOrDefault

      Object getDocumentFieldOrDefault(K key, Object docKey, Object defaultValue)
      Gets a field value from a document, or returns a default value if not found.
      Parameters:
      key - the document key
      docKey - the field key within the document
      defaultValue - the default value to return if field is not found
      Returns:
      the field value, or the default value if not found
    • containsDocumentField

      boolean containsDocumentField(K key, Object docKey)
      Checks if a document contains a specific field.
      Parameters:
      key - the document key
      docKey - the field key to check
      Returns:
      true if the document contains the field, false otherwise
    • putDocumentField

      void putDocumentField(K key, Object docKey, Object value)
      Sets a field value in a document.
      Parameters:
      key - the document key
      docKey - the field key within the document
      value - the value to set
    • updateDocumentField

      <T, R> void updateDocumentField(K key, Object docKey, com.rpl.rama.ops.RamaFunction1<T,R> updateFunction)
      Updates a field value in a document using the provided function.
      Parameters:
      key - the document key
      docKey - the field key within the document
      updateFunction - function to apply to the current field value