[#6] Multiple cache files support #7

Merged
alexvanin merged 1 commit from nzinkevich/monza:cache_remove into master 2024-08-19 14:27:57 +00:00
Member

Checks hashes of cached and remote blocks and recreates cache file if they are not equal

Checks hashes of cached and remote blocks and recreates cache file if they are not equal
nzinkevich added 1 commit 2024-08-14 09:36:14 +00:00
nzinkevich requested review from dkirillov 2024-08-14 09:37:17 +00:00
nzinkevich requested review from pogpp 2024-08-14 09:37:18 +00:00
fyrchik reviewed 2024-08-14 11:04:41 +00:00
@ -59,0 +67,4 @@
if err != nil {
return nil, err
}
_ = os.Remove(dbPath)
Owner

How about having multiple caches?
The name of the cache will be the hash.
This way there is no need in additional check, just create a file and clean the cache with an explicit command.

How about having multiple caches? The name of the cache will be the hash. This way there is no need in additional check, just create a file and clean the cache with an explicit command.
Author
Member

Yeah, it's better to do this way. Rewrote logic without removing and hash comparison

Yeah, it's better to do this way. Rewrote logic without removing and hash comparison
nzinkevich force-pushed cache_remove from 71cc5dbb84 to f33aa47969 2024-08-14 12:55:09 +00:00 Compare
nzinkevich changed title from [#6] Invalid cache removing to [#6] Multiple cache files suppport 2024-08-15 05:34:36 +00:00
fyrchik reviewed 2024-08-15 07:39:39 +00:00
@ -51,0 +51,4 @@
return nil, fmt.Errorf("error get validation block: %w", err)
}
if validationBlock == nil {
return nil, fmt.Errorf("validation block does not exist: %w", err)
Owner

This branch seems impossible to reach, because we check for the error above.

This branch seems impossible to reach, because we check for the error above.
@ -51,0 +54,4 @@
return nil, fmt.Errorf("validation block does not exist: %w", err)
}
dbPath := path.Join(dir, validationBlock.Hash().String()+".db")
Owner

It is better to use StringLE() methods explicitly, because in neo-go LE is the method of presentation and it won't change from one version to another.

It is better to use `StringLE()` methods explicitly, because in neo-go LE is the method of presentation and it won't change from one version to another.
nzinkevich force-pushed cache_remove from f33aa47969 to ce6489146f 2024-08-15 12:59:25 +00:00 Compare
fyrchik approved these changes 2024-08-15 13:53:47 +00:00
nzinkevich changed title from [#6] Multiple cache files suppport to [#6] Multiple cache files support 2024-08-15 13:58:31 +00:00
dkirillov approved these changes 2024-08-19 08:14:20 +00:00
alexvanin approved these changes 2024-08-19 14:27:31 +00:00
alexvanin merged commit ce6489146f into master 2024-08-19 14:27:57 +00:00
alexvanin deleted branch cache_remove 2024-08-19 14:27:58 +00:00
Sign in to join this conversation.
No description provided.