Class PortabilityBasedHalfStorageEngine<T>

    • Constructor Detail

      • PortabilityBasedHalfStorageEngine

        public PortabilityBasedHalfStorageEngine​(Portability<? super T> portability)
    • Method Detail

      • write

        public java.lang.Integer write​(T object,
                                       int hash)
        Description copied from interface: HalfStorageEngine
        Converts the supplied value object into it's encoded form.
        Specified by:
        write in interface HalfStorageEngine<T>
        Parameters:
        object - a value object
        hash - the keys hash
        Returns:
        encoded value
      • free

        public abstract void free​(int encoding)
        Description copied from interface: HalfStorageEngine
        Called to indicate that the associated encoded value is no longer needed.

        This call can be used to free any associated resources tied to the lifecycle of the supplied encoded value.

        Specified by:
        free in interface HalfStorageEngine<T>
        Parameters:
        encoding - encoded value
      • read

        public T read​(int encoding)
        Description copied from interface: HalfStorageEngine
        Converts the supplied encoded value into its correct object form.
        Specified by:
        read in interface HalfStorageEngine<T>
        Parameters:
        encoding - encoded value
        Returns:
        a decoded value object
      • equals

        public boolean equals​(java.lang.Object value,
                              int encoding)
        Description copied from interface: HalfStorageEngine
        Called to determine the equality of the given Java object value against the given encoded form.

        Simple implementations will probably perform a decode on the given encoded form in order to do a regular Object.equals(Object) comparison. This method is provided to allow implementations to optimize this comparison if possible.

        Specified by:
        equals in interface HalfStorageEngine<T>
        Parameters:
        value - a value object
        encoding - encoded value
        Returns:
        true if the value and the encoding are equal
      • readBuffer

        protected abstract java.nio.ByteBuffer readBuffer​(int encoding)
      • writeBuffer

        protected abstract java.lang.Integer writeBuffer​(java.nio.ByteBuffer buffer,
                                                         int hash)
      • invalidateCache

        public void invalidateCache()
        Description copied from interface: HalfStorageEngine
        Invalidate any local key/value caches.

        This is called to indicate the termination of a map write "phase". Caching is permitted within a write operation (i.e. to cache around allocation failures during eviction processes).

        Specified by:
        invalidateCache in interface HalfStorageEngine<T>