Hacker News new | ask | show | jobs
by lost_my_pwd 3535 days ago
Wow, I missed that. That violates the URI spec, assuming the author(s) were intending to use a URI.

https://tools.ietf.org/html/rfc3986 (see "3.3. Path").

1 comments

Right, it intentionally violates the URI spec by appending something to the end of it. The data structure they're storing has a natural pair-of-structures at its top level:

    data Database = InMemory | LevelDB Path | ViaHTTP URL

    newtype DataSet = DS Text
    newtype Hash = Hash Text 
    data Accessor = AccessDS DataSet | AccessValue (Either DataSet Hash) Path
    
    type DBAccessor = (Database, Accessor)
They elected to basically encode a DBAccessor above as a string which you can split on "::", with the URL above being stored on the left in the case of the ViaHTTP databases.
The string wasn't originally intended to be a URI, but I've been subsequently convinced that it would be useful for it to be one. We'll change it eventually.