on master help sign in
Add a small section about `transform-add-nodes`

- Ideally there would be a better more organized section about this but in practice this will be covered by real code examples that should be coming up soon

commit350ac050e86d929cd0026848b35f6b412b39b202 authorYaseen <yaseen.nvt@gmail.com> dateThu 8 Apr 2021, 10:27 (6 years ago) parent5c7be04
1 file changed+18
userspace/graph-store/advanced-info.md+18
userspace/graph-store/advanced-info.md+18
@@ -44,3 +44,21 @@ There's nothing special about the `graph-permission-add` arms; they are just con
4444As stated before, Graph Store proper (`app/graph-store.hoon`) doesn't know anything about the permissions.
4545
4646
47+
48+
49+### Push Hook Details
50+
51+As a result of the hook architecture, all hooks have the ability to transform incoming data before it is accepted and trusted as a local input.
52+Graph Push Hook is no exception. This is why the `transform-add-nodes` is required for every validator; Graph Store calls this function before adding any nodes to itself.
53+Right now, the only thing that `transform-add-nodes` is used for is to replace untrusted foreign timestamps with trusted local timestamps.
54+
55+Here is a stubbed out example of a `transform-add-nodes` to show its inputs and outputs:
56+
57+```
58+|= [=index =post =atom was-parent-modified=?]
59+^- [^index ^post]
60+!!
61+```
62+
63+The simplest transformer can simply return the exact same indexed post, which would mean that it would trust all foreign `index`es and `post`s by default.
64+The atom is always `now.bowl`, i.e. what the datetime on us, the receiving side is.