Commit 12efb30
authored
feat(hermes): Implement IPFS publishing workflow (#694)
* feat: implement doc-sync channel::post API for issue #628
- Add channel::post(document_bytes) API as requested
- Integrate hermes-ipfs library for IPFS operations
- Add HTTP endpoints for testing (/api/doc-sync/*)
- Configure HTTP gateway routing
- Implement IPFS add, pin, and PubSub publish workflow
* feat: implement doc-sync channel::post API for issue #628
- Add channel::post(document_bytes) API as requested
- Integrate hermes-ipfs library for IPFS operations
- Add HTTP endpoints for testing (/api/doc-sync/*)
- Configure HTTP gateway routing
- Implement IPFS add, pin, and PubSub publish workflow
* hermes ipfs version
* fix: enable WASM compilation for doc-sync module and add host stubs
WASM compilation fixes:
- Made tokio runtime features conditional (rt-multi-thread only for non-WASM)
- Added separate WASM/native implementations using futures::executor for WASM
- Conditionally compile Runtime usage and block_on calls
Host implementation:
- Replaced panicking todo!() with warning messages and stub return values
- Added Resource stub creation for SyncChannel::new()
- Functions now print warnings but don't crash runtime
This allows the doc-sync module to compile for wasm32-wasip2 targets and
run without panicking, though full functionality requires proper host
implementation.
* Remove all cfg attributes and consolidate WASM/non-WASM code paths into single implementations using futures::executor. Simplify HTTP handlers and reduce complexity to clearly
demonstrate the 4-step workflow.
* refactor(doc-sync): simplify for demo workflow
Remove conditional compilation, OnceLock pattern, and unnecessary complexity to clearly show the 4-step IPFS PubSub workflow.
* refactor(doc-sync): use WIT bindings directly for demo
Replace async hermes-ipfs library with direct WIT function calls (file_add, file_pin, pubsub_publish). Remove conditional compilation and async dependencies to simplify the 4-step
workflow demo.
* refactor(doc-sync): use WIT bindings directly for demo
Replace async hermes-ipfs library with direct WIT function calls (file_add, file_pin, pubsub_publish). Remove conditional compilation and async dependencies to simplify the 4-step
workflow demo.
* refactor(doc-sync): integrate with PR #691 subscription flow
Replace async hermes-ipfs library with synchronous WIT bindings (file_add, file_pin, pubsub_publish, pubsub_subscribe). Add actual channel subscription in SyncChannel::new() and
document complete pub/sub flow with PR #691 infrastructure.
Changes:
- Use WIT IPFS functions directly instead of async library
- Call pubsub_subscribe() to register DocSync subscriptions
- Document how on_new_doc events are triggered by PR #691
- Remove conditional compilation and async dependencies
- Show clear 4-step workflow: add → pin → validate → publish
* docs(doc-sync): document PR #691 integration requirements
Add comprehensive comments explaining PR #691 requirement for subscription event routing. Document the complete pub/sub flow, what works now vs what needs PR #691, and how to
integrate when it merges
* fix(doc-sync): import GuestSyncChannel trait and clarify PR #691 comment
Fix compilation error and clarify that publishing to PubSub works now; PR #691 is only needed to route incoming messages to event handlers.
* update docs
* refactor(doc-sync): Focus module on publishing workflow only
Remove subscription logic and simplify documentation. Module now
demonstrates only the 4-step publishing workflow: file_add, file_pin,
pre-publish validation, and pubsub_publish.
* fmt
* refactor(doc-sync): Move post logic to host
Execute the 4-step publishing workflow (file_add, file_pin, pre-publish,
pubsub_publish) on the host side instead of in the WASM module. Reduces
boundary crossings from 6 to 2 for better performance.
* fmt
* fmt
* fix(doc-sync): Fix compilation errors
- Fix SyncChannel resource import and usage
- Update channel::post() to call host implementation correctly
* refactor(doc-sync): Replace eprintln with tracing
Use tracing macros (info/warn/error) instead of eprintln for logging
in doc-sync host implementation.
* refactor(doc-sync): Replace eprintln with tracing
Use tracing macros (info/warn/error) instead of eprintln for logging
in doc-sync host implementation.
* fmt
* refactor(doc-sync): Extract constants and improve error logging
- Add DOC_SYNC_TOPIC and DOC_SYNC_CHANNEL constants
- Add error logging to id_for() method
* refactor(doc-sync): Improve error logging and remove redundant conversions
- Log actual error details instead of discarding with
- Remove redundant .to_string() on CID response
- Add error logging for failed post operations
* fmt1 parent dee73bc commit 12efb30
File tree
12 files changed
+308
-59
lines changed- hermes
- apps/athena
- modules/doc-sync
- src
- bin/src
- ipfs
- runtime_extensions/hermes
- doc_sync
- http_gateway/config
12 files changed
+308
-59
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | | - | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | | - | |
26 | | - | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | | - | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | | - | |
36 | | - | |
37 | | - | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| 47 | + | |
42 | 48 | | |
43 | 49 | | |
44 | | - | |
45 | | - | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
47 | 75 | | |
48 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
49 | 145 | | |
50 | 146 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
| |||
109 | 108 | | |
110 | 109 | | |
111 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
| 100 | + | |
| 101 | + | |
102 | 102 | | |
103 | | - | |
104 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
0 commit comments