Closed yusefnapora closed 8 years ago
Given that announce/provide is the expensive step, this should get replaced with the --local
flag as soon as support is added on the IPFS side so we get the files stored in the repo.
overall lgtm
Maybe I should change the argument from only_hash_assets
to local_ipfs
or something? then we can swap out the implementation with ipfs add --local
when that lands.
sounds good
this adds a
hash_only
arg to theput
method of the ipfs and rpc datastores (defaults toFalse
, of course). This lets us skip the expensive ipfs DHT advertisement, etc when doing bulk ingestions but still get an ipfs hash that will resolve if we go back through and add the asset later.To use it when ingesting things, the
Writer
should be initialized with theonly_hash_assets
arg set toTrue
also fixes a couple small things I discovered in the repl while adding this:
IpfsDatastore.get
wasn't closing the read stream correctlyobject_for_bytes
helper was sometimes decoding plain strings as cbor values if they happened to start with valid cbor bytes... e.g. "hello world" would deserialize as a unicode string "ello worl". So now we only return the decoded value if it's a cbor map