Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
Last active August 29, 2015 14:26
Show Gist options
  • Save ELLIOTTCABLE/b82219b615d950af85e9 to your computer and use it in GitHub Desktop.
Save ELLIOTTCABLE/b82219b615d950af85e9 to your computer and use it in GitHub Desktop.
┌───────────────────────────────────────────────────────────────────┐
│ a Thing │
│ ▰▰▰▰▰▰▰ │
│ .custodians ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ┼─ ── ── ── ── LiabilityFamily
│ ┕ A set of *currently* responsible Executions (via Liabilities.) │
│ │ [ LiabilityFamily, ]
│ .delegators ╱supers╱ ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ┼─ ── ─[ LiabilityFamily, ... ]
│ ┕ Inverted list of any *previously*-responsible parties who put │
│ their responsibility on-offer, also via LiabilityFamilies. (The │
│ first element may be the same as the current custodian(s).) │
│ │
│ .supplicants ╱petitioners, suitors╱ ── ── ── ── ── ── ── ── ── ── ┼─[ Liability, Liability, ... ]
│ ┕ A cache of any Executions (via Liabilities) that are blocked on │
│ acquiring responsibility for this Thing │
│ │
│ │
│ .check_availability(license_type) │
│ ┕ Crawls the ownership sub-graph, checking for existing │
│ Liabilities that preclude the requested type of ρ │
│ │
│ .check_inheritance(liability) │
│ ┕ Indicates that this object was disowned, and we now need to │
│ climb the ρ-subgraph the previous-owner's Liability, to see if │
│ this object is otherwise-reachable through the owned-graph. │
│ Called recursively below the broken ownership-link. (Perhaps │
│ could be a part of check_availability?) │
│ │
│ .dedicate(liability) ╱commit, give_to╱ │
│ ┕ Actually commit this Thing to a new custodian, after │
│ check_availability has been consulted; climbing the data-graph, │
│ registering the new Liability with each owned-object │
│ │
│ .emancipate() ╱abjure, take_from╱ │
│ ┕ Commit the discarding of this Thing by its current custodian. │
│ Can either result from an actual discarding of ρ, or by a │
│ parent disowning this (after check_inheritance is preformed) │
│ │
│ .supplicate(prospective_liability) ╱register╱ │
│ ┕ Registers interest in this Thing, implying that there's an │
│ adoption operation in the exec's queue blocking on this │
│ │
│ ._signal() ╱activate╱ │
│ ┕ Internally indicates that ρ has changed (write discarded, last │
│ current read discarded, or ownership changed upstream), and │
│ that any supplicants should be flagged for execution │
│ │
│ .own() │
│ ┕ In addition to flagging a particular Relation with ownership, │
│ this must dedicate() the new child to the parent's Liability. │
│ This operation will fail if the child doesn't have a compatible │
│ (same custodian?) Liability already. │
│ │
│ .disown() │
│ ┕ When removing ownership, this will also have to emancipate() │
│ the disowned child │
└───────────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────────┐
│ a Liability │
│ ▰▰▰▰▰▰▰▰▰▰▰ │
│ A license of an `Execution`, for a `Thing`. │
│ │
│ .custodian ╱keeper, steward╱─ ── ── ── ── ── ── ── ── ── ── ── ── ┼─ ── ── ── ── ── ── Execution
│ ┕ The responsible Execution │
│ │
│ .ward ╱charge, dependant, assignment╱─ ── ── ── ── ── ── ── ── ── ┼─ ── ── ── ── ── ── ── ─ Thing
│ ┕ The object for which ρ was adopted │
│ │
│ .license ╱permission, type, flavour, latitude, scope╱ ── ── ── ── ┼─ ── ── ── ── 'read' | 'write'
│ ┕ Describes how this Liability restricts availability to *other* │
│ supplicants (i.e. read blocking write; write blocking both.) │
│ │
│ │
│ .commit() │
│ ┕ Combines Thing-side dedicate() and Exec-side ??? │
│ │
│ .relinquish() ╱abandon, discard╱ │
│ ┕ Combines Thing-side emancipate() and Exec-side ??? │
└───────────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────────┐
│ a LiabilityFamily │
│ ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰ │
│ A set of Liabilities, held simultaneously if they are 'read' │
│ │
│ .members ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ┼─ [ Liability, Liability, ... ]
│ ┕ The Liability instances. Will hold only one item, if 'write' │
│ │
│ .license ╱permission, type, flavour, latitude, scope╱ ── ── ── ── ┼─ ── ── ── ── 'read' | 'write'
│ ┕ Either 'read' or 'write' │
└───────────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────────┐
│ an Execution │
│ ▰▰▰▰▰▰▰▰▰▰▰▰ │
│.wards ╱charges, dependants, tasks╱ ── ── ── ── ── ── ── ── ── ── ─┼ ─[ Liability, Liability, ... ]
│┕ A set of each Thing for which we are currently responsible (via │
│ Liabilities.) │
│ │
│ │
│.adopt(target) │
│┕ Create a Liability, check_availability on the target, and │
│ dedicate it to this exec if available. Else, supplicate! :D │
│ │
│ │
│ │
│ │
└───────────────────────────────────────────────────────────────────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment