This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
feat(redis): implement redis cache for arns name resolutions #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Details:
The resolver was originally implemented when we were dealing with Smartweave contracts and lazy evaluation. We needed a way to evaluate the registry contract and ANT state quickly to avoid on-the-fly evaluations that 1. could take a long time (no checkpoints in smartweave) and 2. required a large amount of disk space (e.g. warp-sqlite). As we move to AO, the need for this type of evaluation and caching of state is no longer necessary. We can now go directly to a CU to get the necessary information and cache the results.
So, with that, this PR removes the
evaluateArNSNames
on service startup, replacing with a read-through cache that supportsredis
orlmdb
caches for resolved arns data. When a name does not exist in the cache, it will go to AO to get it's resolution data (the ANT and txId to resolve to). It then caches that result for the TTL specified by the record (hence, read-through-cache).There is a world where the arns-resolver is redundant as a separate service from ar-io-node. This new implementation (particularly using redis) could easily be dropped in directly into an ar-io-node, as it now has the ability to resolve names via AO with the introduction of this PR: ar-io/ar-io-node#189
Logs