finish message serialization of progress meters

Any given transfer can only display 1 progress meter at a time, or so
this code assumes. In some cases, there are progress meters for
different stages of a transfer, perhaps, and that is supported by this.

This commit was sponsored by Ethan Aubin.
This commit is contained in:
Joey Hess 2020-12-04 13:50:03 -04:00
parent 4efecaebd6
commit 31e417f351
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 91 additions and 33 deletions

View file

@ -9,6 +9,7 @@ module Types.Messages where
import qualified Utility.Aeson as Aeson
import Utility.Metered
import Utility.FileSize
import Control.Concurrent
import System.Console.Regions (ConsoleRegion)
@ -66,7 +67,9 @@ newMessageState = do
data SerializedOutput
= OutputMessage S.ByteString
| OutputError String
| ProgressMeter (Maybe Integer) MeterState MeterState
| StartProgressMeter (Maybe FileSize)
| UpdateProgressMeter BytesProcessed
| EndProgressMeter
| JSONObject L.ByteString
-- ^ This is always sent, it's up to the consumer to decide if it
-- wants to display JSON, or human-readable messages.