-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
market,dex,admin,db,book,msgjson: Suspend support, clean Market stop
Refactor epochPump (into epump.go) for suspend support. Add Market.Suspend and Market.Running. When persistBook is false, in-memory and persistent books are purged. Add the PurgeBook method to Market to do this. PurgeBook calls the new OrderArchiver.FlushBook method, clears the in-memory book, and unlocks all coins. TODO: unlock just the book orders, not possible epoch orders. Run shutdown sequence is now meticulous. Use internal notifyChan with lifetime of Run, and async subscriber broadcasts via the closure goroutine inside Run. db: add OrderArchiver.FlushBook Add the FlushBook method to the pg.Archiver type. It changes all orders for a market that have status booked to status revoked, and it creates and stores the server-generated pseudocancel orders. It does this all in a single db transaction. This is similar to calling RevokeOrder individually on all booked orders. The new PurgeBook query template is added to do the bulk book-revoked status change for a market. coinlock: Add UnlockAll to CoinLocker interface. book: add Clear method to Book market: rework bookUpdateSignal -> updateAction+sigData Remove bookUpdateSignal, which combined data used for many different signals, and create updateSignal with action and data fields. Receivers will type cast data into one of several sigData types that contain only the data that is relevant to the action at hand. msgjson, market: add TradeSuspension message (*BookRouter).runBook now sends msgjson.TradeSuspension for msgjson.SuspensionRoute when the market sends a sigDataSuspend on the order feed. (*Market).Run sends this signal when cycleEpoch hits the target suspend epoch index. market,dex: SuspendMarket methods for OrderRouter and DEX mgr Add (*OrderRouter).SuspendMarket, called from the DEX manager in the new server/dex.(*DEX) SuspendMarket method. server/admin: suspend and market info routes msgjson: suspend data in config server/dex: on suspend update config resp and send TradeSuspension market: Add Status type and (*Market).Status dex: add MarketStatus and MarketStatuses methods for admin API admin: add /markets The markets route summarizes configured markets. e.g. $ dexadm markets { "btc_ltc": { "running": true, "epochlen": 6000, "activeepoch": 264872312, "startepoch": 264872312 }, "dcr_btc": { "running": true, "epochlen": 7000, "activeepoch": 227033410, "startepoch": 227033410 } } $ dexadm market/dcr_btc/suspend { "market": "dcr_btc", "finalepoch": 227033424, "supendtime": "2020-05-11T21:52:55Z" } $ dexadm markets{ "btc_ltc": { "running": true, "epochlen": 6000, "activeepoch": 264872328, "startepoch": 264872328 }, "dcr_btc": { "running": true, "epochlen": 7000, "activeepoch": 227033424, "startepoch": 227033424, "finalepoch": 227033424, "persistbook": true } } $ dexadm markets { "btc_ltc": { "running": true, "epochlen": 6000, "activeepoch": 264872329, "startepoch": 264872329 }, "dcr_btc": { "running": false, "epochlen": 7000, "activeepoch": 0, "startepoch": 0, "finalepoch": 227033424, "persistbook": true } }
- Loading branch information
Showing
26 changed files
with
2,454 additions
and
474 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.