module Network.QPACK.Table (
    -- * Dynamic table
    DynamicTable,
    newDynamicTableForEncoding,
    newDynamicTableForDecoding,

    -- * Getter and setter
    getMaxNumOfEntries,
    setBasePointToInsersionPoint,
    getBasePoint,
    getInsertionPoint,
    getInsertionPointSTM,
    checkInsertionPoint,
    getLargestReference,
    updateLargestReference,

    -- * Entry
    insertEntryToEncoder,
    insertEntryToDecoder,
    toIndexedEntry,

    -- * Reverse index
    RevIndex,
    RevResult (..),
    getRevIndex,
    lookupRevIndex,

    -- * Misc
    getHuffmanDecoder,
    setDebugQPACK,
    getDebugQPACK,
    qpackDebug,
) where

import Control.Concurrent.STM
import Network.HPACK.Internal (Entry)

import Network.QPACK.Table.Dynamic
import Network.QPACK.Table.RevIndex
import Network.QPACK.Table.Static
import Network.QPACK.Types

toIndexedEntry :: DynamicTable -> HIndex -> STM Entry
toIndexedEntry :: DynamicTable -> HIndex -> STM Entry
toIndexedEntry DynamicTable
_ (SIndex AbsoluteIndex
ai) = Entry -> STM Entry
forall a. a -> STM a
forall (m :: * -> *) a. Monad m => a -> m a
return (Entry -> STM Entry) -> Entry -> STM Entry
forall a b. (a -> b) -> a -> b
$ AbsoluteIndex -> Entry
toStaticEntry AbsoluteIndex
ai
toIndexedEntry DynamicTable
dyntbl (DIndex AbsoluteIndex
ai) = DynamicTable -> AbsoluteIndex -> STM Entry
toDynamicEntry DynamicTable
dyntbl AbsoluteIndex
ai