1. 25 Jun, 2019 1 commit
    • Eric Myhre's avatar
      Comments about future needs on nodebuilder. · 11bf0d4e
      Eric Myhre authored
      In thinking about how to make a 'bind' (aka, reflect and atlases) Node
      implementation, some interesting stuff comes up: despite being all
      one concrete Node implementation, it needs specialization (for the
      reflect.Value bound inside, specifically); and 'bind' nodes don't
      *necessarily* have a schema and a typed.Node associated with them,
      so the existing comments about specializing using Type info don't
      actually apply.  So!  What do?
      
      These comments are a tad hypothetical (and have been on my uncommitted
      working tree for a while, so hopefully they're not *too* stale; I just
      want to get them in history somewhere rather than keep dancing my
      patches around them)... but there's almost certainly something to
      address somewhere in this area.
      11bf0d4e
  2. 29 Mar, 2019 1 commit
  3. 16 Mar, 2019 2 commits
    • Eric Myhre's avatar
      Dag-json marshal and unmarshal. · 10442b3c
      Eric Myhre authored
      And fixes to all the encoding systems for checking lengths when they're
      provided by map and list start tokens.  Inconsistencies there are now
      errors.
      
      And some consistency changes across all the encoders to keep the diff
      of the dag-json system as minimal as possible.  (Dag-json needs to
      refer to the last handful of tokens sometimes when parsing a mapClose,
      so we keep their values outside of the loop body now.)
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      10442b3c
    • Eric Myhre's avatar
      Dag-cbor marshal/unmarshal. · a274b2db
      Eric Myhre authored
      We now have CIDs support!  You can create links backed by cids,
      and marshal them with dag-cbor; and you can unmarshal cbor data
      with dag-cbor and expect things with the CID link tag to be parsed
      into CIDs and exposed as IPLD Links.  Yay!
      
      (Dag-json is lagging.  The parse for those links is... more involved.
      When supported, it'll similarly have its own unmarshal and marshal
      just like the ones this diff introduces for dag-cbor.)
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      a274b2db
  4. 20 Feb, 2019 1 commit
    • Eric Myhre's avatar
      New unmarshal implementation! Generic. Woo! · be01e1e5
      Eric Myhre authored
      This unmarshal works for any NodeBuilder implementation, tada!
      
      Old ipldfree.Node-specific unmarshal dropped... as well as that entire
      system of interfaces.  They were first-pass stuff, and I think now it's
      pretty clear that it was barking up the wrong tree, and we've got better
      ideas to go with now instead.  (Also, as is probably obvious from a skim,
      the old code flipped pretty clearly into the new code.)
      
      Turns out refmt tokens aren't a very relevant interface in IPLD.
      I'm still using them... internally, to wire up the CBOR and JSON
      parsers without writing those again.  But the rest of IPLD is more
      like a full-on and principled alternative to refmt/obj and all its
      reflection code, and that's... pretty great.
      
      Earlier, I had a suspicion that we would want more interfaces for token
      handling on each Node implementation directly, and in particular I
      suspected we might use those token-based interfaces for doing transcription
      features that flip data from one concrete Node implementation into another.
      (That's why we had this ipldfree.Node-specialized impl in the first place.)
      **This turns out to have been wrong!**  Instead, now that we have the
      ipld.NodeBuilder interface standard, that turns out to be much better suited
      to solving the same needs, and it can do so:
      
      - without adding tokens to the picture (simpler),
      
      - without requiring tokenization-based interfaces be implemented per
      concrete ipld.Node implementation (OH so much simpler),
      
      - and arguably NodeBuilder is even doing it *better* because it doesn't
      need to force linearization (and while usually that doesn't matter... one
      can perhaps imagine it coming up if we wanted to do a data transcription
      in memory into a Node implementation which has an orderings requirement).
      
      So yeah, this is a nice thing to have been wrong about.  Much simpler now.
      
      Old ipldfree.Node-specialized 'PushTokens' is still around.  Not for long,
      though; it just hasn't finished being ported to the new properly generalized
      style quite yet.
      
      Note, this is not the *whole* story, still, either.  For example, still
      expect to have an ipldcbor.Node which someday has a *significantly* different
      set of marshal and unmarshal methods -- it may eschew refmt entirely,
      and take the (very) different strategy of building a skiplist over raw
      byte slices! -- that will exist *in addition* to the generic implementations
      we're doing here and now.  More on that soon.
      
      Yeah.  A lot of interfaces to get lined up, here.  Some of them tug in such
      different directions that picking the right ones to make it all possible
      seems roughly like solving one of the NP-hard satisfiability problems.
      (Good thing it's actually with a small enough number of choices that it's
      tractable; on the other hand, enumerating those choices isn't fast, and
      the 'verifier' function here ain't fast either, and being a "design" thing,
      it can only be evaluated on human wetware.  So yeah, an NP problem on a
      tractable domain but slow setup and slow verifier.  Sounds about right.)
      
      (uh, I'm going to write a book "Design: It's Hard: The Novel" after this.)
      
      Tests are patched enough to keep working where they are; I think it's
      possible that a reshuffle of some of them to be more closely focused on
      the marshal code rather than the node implementation packages might be
      in order, but I'm going to let that be a future issue.  (Oh, and they
      did shine a light on one quick issue about MapBuilder initialization,
      which is also now fixed.)
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      be01e1e5