Homec4science

Add an assocations-like "Edges" framework

Authored by epriestley <git@epriestley.com> on Apr 5 2012, 00:30.

Description

Add an assocations-like "Edges" framework

Summary:
We have a lot of cases where we store object relationships, but it's all kind of messy and custom. Some particular problems:

  • We go to great lengths to enforce order stability in Differential revisions, but the implementation is complex and inelegant.
  • Some relationships are stored on-object, so we can't pull the inverses easily. For example, Maniphest shows child tasks but not parent tasks.
  • I want to add more of these and don't want to continue building custom stuff.
  • UIs like the "attach stuff to other stuff" UI need custom branches for each object type.
  • Stuff like "allow commits to close tasks" is notrivial because of nonstandard metadata storage.

Provide an association-like "edge" framework to fix these problems. This is nearly identical to associations, with a few differences:

  • I put edge metadata in a separate table and don't load it by default, to keep edge rows small and allow large metadata if necessary. The on-edge metadata seemed to get abused a lot at Facebook.
  • I put a 'seq' column on the edges to ensure they have an explicit, stable ordering within a source and type.

This isn't actually used anywhere yet, but my first target is attaching commits to tasks for T904.

Test Plan: Made a mock page that used Editor and Query. Verified adding and removing edges, overwriting edges, writing and loading edge data, sequence number generation.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, 20after4

Differential Revision: https://secure.phabricator.com/D2088

Details

Committed
epriestley <git@epriestley.com>Apr 5 2012, 00:30
Pushed
aubortJan 31 2017, 17:16
Parents
rPHbc61f36bebe1: Replace `elseif` by `else if`
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH877cb136e856: Add an assocations-like "Edges" framework (authored by epriestley <git@epriestley.com>).Apr 5 2012, 00:30