summaryrefslogtreecommitdiff
path: root/P2P/Protocol.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-02 14:49:22 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-02 14:54:33 -0400
commit98838a112219dbf57d5ef3a101122cde180faf9f (patch)
tree7c985b9bb97da900416240b50f37d0e9847207ce /P2P/Protocol.hs
parentaf69d6a45bcb29149eccde2b0d675a551233ff71 (diff)
initial implementation of P2P.Annex runner
Untested, and it does not yet update transfer logs. Verifying transferred content is modeled on git-annex-shell recvkey. In a direct mode or annex.thin repository, content can change while it's being transferred. So, verification is always done, even if annex.verify would normally prevent it. Note that a WORM or URL key could change in a way the verification doesn't catch. That can happen in git-annex-shell recvkey too. We don't worry about it, because those key backends don't guarantee preservation of data. (Which is to say, I worried about it, and then convinced myself again it was ok.)
Diffstat (limited to 'P2P/Protocol.hs')
-rw-r--r--P2P/Protocol.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/P2P/Protocol.hs b/P2P/Protocol.hs
index 7c83a26b1..b67dc118d 100644
--- a/P2P/Protocol.hs
+++ b/P2P/Protocol.hs
@@ -174,7 +174,9 @@ data LocalF c
-- May fail if not enough copies to safely drop, etc.
| TryLockContent Key (Bool -> Proto ()) c
-- ^ Try to lock the content of a key, preventing it
- -- from being deleted, and run the provided protocol action.
+ -- from being deleted, while running the provided protocol
+ -- action. If unable to lock the content, runs the protocol action
+ -- with False.
deriving (Functor)
type Local = Free LocalF
@@ -291,7 +293,7 @@ serve myuuid = go Nothing
when ok $
local $ setPresent key myuuid
-- setPresent not called because the peer may have
- -- requested the data but not permanatly stored it.
+ -- requested the data but not permanently stored it.
GET offset key -> void $ sendContent key offset
CONNECT service -> net $ relayService service
_ -> net $ sendMessage (ERROR "unexpected command")