Created
June 20, 2022 14:37
-
-
Save jeremyorme/6da66b7e135502355dd61ee496c3bf2a to your computer and use it in GitHub Desktop.
DbStoreUpdater._isEntryBlockValid method
This file contains 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
_isEntryBlockValid(entryBlock: IEntryBlock|null, entryBlockList: IEntryBlockList, isLast: boolean) { | |
// check_entry_block_exists(IEntryBlock) | |
if (!entryBlock) { | |
console.log('[Db] WARNING: Update referencing missing block was ignored (address = ' + this._address + ')'); | |
return false; | |
} | |
// check_entry_block_syntax(IEntryBlock) | |
if (!validateEntryBlock(entryBlock)) { | |
console.log('[Db] WARNING: Update containing invalid block was ignore (address = ' + this._address + ')'); | |
return false; | |
} | |
// check_num_entries(IEntryBlock.entries) | |
if (!isLast && entryBlock.entries.length != this._options.entryBlockSize || | |
isLast && entryBlock.entries.length == 0) { | |
console.log('[Db] WARNING: Update containing block with invalid size was ignored (address = ' + this._address + ')'); | |
return false; | |
} | |
// success! | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment