Interface StorageService

  • All Known Implementing Classes:
    InMemoryStorageService

    public interface StorageService
    Used to persist state used by the Bank Service. This is to avoid hosting a separate database for the Bank Service whose needs for persistent storage are limited. It is only needed if Token Bank Service is hosted by the bank.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Optional<byte[]> getValue​(java.lang.String key)
      Returns the value associated with the given key.
      void removeValue​(java.lang.String key)
      Removes the entry with a given key.
      java.util.Optional<byte[]> setValue​(java.lang.String key, io.token.proto.bankapi.Bankapi.SetValueRequest.ContentCategory category, byte[] value)
      Sets the value for a given key.
    • Method Detail

      • getValue

        java.util.Optional<byte[]> getValue​(java.lang.String key)
        Returns the value associated with the given key.
        Parameters:
        key - the key
        Returns:
        the value
      • setValue

        java.util.Optional<byte[]> setValue​(java.lang.String key,
                                            io.token.proto.bankapi.Bankapi.SetValueRequest.ContentCategory category,
                                            byte[] value)
        Sets the value for a given key. Over time, might be called more than once for the same key, setting a new value.
        Parameters:
        key - the key
        category - content category, can be used to set up category-specific retention policies.
        value - the value to set
        Returns:
        previous value if present
      • removeValue

        void removeValue​(java.lang.String key)
        Removes the entry with a given key.
        Parameters:
        key - the key