Class JournalBinaryStore

    • Field Detail

      • m_cEvacuations

        protected volatile long m_cEvacuations
        The number of evacuations occurred on this Journal.JournalConsumer.
      • m_journal

        protected Journal m_journal
        The journal manager for this BinaryStore.
      • m_blmTickets

        protected BinaryLongMap m_blmTickets
        Mapping from Binary keys to journal "tickets".
      • m_cbTotal

        protected final AtomicLong m_cbTotal
        Number of bytes in the Journal currently "owned" by this BinaryStore.
    • Constructor Detail

      • JournalBinaryStore

        public JournalBinaryStore​(Journal journal)
        Construct a JournalBinaryStore.
        Parameters:
        journal - the Journal to write to and read from
      • JournalBinaryStore

        public JournalBinaryStore​(Journal journal,
                                  MultiBinaryLongMap mblm)
        Construct a JournalBinaryStore.
        Parameters:
        journal - the Journal to write to and read from
        mblm - the MultiBinaryLongMap used to store the keys and tickets
    • Method Detail

      • load

        public Binary load​(Binary binKey)
        Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
        Specified by:
        load in interface BinaryStore
        Parameters:
        binKey - key whose associated value is to be returned
        Returns:
        the value associated with the specified key, or null if no value is available for that key
      • store

        public void store​(Binary binKey,
                          Binary binValue)
        Store the specified value under the specific key in the underlying store. This method is intended to support both key/value creation and value update for a specific key.
        Specified by:
        store in interface BinaryStore
        Parameters:
        binKey - key to store the value under
        binValue - value to be stored
      • erase

        public void erase​(Binary binKey)
        Remove the specified key from the underlying store if present.
        Specified by:
        erase in interface BinaryStore
        Parameters:
        binKey - key whose mapping is to be removed from the map
      • eraseAll

        public void eraseAll()
        Remove all data from the underlying store.
        Specified by:
        eraseAll in interface BinaryStore
      • keys

        public Iterator keys()
        Iterate all keys in the underlying store.
        Specified by:
        keys in interface BinaryStore
        Returns:
        a read-only iterator of the keys in the underlying store
      • size

        public int size()
        Determine the number of keys in the BinaryStore.
        Specified by:
        size in interface BinaryStore.SizeAware
        Returns:
        the number of keys in the BinaryStore
      • containsKey

        public boolean containsKey​(Binary binKey)
        Return true iff this BinaryStore contains a mapping for the specified key.
        Specified by:
        containsKey in interface BinaryStore.KeySetAware
        Parameters:
        binKey - key whose presence in the BinaryStore is to be tested
        Returns:
        true iff this BinaryStore contains a mapping for the specified key
      • evacuate

        public void evacuate​(long lTicketMask,
                             long lTicketValue)
        This method may be invoked by the Journal implementation to request that the consumer evacuate a particular journal file.
        Specified by:
        evacuate in interface Journal.JournalConsumer
        Parameters:
        lTicketMask - indicates which bits of the tickets to check
        lTicketValue - indicates what bit pattern needs to be matched on the tickets in order to select them for evacuation
      • dedupe

        public void dedupe​(byte[][] aab)
        This method may be invoked by the Journal implementation to request that any immutable byte arrays managed by the consumer be de-duplicated.
        Specified by:
        dedupe in interface Journal.JournalConsumer
        Parameters:
        aab - an array of byte[] objects for intern-ing byte[] references
      • getDescription

        public String getDescription()
        Format a String description of the Consumer.
        Specified by:
        getDescription in interface Journal.JournalConsumer
        Returns:
        a comma-delimited key-value description of this object
      • dispose

        public void dispose()
        Invoked when all resources owned by the implementer can safely be released.

        Once disposed of the object should no longer be considered to be usable.

        Note the Disposable interface is compatible with try-with-resources which will automatically invoke this method.

        Specified by:
        dispose in interface Disposable
      • getJournal

        public Journal getJournal()
        Obtain the underlying journaling system used by this BinaryStore.
        Returns:
        the Journal that this JournalBinaryStore uses.
      • getKeyCount

        public int getKeyCount()
        Determine the number of keys currently stored in the journal by this BinaryStore. Note that this doesn't including data that has been released but whose space has not yet been reclaimed by the journal.
        Returns:
        the number of keys in the journal held for this BinaryStore
      • getByteCount

        public long getByteCount()
        Calculate the total amount of data currently stored in the journal by this BinaryStore. Note that this doesn't including data that has been released but whose space has not yet been reclaimed by the journal.
        Returns:
        the number of bytes in the journal used by this BinaryStore
      • getTicketTree

        protected BinaryLongMap getTicketTree()
        An internal accessor for the "tree of tickets"; this accessor is used only by client threads, and has a built-in check for if the journal has already been disposed of (which could occur on a different thread).
        Returns:
        the tree of tickets
      • configureTicketTree

        protected BinaryLongMap configureTicketTree()
        Configure and return the BinaryLongMap to be used to store journal tickets.
        Returns:
        the BinaryLongMap to be used to store journal tickets