Interface Store


  • public interface Store
    The object store's underlying store
    • Method Detail

      • get

        StoreInfo get​(java.util.List<? extends StoreKey> ids,
                      java.util.EnumSet<StoreGetOptions> storeGetOptions)
               throws StoreException
        Returns the store info for the given ids
        Parameters:
        ids - The list of ids whose messages need to be retrieved
        storeGetOptions - A set of additional options that the store needs to use while getting the message
        Returns:
        The store info for the given ids
        Throws:
        StoreException
      • put

        void put​(MessageWriteSet messageSetToWrite)
          throws StoreException
        Puts a set of messages into the store. When the lifeVersion is MessageInfo.LIFE_VERSION_FROM_FRONTEND, this method is invoked by the responding to the frontend request. Otherwise, it's invoked in the replication thread.
        Parameters:
        messageSetToWrite - The message set to write to the store Only the StoreKey, OperationTime, ExpirationTime, LifeVersion should be used in this method.
        Throws:
        StoreException
      • delete

        void delete​(java.util.List<MessageInfo> infosToDelete)
             throws StoreException
        Deletes all the messages in the list. When the lifeVersion is MessageInfo.LIFE_VERSION_FROM_FRONTEND, this method is invoked by the responding to the frontend request. Otherwise, it's invoked in the replication thread.
        Parameters:
        infosToDelete - The list of messages that need to be deleted. Only the StoreKey, OperationTime, LifeVersion should be used in this method.
        Throws:
        StoreException
      • undelete

        short undelete​(MessageInfo info)
                throws StoreException
        Undelete the blob identified by id. When the lifeVersion is MessageInfo.LIFE_VERSION_FROM_FRONTEND, this method is invoked by the responding to the frontend request. Otherwise, it's invoked in the replication thread.
        Parameters:
        info - The MessageInfo that carries some basic information about this operation. Only the StoreKey, OperationTime, LifeVersion should be used in this method.
        Returns:
        the lifeVersion of the undeleted blob.
        Throws:
        StoreException
      • updateTtl

        void updateTtl​(java.util.List<MessageInfo> infosToUpdate)
                throws StoreException
        Updates the TTL of all the messages in the list. When the lifeVersion is MessageInfo.LIFE_VERSION_FROM_FRONTEND, this method is invoked by the responding to the frontend request. Otherwise, it's invoked in the replication thread.
        Parameters:
        infosToUpdate - The list of messages that need to be updated Only the StoreKey, OperationTime, ExpirationTime, LifeVersion should be used in this method.
        Throws:
        StoreException
      • findEntriesSince

        FindInfo findEntriesSince​(FindToken token,
                                  long maxTotalSizeOfEntries)
                           throws StoreException
        Finds all the entries from the store given a find token
        Parameters:
        token - The token that acts as a bookmark to make subsequent searches
        maxTotalSizeOfEntries - The maximum total size of entries that needs to be returned. The api will try to return a list of entries whose total size is close to this value.
        Returns:
        The FindInfo instance that contains the entries found and the new token for future searches
        Throws:
        StoreException
      • findMissingKeys

        java.util.Set<StoreKey> findMissingKeys​(java.util.List<StoreKey> keys)
                                         throws StoreException
        Finds all the keys that are not present in the store from the input keys
        Parameters:
        keys - The list of keys that need to be checked for existence
        Returns:
        The list of keys that are not present in the store
        Throws:
        StoreException
      • getStoreStats

        StoreStats getStoreStats()
        Get the corresponding StoreStats instance for this store.
        Returns:
        a StoreStats instance which can be used to fetch store related stats
      • isKeyDeleted

        boolean isKeyDeleted​(StoreKey key)
                      throws StoreException
        Checks if the key is deleted. Returns true is the key is deleted. Returns false if the key is present, not available, ttl expired.
        Parameters:
        key - The key that needs to be checked for deletion state
        Returns:
        True, if the key is deleted, false otherwise
        Throws:
        StoreException
      • getSizeInBytes

        long getSizeInBytes()
        Returns the size of the store in bytes
        Returns:
        The size of the store in bytes
      • getEndPositionOfLastPut

        long getEndPositionOfLastPut()
                              throws StoreException
        Returns:
        absolute end position of last PUT in bytes.
        Throws:
        StoreException
      • isEmpty

        boolean isEmpty()
        Returns:
        true if the store contains no data
      • isStarted

        boolean isStarted()
        Returns:
        true if the store is started
      • isBootstrapInProgress

        boolean isBootstrapInProgress()
        Returns:
        true if store has initiated bootstrap process and bootstrap is still in progress.
      • isDecommissionInProgress

        boolean isDecommissionInProgress()
        Returns:
        true if store has initiated decommission process (STANDBY -> INACTIVE -> OFFLINE) and decommission is still in progress.
      • completeBootstrap

        void completeBootstrap()
        Take actions (if any) to complete the bootstrap (i.e, delete bootstrap file in store directory)
      • setCurrentState

        void setCurrentState​(ReplicaState state)
        Set current state of the store.
        Parameters:
        state - ReplicaState associated with local store
      • recoverFromDecommission

        boolean recoverFromDecommission()
        Returns:
        true if the store is recovering from previous decommission failure. false otherwise.
      • isDisabled

        boolean isDisabled()
        Returns:
        true if the store is disabled due to disk I/O error or by admin operation(i.e. stop replica).