mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-05-03 11:55:32 +00:00
ae8e1c5e9a
* agent: reset stats startedAt time in memory * getAgentSubsSummary * change sub counting * ack statistics * add import * instance * Revert "instance" This reverts commit1f63740d56. * Revert "add import" This reverts commitef72df8014. * modify sub counting * modify conn creation counting * use int64 * file size stats * remove import * ack err counting * conn del stats * format * new data * add data * toKB * restore connCompleted * use Int for counts * use rq from scope * remove getAgentSubsSummary * fix connCompleted * fix * revert disabling stats * use srv from scope * combine ack stats * modify * comment * count subs * refactor --------- Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
40 lines
729 B
Haskell
40 lines
729 B
Haskell
module Simplex.FileTransfer.Chunks where
|
|
|
|
import Data.Word (Word32)
|
|
|
|
serverChunkSizes :: [Word32]
|
|
serverChunkSizes = [chunkSize0, chunkSize1, chunkSize2, chunkSize3]
|
|
{-# INLINE serverChunkSizes #-}
|
|
|
|
chunkSize0 :: Word32
|
|
chunkSize0 = kb 64
|
|
{-# INLINE chunkSize0 #-}
|
|
|
|
chunkSize1 :: Word32
|
|
chunkSize1 = kb 256
|
|
{-# INLINE chunkSize1 #-}
|
|
|
|
chunkSize2 :: Word32
|
|
chunkSize2 = mb 1
|
|
{-# INLINE chunkSize2 #-}
|
|
|
|
chunkSize3 :: Word32
|
|
chunkSize3 = mb 4
|
|
{-# INLINE chunkSize3 #-}
|
|
|
|
kb :: Integral a => a -> a
|
|
kb n = 1024 * n
|
|
{-# INLINE kb #-}
|
|
|
|
toKB :: Integral a => a -> a
|
|
toKB n = n `div` 1024
|
|
{-# INLINE toKB #-}
|
|
|
|
mb :: Integral a => a -> a
|
|
mb n = 1024 * kb n
|
|
{-# INLINE mb #-}
|
|
|
|
gb :: Integral a => a -> a
|
|
gb n = 1024 * mb n
|
|
{-# INLINE gb #-}
|