Comment

Comment by Ericson2314

I want to ditch the Nar format as soon as possible. IPFS's unixfs format is too rich however.

When will the IPFS people finish up https://github.com/ipld/cid so we can link whatever content addressable data we want?

I'd use git tree objects, despite SHA-1, because it's widely supported. Or do a format identical tree objects but with the IPFS's multihash and SHA-1 banned.

Point is, underlying protocol should be agnostic to hashing scheme, we should have a trait/type class like

  /// Node in try
  trait Payload {
    type Hash: HashingTrait;

    fn unpack(Payload) -> (Vec<u8>, Set<Hash>);
    fn pack(Vec<u8>, Set<Hash>) -> Payload;

    // Implement either and get the other for free!
    fn hash_packed(p: Payload) -> Hash { hash_unpacked(packed(p))
    fn hash_unpacked(p: (Vec<u8>, Set<Hash>)) -> Hash { hash_packed(packed(p)) }
  }

any `(Hash, Payload)` than can define a `(binary blob, Set<Hash>) -> Hash` and Payload function should work.
parent Ericson2314 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton