custom protocol for transferrer
authorJoey Hess <joeyh@joeyh.name>
Wed, 9 Dec 2020 19:44:00 +0000 (15:44 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 9 Dec 2020 20:13:59 +0000 (16:13 -0400)
commit04c12aa6dfe50e8354767db64b15c29680325f79
treef9bef1b93551a65ea0ffd7bfd8ed1b5f411b977f
parent447d7989872f5b6596f5d41f914619aa9d588b0b
custom protocol for transferrer

Rather than using Read/Show, which would force me to preserve data types
into the future.

I considered just deriving json and sending that, but I don't much like
deriving json with data types that have named constructors (like Key
does) because again it locks in data type details.

So instead, used SimpleProtocol, with a fairly complex and unreadable
protocol. But it is as efficient as the p2p protocol at least, and as
future proof.

(Writing my own custom json instances would have worked but I thought
of it too late and don't want to do all the work twice. The only real
benefit might be that aeson could be faster.)

Note that, when a new protocol request type is added later, git-annex
trying to use it will cause the git-annex transferrer to display a
protocol error message. That seems ok; it would only happen if a new
git-annex found an old version of itself in PATH or the program
file. So it's unlikely, and all it can do anyway is display an error.
(The error message could perhaps be improved..)

This commit was sponsored by Jack Hill on Patreon.
Annex/Transfer.hs
Annex/TransferrerPool.hs
Assistant/TransferSlots.hs
Command/Transferrer.hs
Types/Messages.hs
Types/Transferrer.hs