Router information persistence and synchronization job.
This job is responsible for persisting the router's RouterInfo
to disk whenever it changes. The RouterInfo contains critical
router identity, capabilities, addresses, and statistics that
must be preserved across restarts and shared with the network.
RouterInfo Contents:
- Router identity (public keys, certificates)
- Network addresses and transport endpoints
- Router capabilities and supported versions
- Performance statistics and bandwidth limits
- Current router status and options
Persistence Process:
- Retrieves current RouterInfo from router
- Writes to router.info file in router directory
- Uses synchronized access to prevent corruption
- Employs atomic file writing for safety
- Handles errors gracefully with detailed logging
File Safety:
- Uses SecureFileOutputStream for atomic writes
- Synchronized on routerInfoFileLock for thread safety
- Prevents partial writes and corruption
- Ensures consistent state across restarts
This job is triggered automatically whenever RouterInfo is updated
due to address changes, capability changes, or periodic
refreshes. The persisted file is used for router startup
and network database publication.