-
Notifications
You must be signed in to change notification settings - Fork 15
LWDEV-9478 Refactor balances sub-system #262
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
base: master
Are you sure you want to change the base?
Conversation
# Conflicts: # src/main/kotlin/com/lykke/matching/engine/balance/WalletOperationsProcessor.kt # src/main/kotlin/com/lykke/matching/engine/holders/BalancesHolder.kt # src/main/kotlin/com/lykke/matching/engine/order/cancel/AbstractLimitOrdersCanceller.kt # src/main/kotlin/com/lykke/matching/engine/order/cancel/GenericLimitOrdersCanceller.kt # src/main/kotlin/com/lykke/matching/engine/order/cancel/GenericLimitOrdersCancellerFactory.kt # src/main/kotlin/com/lykke/matching/engine/order/cancel/LimitOrdersCanceller.kt # src/main/kotlin/com/lykke/matching/engine/order/cancel/StopLimitOrdersCanceller.kt # src/main/kotlin/com/lykke/matching/engine/order/transaction/ExecutionContextFactory.kt # src/main/kotlin/com/lykke/matching/engine/services/CashTransferOperationService.kt # src/main/kotlin/com/lykke/matching/engine/services/ReservedCashInOutOperationService.kt # src/test/kotlin/com/lykke/matching/engine/balance/WalletOperationsProcessorTest.kt # src/test/kotlin/com/lykke/matching/engine/config/TestApplicationContext.kt # src/test/kotlin/com/lykke/matching/engine/performance/AbstractPerformanceTest.kt
# Conflicts: # src/dist/cfg/log4j.properties # src/main/kotlin/com/lykke/matching/engine/balance/WalletOperationsProcessor.kt # src/main/kotlin/com/lykke/matching/engine/holders/BalancesHolder.kt # src/main/kotlin/com/lykke/matching/engine/services/ReservedCashInOutOperationService.kt # src/main/kotlin/com/lykke/matching/engine/utils/balance/ReservedVolumesRecalculator.kt # src/test/kotlin/com/lykke/matching/engine/config/TestApplicationContext.kt
# Conflicts: # src/main/kotlin/com/lykke/matching/engine/services/CashInOutOperationService.kt # src/main/kotlin/com/lykke/matching/engine/services/CashTransferOperationService.kt # src/test/kotlin/com/lykke/matching/engine/config/TestApplicationContext.kt # src/test/kotlin/com/lykke/matching/engine/config/TestExecutionContext.kt # src/test/kotlin/com/lykke/matching/engine/performance/AbstractPerformanceTest.kt
| messageSequenceNumber)) | ||
| } | ||
|
|
||
| fun sendNotification(id: String, type: String, messageId: String) { |
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.
I propose to move sending notification outside from WalletOperationsProcessor additionally in the frame of this task
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.
removed
| private val applicationSettingsHolder: ApplicationSettingsHolder, | ||
| private val assetsHolder: AssetsHolder, | ||
| private val balancesService: BalancesService) { | ||
| fun create(logger: Logger?, validate: Boolean = true): WalletOperationsProcessor { |
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.
unused validate
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.
removed
| class BalancesHolder(private val balancesDbAccessorsHolder: BalancesDatabaseAccessorsHolder): BalancesGetter { | ||
|
|
||
| companion object { | ||
| private val LOGGER = LoggerFactory.getLogger(BalancesHolder::class.java.name) |
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.
Now this logger is unused
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.
removed
|
|
||
| interface BalancesService { | ||
| fun insertOrUpdateWallets(wallets: Collection<Wallet>, messageSequenceNumber: Long?): Boolean | ||
| fun sendBalanceUpdate(balanceUpdate: BalanceUpdate) |
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.
I propose to split this interface: insertOrUpdateWallets is used only for services used while starting ME, sendBalanceUpdate is used for sending old format messages. There is no reason to keep them in one service.
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.
sendBalanceUpdate - moved to separate interface implemented by CashInOutOldEventSender
| open fun testBackOfficeDatabaseAccessor(): TestBackOfficeDatabaseAccessor { | ||
| val testBackOfficeDatabaseAccessor = TestBackOfficeDatabaseAccessor() | ||
| testBackOfficeDatabaseAccessor.addAsset(Asset("USD", 2)) | ||
| testBackOfficeDatabaseAccessor.addAsset(Asset("EUR", 4)) |
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.
Is it actually needed ?
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.
deduplicated code
| testOrderBookWrapper.addLimitOrder(buildLimitOrder(assetId = "EURJPY", price = 116.356, volume = 1000.0, clientId = "Client3")) | ||
| testBalanceHolderWrapper.updateBalance("Client3", "JPY", 1000.0) | ||
| testBalanceHolderWrapper.updateBalance("Client4", "EUR", 0.00999999999999999) | ||
| testBalanceHolderWrapper.updateBalance("Client4", "EUR", 0.0) |
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.
Why has the value been changed to 0.0 ?
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.
fixed
# Conflicts: # src/test/kotlin/com/lykke/matching/engine/performance/AbstractPerformanceTest.kt
# Conflicts: # src/main/kotlin/com/lykke/matching/engine/outgoing/senders/impl/specialized/CashInOutEventSender.kt # src/main/kotlin/com/lykke/matching/engine/outgoing/senders/impl/specialized/CashInOutOldEventSender.kt # src/main/kotlin/com/lykke/matching/engine/outgoing/senders/impl/specialized/CashTransferEventSender.kt # src/main/kotlin/com/lykke/matching/engine/outgoing/senders/impl/specialized/CashTransferOldEventSender.kt # src/main/kotlin/com/lykke/matching/engine/services/ReservedCashInOutOperationService.kt # src/main/kotlin/com/lykke/matching/engine/utils/balance/ReservedVolumesRecalculator.kt # src/test/kotlin/com/lykke/matching/engine/balance/WalletOperationsProcessorTest.kt # src/test/kotlin/com/lykke/matching/engine/config/TestApplicationContext.kt # src/test/kotlin/com/lykke/matching/engine/config/TestExecutionContext.kt # src/test/kotlin/com/lykke/matching/engine/services/CashInOutOperationServiceTest.kt
No description provided.