summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-13 12:55:16 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-13 12:55:16 +0400
commit009b10f45c534977439bb9f40f424abefc579c58 (patch)
tree341fb292d5a2677a3c7562f57d9a14f5edbb6ea8 /src
parentd0cf97873e8b60b113bd2a3686b4868d1988c6c7 (diff)
Add insertLazy function
Diffstat (limited to 'src')
-rw-r--r--src/Network/BitTorrent/Exchange/Block.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/Exchange/Block.hs b/src/Network/BitTorrent/Exchange/Block.hs
index d713bcf1..c910a716 100644
--- a/src/Network/BitTorrent/Exchange/Block.hs
+++ b/src/Network/BitTorrent/Exchange/Block.hs
@@ -43,6 +43,7 @@ module Network.BitTorrent.Exchange.Block
43 -- ** Construction 43 -- ** Construction
44 , Network.BitTorrent.Exchange.Block.empty 44 , Network.BitTorrent.Exchange.Block.empty
45 , Network.BitTorrent.Exchange.Block.insert 45 , Network.BitTorrent.Exchange.Block.insert
46 , Network.BitTorrent.Exchange.Block.insertLazy
46 , Network.BitTorrent.Exchange.Block.merge 47 , Network.BitTorrent.Exchange.Block.merge
47 48
48 -- ** Rendering 49 -- ** Rendering
@@ -319,6 +320,10 @@ insert dstPos bs bucket = go 0 bucket
319 | intersects curPos sz = bkt 320 | intersects curPos sz = bkt
320 | otherwise = fill sz br (go (curPos + sz) xs) 321 | otherwise = fill sz br (go (curPos + sz) xs)
321 322
323-- TODO zero-copy
324insertLazy :: Pos -> BL.ByteString -> Bucket -> Bucket
325insertLazy pos bl = Network.BitTorrent.Exchange.Block.insert pos (BL.toStrict bl)
326
322-- | /O(n)/. 327-- | /O(n)/.
323merge :: Bucket -> Bucket -> Bucket 328merge :: Bucket -> Bucket -> Bucket
324merge = undefined 329merge = undefined