   (:import [org.agrona.concurrent UnsafeBuffer]
            [java.nio ByteOrder]))
 
-;; TODO: try to remove the extra allocation in get-bytes
-;; It would be preferable to directly write from the buffer into LMDB
 (defprotocol PEncoder
   (set-state-idx [this idx])
   (set-group-id [this group-id])

  (set-min-extent [this]
    (set-extent this 0))
  (set-extent [this extent]
    (.putLong buffer 2 extent java.nio.ByteOrder/BIG_ENDIAN))
  (length [this] 10)
  (wrap-impl [this bs]
    (.wrap buffer ^bytes bs))

    (let [[extent1 extent2] ee
          extent1-offset (unchecked-add-int offset 10)
          extent2-offset (unchecked-add-int offset 18)]
      (.putLong buffer extent1-offset extent1 ByteOrder/BIG_ENDIAN)
      (.putLong buffer extent2-offset extent2 ByteOrder/BIG_ENDIAN)))
  (length [this] 26)
  (wrap-impl [this bs]
    (.wrap buffer ^bytes bs))
