1. 16 Aug, 2021 1 commit
  2. 29 Jul, 2021 1 commit
  3. 12 Aug, 2019 1 commit
    • Eric Myhre's avatar
      Traversal package function renames. · 900b3d0f
      Eric Myhre authored
      No semantics change; this is a "sed refactor" in complexity.
      
      Literally:
      
      - `s/TraversalReason/VisitReason/g`
      - `s/TraversalProgress/Progress/g`
      - `s/TraversalConfig/Config/g`
      - `s/Traverse(/WalkMatching(/g`
      - `s/TraverseInformatively(/WalkAdv(/g`
      - `s/TraverseTransform/WalkTransforming/g`
      
      There's a few more internally, but the above covers all of the public
      exported interface changes.
      
      These changes generally reduce stutter
      (e.g. previously traversal.TraversalProgress was quite a gulp),
      and mostly result in shorter function names and signatures overall
      (and the signatures are particularly noticable, since VisitFuncs are
      often actually declared inline by calling code).
      
      A few docs strings also received manual touch-up.
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      900b3d0f
  4. 12 Feb, 2019 1 commit
    • Eric Myhre's avatar
      traversal as a package! Big diff; docs!, etc. · 69f89f4b
      Eric Myhre authored
      All traversal/transform/selector/path code to date got a rethink.
      
      For the longest time, I was trying to keep all the traversal code in
      the main root IPLD package, thinking/hoping that the number of relevant
      functions would be minimal enough that this would be fine.
      
      Somewhere around the time where I conceded that yes, we *do* need
      separate methods for writable and readonly paths (it's true that
      readonly is a degenerate case of writable -- but they have different
      performance characteristics!), I gave up: the number of functions in
      play is too high to heap alltogether in the root package namespace.
      
      This leads to a number of other surprising results: namely, that
      ipld.Path *isn't* -- it's actually traversal.Path!  We *don't use*
      paths anywhere else except as guidance to some forms of traversal,
      and logs and progress markers during traversal.  Huh!
      Despite being initially surprising, I now regard this as a *good*
      code smell.
      
      ipld.Traversal as an interface and ipld.Path.Traverse are dropped.
      These turned out to be the wrong level of abstraction:
      it's both missing things, and not able to return enough things.
      By the time we would fix both, it's not an abstraction anymore.
      
      Path.Traverse didn't know how to use a link loader func -- and
      that's correct; it shouldn't -- and it also didn't retain and
      return a stack of Nodes it traversed -- which again, it shouldn't,
      because in general that would be useless overkill and resource waste...
      it's just that both these things are essential in some use cases.
      So!  Cut that gordian knot.
      
      The Focus/FocusTransform/Traverse/TraverseTransform methods will now
      do all recursion work themselves, internally.  The transform family
      will keep stacks of nodes encountered along the way, to aid in the
      (presumably) coming tree re-build; the focus family won't.
      All of these methods will be able to support link loading, though
      implementation of that is still upcoming.
      
      There's a few more fields in TraversalProgress, also preparing for when
      we have automatic link loading and traversal: we'll want to be able
      to inform the user's callbacks about load edges.  (I'm not a fan of the
      term 'block' here, but running with it for the moment.)
      
      TraversalConfig is expected to grow.  Namely, to include link
      loaders... and subsequently, probably block writers, as well!  This is
      a big subject, though.  It'll probably take several commits and
      possibly more than one iteration over time to hammer out a good API.
      
      One thing that's interesting to note that neither TraversalConfig nor
      TraversalProgress will grow to contain certain things: for example,
      a map of "seen" CIDs when doing link traversal.  Why?  Well, if you've
      been mentally modelling things as a graph, this is surprising; surely
      any graph traversal needs to remember a set of already-visited nodes.
      The trick is... we're *not* doing a graph traversal -- not exactly!
      Since our visitor gets a (Node,Path) *tuple*... it would be wrong to
      memoize on anything other than the complete tuple; and the Path part
      of the tuple means we're actually doing a *tree* walk rather than
      a graph walk.  (And of course, since we're operating on DAGs,
      termination guarantees are already a non-issue.)  Tada; no "seen" set.
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      69f89f4b