@wovin/daemon-utils
v0.1.2
Published
Utilities for building wovin daemons and servers with IPNS-backed threads.
Readme
@wovin/daemon-utils
Utilities for building wovin daemons and servers with IPNS-backed threads.
Features
- ManagedThread: Encapsulates thread operations with automatic persistence and IPNS publishing
- Incremental snapshots: Only publishes new applogs, not entire history
- Local block storage: Stores IPLD blocks for efficient chain walking
- Two-phase publishing: Atomically include referenced blobs with snapshots
Installation
pnpm add @wovin/daemon-utils @wovin/storage-fsQuick Start
import { ManagedThread } from '@wovin/daemon-utils'
import { StorageFs } from '@wovin/storage-fs'
const storage = await StorageFs.init('./data')
const thread = new ManagedThread({
thread,
ipnsName,
ipnsKey,
threadName: 'my-thread',
agent,
wovinConnector,
storage,
})
await thread.loadFromStorage()
await thread.insert([{ en, at, vl, ag }])
await thread.push()Documentation
- Storage & Publishing - Incremental snapshots, two-phase publishing with blobs
API
ManagedThread
| Method | Description |
|--------|-------------|
| insert(applogs) | Insert applogs, persist to storage |
| loadFromStorage() | Load applogs from storage on startup |
| push(first?) | Push incremental snapshot to IPNS |
| prepareSnapshot() | Prepare snapshot for inspection (two-phase) |
| publishPrepared(prepared, additionalBlocks?) | Publish with optional extra blocks |
| getLastPushedCID() | Get CID of last successful push |
Related Packages
@wovin/storage-fs- LMDB-based storage implementingBlockStoreish@wovin/core- Core wovin types and snapshot encoding@wovin/connect-ucan-store-proxy- UCAN-authenticated storage connector
