Interface ProtobufDatabase

  • All Known Implementing Classes:
    RdbProtobufDatabase

    public interface ProtobufDatabase
    A database that allows to store and retrieve protobuf messages.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean delete​(String id)
      Delete a protobuf message for a specific id.
      <T extends com.google.protobuf.Message>
      T
      get​(String id, Class<T> messageClass)
      Retrieves a protobuf message for a specific id.
      void save​(String id, com.google.protobuf.Message message)
      Save a protobuf message.
    • Method Detail

      • save

        void save​(String id,
                  com.google.protobuf.Message message)
           throws IOException
        Save a protobuf message. If a message is already saved under the given id, it is overwritten.
        Parameters:
        id - the identifier
        message - the protobuf message
        Throws:
        IOException
      • get

        <T extends com.google.protobuf.Message> T get​(String id,
                                                      Class<T> messageClass)
                                               throws IOException
        Retrieves a protobuf message for a specific id.
        Parameters:
        id - the identifier to search for
        messageClass - the expected message class
        Returns:
        the found message, or null
        Throws:
        IOException
      • delete

        boolean delete​(String id)
                throws IOException
        Delete a protobuf message for a specific id.
        Parameters:
        id - the identifier to search for
        Returns:
        whether a record was found and deleted.
        Throws:
        IOException