-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Optimize balance-related queries with a cache #2383
base: master
Are you sure you want to change the base?
Changes from all commits
4a70f52
7d472fb
4296fd4
77d0f16
525e6f9
8eba5d7
c083f45
6b76c37
f246cd0
7472db7
b4d2e0f
d38fdb3
292acab
651bcc8
8342c8f
9a9f120
6aa9325
b153db4
512a8a3
adf9e2a
344ca90
f73dbed
80da09b
ad5216d
c784e44
5762665
5595985
38dd8d6
530bcaf
5604f30
562c087
82f7a16
7d0b014
1fe3bba
fe60c98
adef78e
9409d52
13b6db9
55f9025
d215844
53131a3
1e24aaa
eeea199
e77f33b
c9b7e29
076cb42
f5e2a6d
d1c6fcc
8cc0280
ca32195
f082291
f598395
8ce4550
4e84ac3
9577f30
a16ef36
80fb852
c94a484
ddf0571
9078b05
3b6b8c6
5162936
f736ecb
d880e0a
6927f03
66e26d9
a87698a
ddadd80
ccadf41
91e8abc
ab7808f
90fa259
0b39319
4d6e17a
8f3e817
895d9da
de11071
71226d4
474e207
ca6057d
4d43038
e3d898d
9848f64
dae0af5
facbd2e
9b8e491
9ea9c02
54087fc
20081fa
8b9f4e8
e819e23
de16099
4f307e3
66d5948
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ use fuel_core_types::{ | |
}; | ||
use statistic::StatisticTable; | ||
|
||
pub mod balances; | ||
pub mod blocks; | ||
pub mod coins; | ||
pub mod contracts; | ||
|
@@ -113,6 +114,10 @@ pub enum Column { | |
DaCompressionTemporalRegistryScriptCode = 21, | ||
/// See [`DaCompressionTemporalRegistryPredicateCode`](da_compression::DaCompressionTemporalRegistryPredicateCode) | ||
DaCompressionTemporalRegistryPredicateCode = 22, | ||
/// Coin balances per user and asset. | ||
CoinBalances = 23, | ||
/// Message balances per user. | ||
MessageBalances = 24, | ||
Comment on lines
+117
to
+120
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think having 2 tables for balance it is too much=D I think w can have just one table with some: enum Balance {
V1 {
coins: Amount,
messages: Amount,
}
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The suggestion would require the "asset id" to be a part of the key, even if it is technically not needed for messages. That's why I decided to structure it in two separate columns. Also, current solution would allow us to add more types of "amounts" in the future, without requiring |
||
} | ||
|
||
impl Column { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nit: Don't you think an
if let
branch is cleaner? I'm allergic to early returns :PThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinions here, but I'm quite fond of early returns, tbh :)
Maybe in such short functions they don't help much, but if you're ok, I'd prefer to leave this as is.