| Next revision | Previous revision |
| f1x:archtecture:attraction-proximity [2025/02/05 07:02] – created arie | f1x:archtecture:attraction-proximity [2025/02/20 21:25] (current) – arie |
|---|
| ====== Attraction/proximity ====== | ====== Attraction/proximity ====== |
| |
| To discover objects of same kind with "attraction" mechanism is used. It is based on objects providing method "attractor" that results in multidimension KV list defining "attractor hash key" (AHK). It is used by Router to lookup Matcher node using DHT-like scheme. | To discover objects of same kind "attraction/proximity" mechanism is used. It is based on special "Attraction" object providing method "get_ahk" that results in multidimension KV list defining "attractor hash key" (AHK). The key is used by Router to route the object to Matcher node using DHT-like scheme. It sits there until its TTL expires (future: when its resource limit is exhausted). |
| |
| Matcher uses method "proximity" on Attractor and other matching object to find proximity score. This and amount of "matching" objects define amount of references to objects to be sent to Attration initiator. | Published Data Objects might provide "get_ahk" method. In this case Router forwards the objects to relevant Matcher. |
| |
| Sample flow for case "Need to find babysitter tonight": | The Matcher is likely to have many Data objects with the same AHK and needs a way to rank and filter results, based on voluntary fields. |
| |
| - User creates Object of kind "Person" with mandatory Attractor fields: gender, geolocation. The Proximity fields "min age", "max age", availability hours and minimum payment per hour might also be specified. | The Matcher uses method "proximity" of Attraction object on each matching Data object to find proximity score. This and amount of "matching" objects define amount of references to objects to be sent to Attration initiator. |
| - The Object is exported and hits Router, that calculates hash Person-Gender-Geo and forwards it to Matcher node using DHT lookup. | |
| - Matcher node matches Attractor and matching objects, uses "proximity" method to create list of candidates, ordered by proximity score, to be sent back to User (via his Router node). | Sample flow for case "Need to find nearby female babysitter not younger than 13 tonight, with budget of 20 nis per hour. Minimum 4 hours": |
| - Once on User's node, method "MatchFound" is called with array of candidate objects. It might then create results popup notification or show results. | |
| | - A Parent creates Object of kind Attractor with objects filter "BabySitter" with mandatory (geolocation) and voluntary (gender, "min age", "max age", availability hours and budget per hour might) fields. \\ \\ The Attractor object has reference to object→method that is to be called on each match - likely notifications generator. The object is at work in three places: \\ - At Matcher node, that handles the AHK. The node forwards top 10 matching objects (in order of proximity) to realm of the Attractor object through its Router. \\ |
| | - At Router node, that acts on behalf of the realm - here it forwards matching objects to Realm node \\ |
| | - At Realm node itself - here the callback is called for each matching object \\ |
| | - The Attractor Object is exported and hits Router, that uses method "get_ahk" to get AHK. The object is then forwarded it to corresponding Matcher node. \\ |
| | - A girl publishes Object of kind "BabySitter" with AHK fields: gender, geolocation. Voluntary fields are age, availability hours and minimum payment per hour. \\ |
| | - The Object is exported and hits her Router, that uses "get_ahk" to find appropriate Matcher node. \\ |
| | - Matcher node sees Attractor and matching BabySitter objects, uses "proximity" method to create list of candidates, ordered by proximity score, to be sent back to the Parent's realm (via his Router node). \\ |
| | - Once on Parent's node, the "Found" callback method is called. It might get list of "Visible" candidate objects and decide what to do about them (create results popup notification or show results). |
| |
| |