firepear / petrel

It's like SQLite, but for networking
MIT License
20 stars 1 forks source link

Adding Req and Resp to petrel.Conn #74

Closed firepear closed 2 months ago

firepear commented 2 months ago

Creating structs for a request object and a response object means that data can live within the Conn.

This should allow the removal of all transient data from the network read/write functions, making everything cleaner.

It also means that ConnRead no longer has to return a mystifying collection of things; it will simply update the Conn's Resp and return nothing but an err. And that err won't be overloaded with app-level information on the status of the request; it will only indicate whether there was an error with the read or not. Request status will be in the request struct.

firepear commented 2 months ago

A consequence of this is going to be that basically all tests are going to become worthless. Should add an issue for that.

firepear commented 2 months ago

Only added Resp. Once I got in there, it became obvious that Req isn't needed.

ConnRead now returns only an error; everything else is put inside Resp, which is part of petrel.Conn, which is itself copied to the client for ease of use.

The remaining work is cleaning up all the error messages coming from ConnRead.

firepear commented 2 months ago

Done.