core: refactor loading orders from db#566
Conversation
|
I think the advantage of this way is that there are no DB calls required when seeking detailed info on the order, such as will be needed with a solution to #559. |
|
I thought about going this route. |
chappjc
left a comment
There was a problem hiding this comment.
Retesting now, but looks good. Just a few thoughts.
| ChangeCoin order.CoinID | ||
| // LinkedOrder is used to specify the cancellation order for a trade, or | ||
| // vice-versa. | ||
| LinkedOrder order.OrderID |
There was a problem hiding this comment.
Thoughts about this being a []byte instead, which would save space in the DB and turn the zero ID checks into zero length or nil checks, but would require copying into and OrderID to retrieve the metaCancel in dbTrackers?
There was a problem hiding this comment.
How about just storing it as nil if it's zeroed?
There was a problem hiding this comment.
Sure, if that works out cleanly.
| } | ||
|
|
||
| var linkedID order.OrderID | ||
| copy(linkedID[:], getCopy(oBkt, linkedKey)) |
There was a problem hiding this comment.
Note that now that we are storing nil, this Get will return []byte{} instead of nil. That's OK since there are no bytes to copy and it stays the zero OrderID. Just wanted to point that distinction out. I think that's what you envisioned for the decode now, right?
For comparison with #564.