-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build guide: zome functions and lifecycle callbacks #512
base: main
Are you sure you want to change the base?
Conversation
…pages into feat/guide/app-structure
Converting to draft cuz I discovered a code example that got left unwritten 😬 |
Co-authored-by: ThetaSinner <[email protected]> Co-authored-by: Eric Harris-Braun <[email protected]>
…ucture-zome-functions
|
||
Here's an `init` callback that [links](/build/links-paths-and-anchors/) the [agent's ID](/build/identifiers/#agent) to the [DNA hash](/build/identifiers/#dna) as a sort of "I'm here" note. (It depends on a couple things being defined in your integrity zome; we'll show the integrity zome after this sample for completeness.) | ||
|
||
```rust |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I struggled to find a meaningful init
callback example; this is about as minimal as I can think of for the "link agent ID to well-known hash" use case.
// You don't need to tell Holochain about it with the `hdk_entry_types` macro, | ||
// because it never gets stored -- we only use it to calculate a hash. | ||
#[hdk_entry_helper] | ||
pub struct Anchor(pub Vec<u8>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to avoid paths and anchors here, to reduce complexity, but maybe they're not as complex as all that. I'll go check the API and consider it.
Two pages here, with some cleanup/extra examples on the CRUD pages now that we've described the call-zome lifecycle and relaxed chain top ordering in detail. Depends on #511 and shouldn't be merged until that one is merged.