Commit 168681d
feat(hermes): Add the Pre-Publish step to DocSync (#705)
* 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
* fmt
* fmt
* refactor(doc-sync): Replace stub implementations with todo!()
Replace placeholder implementations with explicit todo!() markers:
- id_for: Remove incorrect file_add call with side effects
- sync-channel::new: Remove placeholder resource ID (42)
- sync-channel::close: Remove stub return value
These are out of scope for post() implementation and should panic if
called.
* Update hermes/bin/src/ipfs/task.rs
Co-authored-by: Rafał Chabowski <rafal.chabowski@iohk.io>
* docs(doc-sync): Move crate docs to README and remove duplication
Move module documentation from lib.rs to a crate-level README.md for better visibility and remove duplicated content between crate-level and channel module docs.
* docs(doc-sync): Move crate docs to README and remove duplication
Move module documentation from lib.rs to a crate-level README.md for better visibility and remove duplicated content between crate-level and channel module docs.
* fix(doc-sync): Fix markdown linting errors in README
Split long sentences to one per line and ensure lines stay under 132 character limit.
* fix(doc-sync): Replace todo!() with placeholder implementations
Replace 5 todo!() macros in doc_sync host with minimal placeholder
implementations to pass clippy lint checks. Functions now return
empty/default values instead of panicking.
* fix(doc-sync): Resolve all clippy pedantic lints
Fixes documentation formatting, format string inlining, unnecessary value passing, wildcard imports, and missing error documentation to satisfy clippy::pedantic requirements
* Log pin result
* IPFS file add operation now also returns CID
* Fixes after the merge
* Remove the pin step
* Remove the pin step
* Cleanup
* Cleanup
* DHT provide on the host side
* Wire the `IpfsCommand::DhtProvide` command
* Add `is_pre_publish_completed()`
* Implement basic timeout
* Implement DHT get providers
* Use proper peer ID
* Update test component
* Temp switch to `main` branch in libs
* Cleanup
* Split `fn post()` into auxiliary functions
* Update `hermes-ipfs`
* Update comment
* Fix typo
* Fix typo
* Revert unnecessary comment change
* Use correct error in `dht_provide()`
* Use proper error in `IpfsCommand::DhtGetProviders()`
---------
Co-authored-by: cong-or <conchubhar.gannon@gmail.com>1 parent 2690763 commit 168681d
File tree
9 files changed
+409
-104
lines changed- hermes
- bin
- src
- ipfs
- runtime_extensions/hermes
- doc_sync
- ipfs
- wasm
- integration-test/ipfs/src
- wasi/wit/deps/hermes-ipfs
9 files changed
+409
-104
lines changedSome 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 | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
106 | 107 | | |
107 | 108 | | |
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 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
109 | 150 | | |
110 | 151 | | |
111 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
255 | 298 | | |
256 | 299 | | |
257 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
40 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
41 | 53 | | |
42 | 54 | | |
43 | 55 | | |
| 56 | + | |
44 | 57 | | |
45 | 58 | | |
46 | 59 | | |
| |||
130 | 143 | | |
131 | 144 | | |
132 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
133 | 181 | | |
134 | 182 | | |
135 | 183 | | |
| |||
0 commit comments