Feature: PopDb - a caching system for pop-cli #92
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.
PopDb
is a caching system to cache recently used file paths withnew
commands likepop new parachain
that are saved and used later when invoked with action commands likebuild
,test
,add
etc. without explicit path args. SincePopDb
is a generic key-value database, it maybe used for things beyond this, however this PR is just creating step 1 forPopDb
.Usage :
The preference for a file path is always in this order:
Note: This preference is not possible because step
2
is always going to execute in any cargo project (see issue #91).Currently, the preference is 1 -> 3 -> 2 until ahelper
function is created to close #91.Tasks (requires #91):
Implement PopDb cache look up in the following actions after
is_parachain(current_dir())
oris_contract(current_dir())
checks have failed.add-pallet
is merged this cannot be done )Implement PopDb set in the following actions
new parachain
new contract
new pallet
Additional notes:
Error handling for
PopDb
is invisible to the user unless aLOG_TARGET
ofDebug
or above is chosen. This is because errors involved with this system should have little to no effect on the user experience and are solely meant for developers ofpop-cli
. Fundamentally, there are two classes of errors that could happen:/tmp/pop-cli-db
The first kind of errors are unlikely to happen, as usually, users are granted read-write permissions on
/tmp
. However the second kind of errors are a bit more subtle, and they require careful consideration and invalidation in case certain criteria are not met. One instance of this is invalid UTF-8 in--path
. StoringPath
asbytes
involve lossy compression, and for invalid characters,String::from_utf8_lossy
may yield unusable values.Closes #9