diff options
author | Joey Hess <joeyh@joeyh.name> | 2014-12-08 19:14:24 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2014-12-08 19:15:07 -0400 |
commit | 929de31900dbc9654e0bcc1f4679f526aee7f99a (patch) | |
tree | d868a3bbae9a0af26191f461f317f6d40b08a2af /Remote/External | |
parent | 28764ce2dc29d1d93989b4061b5b12bac10902de (diff) |
Urls can now be claimed by remotes. This will allow creating, for example, a external special remote that handles magnet: and *.torrent urls.
Diffstat (limited to 'Remote/External')
-rw-r--r-- | Remote/External/Types.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Remote/External/Types.hs b/Remote/External/Types.hs index 2fc29e5b4..b00352702 100644 --- a/Remote/External/Types.hs +++ b/Remote/External/Types.hs @@ -92,6 +92,7 @@ data Request | GETCOST | GETAVAILABILITY | CLAIMURL URLString + | CHECKURL URLString | TRANSFER Direction Key FilePath | CHECKPRESENT Key | REMOVE Key @@ -109,6 +110,7 @@ instance Proto.Sendable Request where formatMessage GETCOST = ["GETCOST"] formatMessage GETAVAILABILITY = ["GETAVAILABILITY"] formatMessage (CLAIMURL url) = [ "CLAIMURL", Proto.serialize url ] + formatMessage (CHECKURL url) = [ "CHECKURL", Proto.serialize url ] formatMessage (TRANSFER direction key file) = [ "TRANSFER" , Proto.serialize direction @@ -135,6 +137,9 @@ data Response | INITREMOTE_FAILURE ErrorMsg | CLAIMURL_SUCCESS | CLAIMURL_FAILURE + | CHECKURL_SIZE Size + | CHECKURL_SIZEUNKNOWN + | CHECKURL_FAILURE ErrorMsg | UNSUPPORTED_REQUEST deriving (Show) @@ -154,6 +159,9 @@ instance Proto.Receivable Response where parseCommand "INITREMOTE-FAILURE" = Proto.parse1 INITREMOTE_FAILURE parseCommand "CLAIMURL-SUCCESS" = Proto.parse0 CLAIMURL_SUCCESS parseCommand "CLAIMURL-FAILURE" = Proto.parse0 CLAIMURL_FAILURE + parseCommand "CHECKURL-SIZE" = Proto.parse1 CHECKURL_SIZE + parseCommand "CHECKURL-SIZEUNKNOWN" = Proto.parse0 CHECKURL_SIZEUNKNOWN + parseCommand "CHECKURL-FAILURE" = Proto.parse1 CHECKURL_FAILURE parseCommand "UNSUPPORTED-REQUEST" = Proto.parse0 UNSUPPORTED_REQUEST parseCommand _ = Proto.parseFail @@ -225,6 +233,7 @@ instance Proto.Receivable AsyncMessage where type ErrorMsg = String type Setting = String type ProtocolVersion = Int +type Size = Integer supportedProtocolVersions :: [ProtocolVersion] supportedProtocolVersions = [1] @@ -253,6 +262,10 @@ instance Proto.Serializable Cost where serialize = show deserialize = readish +instance Proto.Serializable Size where + serialize = show + deserialize = readish + instance Proto.Serializable Availability where serialize GloballyAvailable = "GLOBAL" serialize LocallyAvailable = "LOCAL" |