Repository navigation
Support remapping cores #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+680
−51
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
b9641f7
add mappings to the checkpoint block
chm-diederichs ec11aab
add mapCore hook to remap cores on open
chm-diederichs 20775e0
test mapCore
chm-diederichs 40b5a73
document mapCore and remap
chm-diederichs 5775fd8
restart remap for a move made while remapping
chm-diederichs 55be721
resolve mappings synchronously
chm-diederichs bd90e18
move mappings onto the checkpoint metadata
chm-diederichs 0663659
open mapped cores through the session preload
chm-diederichs 084b969
load mappings statically
chm-diederichs a8bd0d9
move a tree onto the copy when its own core gets mapped
chm-diederichs ead40e2
walk past a referenced core that is not a tree
chm-diederichs 0099dd2
resolve the table of the root from its block in cores()
chm-diederichs 40cae82
share a Mappings between trees
chm-diederichs 0ee8ae2
mappings imported as array and flushed immediately
chm-diederichs f141ed6
load mappings with flushMappings, write them with a touch
chm-diederichs 711ebd6
cores checks tree node before walking
chm-diederichs a118350
pass mappings to a write, load them only from checkpoints
chm-diederichs ad0e463
remove touched flag
chm-diederichs ab7e811
only load checkpoint when metadata changed
chm-diederichs e90d698
bump invalidation pointer on remap
chm-diederichs f5ee4d8
remove isTree logic
chm-diederichs 5a16349
review by @mafintsoh
chm-diederichs 590e498
more review
chm-diederichs 7ebcbf1
remove context length change
chm-diederichs 4c1eac7
simplify and remove
chm-diederichs ad13e6d
only set mappings on write flush
chm-diederichs 342315a
add getAllContexts to simplify cores()
chm-diederichs 61bc297
Refactor core key retrieval and context update logic
mafintosh 147f99b
always set root after write flush
chm-diederichs 83a4758
simplify cores
chm-diederichs 594eb6a
lint
chm-diederichs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| const b4a = require('b4a') | ||
|
|
||
| class Mappings { | ||
| constructor() { | ||
| this.known = new Map() | ||
| this.dirty = false | ||
| this._flushed = null | ||
| } | ||
|
|
||
| resolve(key) { | ||
|
chm-diederichs marked this conversation as resolved.
|
||
| if (this.known.size === 0) return key | ||
| const known = this.known.get(b4a.toString(key, 'hex')) | ||
| return known === undefined ? key : known | ||
| } | ||
|
|
||
| add(mappings, { persisted = false } = {}) { | ||
| for (const { from, to } of mappings) { | ||
| if (b4a.equals(from, to)) continue | ||
| const hex = b4a.toString(from, 'hex') | ||
| if (this.known.has(hex)) continue | ||
| this.known.set(hex, to) | ||
| this._flushed = null | ||
| if (!persisted) this.dirty = true | ||
| } | ||
| } | ||
|
|
||
| flush() { | ||
| this.dirty = false | ||
| if (this.known.size === 0) return null | ||
|
|
||
| if (this._flushed === null) { | ||
| this._flushed = [] | ||
| for (const [hex, to] of this.known) this._flushed.push({ from: b4a.from(hex, 'hex'), to }) | ||
| } | ||
|
|
||
| return this._flushed | ||
| } | ||
| } | ||
|
|
||
| module.exports = Mappings | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.