Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with errors during compression #57

Open
edsko opened this issue Jan 20, 2024 · 1 comment
Open

Deal with errors during compression #57

edsko opened this issue Jan 20, 2024 · 1 comment
Labels
enhancement New feature or request priority: low Minor enhancements

Comments

@edsko
Copy link
Collaborator

edsko commented Jan 20, 2024

Compression is currently defined as

data Compression = Compression {
      compressionId :: CompressionId
    , compress :: Lazy.ByteString -> Lazy.ByteString
    , decompress :: Lazy.ByteString -> Lazy.ByteString
    }

The type of decompress should instead be

data Compression = Compression {
      compressionId :: CompressionId
    , compress :: Lazy.ByteString -> Lazy.ByteString
    , decompress :: Lazy.ByteString -> Either DecompresionFailure Lazy.ByteString
    }

And these decompression failures then need to propagate everywhere, and the specific instances of Compression (such as gzip) need to be modified.

@edsko edsko added enhancement New feature or request priority: medium Should be done before the library can be considered complete labels Jan 20, 2024
@edsko
Copy link
Collaborator Author

edsko commented Mar 23, 2024

Lowering the priority of this issue to low, since the probability that a peer sends us messages that have compression errors in them is very low.

If we implement this, we should think about whether the difficulty of streaming decompression whilst checking for errors is relevant or not (@FinleyMcIlwaine has some discussion of this issue at https://hackage.haskell.org/package/snappy-c-0.1.0/docs/Codec-Compression-SnappyC-Framed.html#v:decompressWithParams-39-).

@edsko edsko added priority: low Minor enhancements and removed priority: medium Should be done before the library can be considered complete labels Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: low Minor enhancements
Projects
None yet
Development

No branches or pull requests

1 participant