forked from thrasher-corp/gocryptotrader
/
sync_manager_types.go
65 lines (57 loc) · 1.65 KB
/
sync_manager_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package engine
import (
"sync"
"time"
"github.com/thrasher-corp/gocryptotrader/config"
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
)
// syncBase stores information
type syncBase struct {
IsUsingWebsocket bool
IsUsingREST bool
IsProcessing bool
LastUpdated time.Time
HaveData bool
NumErrors int
}
// currencyPairSyncAgent stores the sync agent info
type currencyPairSyncAgent struct {
Created time.Time
Exchange string
AssetType asset.Item
Pair currency.Pair
Ticker syncBase
Orderbook syncBase
Trade syncBase
}
// Config stores the currency pair config
type Config struct {
SyncTicker bool
SyncOrderbook bool
SyncTrades bool
SyncContinuously bool
SyncTimeoutREST time.Duration
SyncTimeoutWebsocket time.Duration
NumWorkers int
Verbose bool
}
// syncManager stores the exchange currency pair syncer object
type syncManager struct {
initSyncCompleted int32
initSyncStarted int32
started int32
delimiter string
uppercase bool
initSyncStartTime time.Time
fiatDisplayCurrency currency.Code
websocketRoutineManagerEnabled bool
mux sync.Mutex
initSyncWG sync.WaitGroup
inService sync.WaitGroup
currencyPairs []currencyPairSyncAgent
tickerBatchLastRequested map[string]time.Time
remoteConfig *config.RemoteControlConfig
config Config
exchangeManager iExchangeManager
}