refactor(sncast) Introduce accounts repository - #4549
Conversation
9aba5fd to
a84dbf7
Compare
franciszekjob
left a comment
There was a problem hiding this comment.
One remark about migration: could we model it more generically (for potential future schema migrations) instead of coupling it specifically to v1 -> latest?
b0089fd to
8899f7d
Compare
| { | ||
| "version": 2, | ||
| "accounts": { | ||
| "alpha-sepolia": { |
There was a problem hiding this comment.
What about replacing network names in V2 with just chain ids instead of strange alpha-sepolia etc.?
8899f7d to
324d245
Compare
c17b6d5 to
2b7bd6b
Compare
2b7bd6b to
6ced4c4
Compare
6ced4c4 to
131b528
Compare
0483727 to
1ebff2f
Compare
1ebff2f to
466c75b
Compare
466c75b to
139cd08
Compare
139cd08 to
f4f8f3c
Compare
456142b to
d6cb107
Compare
69a8a83 to
34a036d
Compare
c67843b to
d47015e
Compare
d47015e to
66a75c3
Compare
66a75c3 to
04c818c
Compare
ddoktorski
left a comment
There was a problem hiding this comment.
PR title seems inaccurate, it is not only refactor as it introduces account migrate command
| AccountsFile, | ||
| TemporaryAccountsFile, | ||
| Backup, | ||
| ParentDirectory, |
There was a problem hiding this comment.
Why is it a variant of FileType?
There was a problem hiding this comment.
It simplifies the construction of errors related to files. We don't need to repeat a nearly identical message for every type of file that may produce a given kind of error
| sync_parent(parent, path) | ||
| } | ||
|
|
||
| fn with_exclusive_lock<T>( |
There was a problem hiding this comment.
Can we simplify the code so this function only locks and returns File? (can be renamed to lock_exclusive)
There was a problem hiding this comment.
I think the current implementation is optimal. Returning a plain File is not possible because it needs to be unlocked after performing the operation anyway. We could wrap it with a guard with custom Drop, but it will be a more complex solution than this.
04c818c to
83b8799
Compare
83b8799 to
07b7ed9
Compare
07b7ed9 to
8dbb13b
Compare
Introduced changes
This PR introduces the
AccountRepository- a layer between the physical storage of accounts and their corresponding schema-agnostic representations which abstracts filesystem operations from code that reads/modifies the accounts.It is used later in the stack.
Checklist
CHANGELOG.md