@jayesol/jayeson.lib.sports 2.2.6 → 2.2.7-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,113 +1,113 @@
1
- ### Sportrelayereed
2
-
3
- #### Packaging Structure
4
- - Packages are classified into **"levels"**; **each vertical is a level. Veiwed from left to right**
5
- - Arrows define dependency. E:g A -> B means A depend on B
6
- - Any class can only depend on classes within it's package or classes from packages in previous levels
7
- - There cannot be any dependency among packages of same level
8
-
9
- #### Package-Info
10
- - `jayeson.lib.sports.protobuf` - Classes generated by protobuf
11
- - `jayeson.lib.sports.datastructure` - Core datastructure used across all classes
12
- - `jayeson.lib.sports.filter` - Abstractions around IDataFilter combined with sport's datastructure
13
- - `jayeson.lib.sports.mutable` - Provide Mutable builder's for jayeson.lib.record's datastructure
14
- - `jayeson.lib.sports.util` - Static utility functions
15
- - `jayeson.lib.sports.codec` - Definition of various message classes and logic to serialize data structure to Protibuf and vice versa
16
- - `jayeson.lib.sports.core` - Core components used across whole library
17
- - `jayeson.lib.sports.receive` - Implementation of logic to receive data from upstream
18
- - `jayeson.lib.sports.receive.memory` - Implementation of logic to receive data in memory(E:g Bot)
19
- - `jayeson.lib.sports.dispatch` - Abstractions for pushing received data downstream
20
- - `jayeson.lib.sports.dispatch.relayer` - Abstratction to push data without any post-processing
21
- - `jayeson.lib.sports.dispatch.tranrelayerorm` - Abstraction and logic to push data with post processing
22
- - `jayeson.lib.sports.dispatch.network` - Abstraction and logic to push data via network
23
- - `jayeson.lib.sports.client` - Abstrations for end under to consume data
24
- - `jayesib.lib.sports.module` - Various module bindings
25
-
26
-
27
- ```
28
-
29
-
30
- +-------------------------------------------------------------------------------+
31
- | |
32
- | +-------------+ |
33
- | | client +---------------------+ v
34
- | +-------------+ | +-----------+
35
- | +----+ | | filter +----------------+
36
- | +---------------------+ | | | +-----------+ |
37
- +--+ dispatch.tranrelayerorm +-----+ v v v
38
- +---------------------+ +-------------+ +----------+ +-----------------+
39
- +->| dispatch +---->| core +----+ +-----------+ | datastructure |
40
- +--------------------+ | +-------------+ +----------+ |---->| mutable | +-----------------+
41
- | dispatch.network +---+ | ^ ^ | +-----------+ ^
42
- +--------------------+ | | | | | |
43
- +--+ | | | +------------+
44
- +-----------------+ +------------------+ | | | +-----------+ |
45
- | | | dispatch.relayer +-------------------+ | |---->| util +-----+---+
46
- | Module | +------------------+ | | +-----------+ | | +-----------------+
47
- +-----------------+ | | | +-->| protobuf |
48
- | | | +-----------------+
49
- +-----------------+ +-------------+ | | +-----------+ |
50
- | receive.memory +----------->| receive +------------> +---->| codec +-----+
51
- +-----------------+ +-------------+ +-----------+
52
- ```
53
-
54
- #### Message Tranrelayerormation Flow
55
-
56
- Picture show how message gets tranrelayerormed when they are passed from one component to other
57
-
58
- ![Picture show how message gets tranrelayerormed when they are passed from one component to other](message-flow.png)
59
-
60
-
61
- PS: Drawn using Gliffy. Get source diagram from jayeson's gliffy account
62
-
63
- #### CI/CD guideline
64
-
65
- ##### Publish
66
-
67
- Guideline: [CI/CD guideline](https://docs.jayeson.com.sg/ops/operations/gitlab-cicd/usage#how-to-use)
68
-
69
- - Publish for non prod repo:
70
- ```
71
- publish: snapshot
72
- ```
73
-
74
- - Publish for production repo:
75
- ```
76
- publish: prod
77
- ```
78
-
79
-
80
- ##### Deployment
81
-
82
- Deploy to:
83
-
84
- - **MyTest**
85
- ```
86
- deploy: myTestUnity # For deploy to relayer of Unity in MyUnity environment
87
- or
88
- deploy: myTestVodds # For deploy to relayer of Vodds in MyVodds environment
89
-
90
- ```
91
-
92
-
93
- - **Staging** environment:
94
- ```
95
- deploy: stagUnity # For deploy to relayer of Unity in Staging Unity environment
96
- or
97
- deploy: stagVodds # For deploy to relayer of Vodds in Staging Vodds environment
98
- or
99
- deploy: stagFeed # For deploy to relayer of Vodds in Staging Feed environment
100
-
101
- ```
102
-
103
- - **Production** environment:
104
- ```
105
- deploy: prodUnity # For deploy to relayer of Unity in Production Unity environment
106
- or
107
- deploy: prodVodds # For deploy to relayer of Vodds in Production Vodds environment
108
- or
109
- deploy: prodFeed # For deploy to relayer of Vodds in Production Vodds environment
110
-
111
- ```
112
- Note: To deploy to Kubernetes (k8s), need to add the parameter k8s: 1.
113
-
1
+ ### Sportrelayereed
2
+
3
+ #### Packaging Structure
4
+ - Packages are classified into **"levels"**; **each vertical is a level. Veiwed from left to right**
5
+ - Arrows define dependency. E:g A -> B means A depend on B
6
+ - Any class can only depend on classes within it's package or classes from packages in previous levels
7
+ - There cannot be any dependency among packages of same level
8
+
9
+ #### Package-Info
10
+ - `jayeson.lib.sports.protobuf` - Classes generated by protobuf
11
+ - `jayeson.lib.sports.datastructure` - Core datastructure used across all classes
12
+ - `jayeson.lib.sports.filter` - Abstractions around IDataFilter combined with sport's datastructure
13
+ - `jayeson.lib.sports.mutable` - Provide Mutable builder's for jayeson.lib.record's datastructure
14
+ - `jayeson.lib.sports.util` - Static utility functions
15
+ - `jayeson.lib.sports.codec` - Definition of various message classes and logic to serialize data structure to Protibuf and vice versa
16
+ - `jayeson.lib.sports.core` - Core components used across whole library
17
+ - `jayeson.lib.sports.receive` - Implementation of logic to receive data from upstream
18
+ - `jayeson.lib.sports.receive.memory` - Implementation of logic to receive data in memory(E:g Bot)
19
+ - `jayeson.lib.sports.dispatch` - Abstractions for pushing received data downstream
20
+ - `jayeson.lib.sports.dispatch.relayer` - Abstratction to push data without any post-processing
21
+ - `jayeson.lib.sports.dispatch.tranrelayerorm` - Abstraction and logic to push data with post processing
22
+ - `jayeson.lib.sports.dispatch.network` - Abstraction and logic to push data via network
23
+ - `jayeson.lib.sports.client` - Abstrations for end under to consume data
24
+ - `jayesib.lib.sports.module` - Various module bindings
25
+
26
+
27
+ ```
28
+
29
+
30
+ +-------------------------------------------------------------------------------+
31
+ | |
32
+ | +-------------+ |
33
+ | | client +---------------------+ v
34
+ | +-------------+ | +-----------+
35
+ | +----+ | | filter +----------------+
36
+ | +---------------------+ | | | +-----------+ |
37
+ +--+ dispatch.tranrelayerorm +-----+ v v v
38
+ +---------------------+ +-------------+ +----------+ +-----------------+
39
+ +->| dispatch +---->| core +----+ +-----------+ | datastructure |
40
+ +--------------------+ | +-------------+ +----------+ |---->| mutable | +-----------------+
41
+ | dispatch.network +---+ | ^ ^ | +-----------+ ^
42
+ +--------------------+ | | | | | |
43
+ +--+ | | | +------------+
44
+ +-----------------+ +------------------+ | | | +-----------+ |
45
+ | | | dispatch.relayer +-------------------+ | |---->| util +-----+---+
46
+ | Module | +------------------+ | | +-----------+ | | +-----------------+
47
+ +-----------------+ | | | +-->| protobuf |
48
+ | | | +-----------------+
49
+ +-----------------+ +-------------+ | | +-----------+ |
50
+ | receive.memory +----------->| receive +------------> +---->| codec +-----+
51
+ +-----------------+ +-------------+ +-----------+
52
+ ```
53
+
54
+ #### Message Tranrelayerormation Flow
55
+
56
+ Picture show how message gets tranrelayerormed when they are passed from one component to other
57
+
58
+ ![Picture show how message gets tranrelayerormed when they are passed from one component to other](message-flow.png)
59
+
60
+
61
+ PS: Drawn using Gliffy. Get source diagram from jayeson's gliffy account
62
+
63
+ #### CI/CD guideline
64
+
65
+ ##### Publish
66
+
67
+ Guideline: [CI/CD guideline](https://docs.jayeson.com.sg/ops/operations/gitlab-cicd/usage#how-to-use)
68
+
69
+ - Publish for non prod repo:
70
+ ```
71
+ publish: snapshot
72
+ ```
73
+
74
+ - Publish for production repo:
75
+ ```
76
+ publish: prod
77
+ ```
78
+
79
+
80
+ ##### Deployment
81
+
82
+ Deploy to:
83
+
84
+ - **MyTest**
85
+ ```
86
+ deploy: myTestUnity # For deploy to relayer of Unity in MyUnity environment
87
+ or
88
+ deploy: myTestVodds # For deploy to relayer of Vodds in MyVodds environment
89
+
90
+ ```
91
+
92
+
93
+ - **Staging** environment:
94
+ ```
95
+ deploy: stagUnity # For deploy to relayer of Unity in Staging Unity environment
96
+ or
97
+ deploy: stagVodds # For deploy to relayer of Vodds in Staging Vodds environment
98
+ or
99
+ deploy: stagFeed # For deploy to relayer of Vodds in Staging Feed environment
100
+
101
+ ```
102
+
103
+ - **Production** environment:
104
+ ```
105
+ deploy: prodUnity # For deploy to relayer of Unity in Production Unity environment
106
+ or
107
+ deploy: prodVodds # For deploy to relayer of Vodds in Production Vodds environment
108
+ or
109
+ deploy: prodFeed # For deploy to relayer of Vodds in Production Vodds environment
110
+
111
+ ```
112
+ Note: To deploy to Kubernetes (k8s), need to add the parameter k8s: 1.
113
+
@@ -0,0 +1,11 @@
1
+ import { IBetMatch, BasketballMatchImpl, BasketballEventState, PartitionKey } from '@jayesol/jayeson.lib.record';
2
+ import * as proto from './protobuf_bundle';
3
+ import { ICodec, EncodeAction, CodecHelper } from './codec';
4
+ export declare class BasketballCodec implements ICodec {
5
+ private codecHelper;
6
+ constructor(codecHelper?: CodecHelper);
7
+ decodeMatch(input: proto.BaseMatch[], pool: string[], action: EncodeAction, key: PartitionKey): BasketballMatchImpl[];
8
+ decodeEvent(input: proto.BaseEvent[], pool: string[], action: EncodeAction, key: PartitionKey): IBetMatch[];
9
+ decodeRecord(input: proto.BaseRecord[], pool: string[], action: EncodeAction, key: PartitionKey): BasketballMatchImpl[];
10
+ decodeState(matchId: string, eventId: string, state: proto.BaseEventState, pool: string[], action: EncodeAction, key: PartitionKey, time?: number): BasketballEventState;
11
+ }
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.BasketballCodec = void 0;
27
+ const jayeson_lib_record_1 = require("@jayesol/jayeson.lib.record");
28
+ const proto = __importStar(require("./protobuf_bundle"));
29
+ const codec_1 = require("./codec");
30
+ class BasketballCodec {
31
+ constructor(codecHelper = new codec_1.CodecHelper()) {
32
+ this.codecHelper = codecHelper;
33
+ }
34
+ decodeMatch(input, pool, action, key) {
35
+ return input.map(match => {
36
+ let host = pool[match.participants[0]];
37
+ let guest = pool[match.participants[1]];
38
+ let id = pool[match.id];
39
+ let startTime = this.codecHelper.coerceInt64(match.startTime);
40
+ let league = pool[match.league];
41
+ let country = pool[match.country];
42
+ let gender = null;
43
+ let meta = {};
44
+ if (match.metaInfo != null) {
45
+ meta = match.metaInfo;
46
+ }
47
+ let bballMatch = match.basketballMatch;
48
+ if (bballMatch) {
49
+ switch (bballMatch.gender) {
50
+ case proto.BasketballMatch.Gender.MEN:
51
+ gender = jayeson_lib_record_1.BasketballGender.MEN;
52
+ break;
53
+ case proto.BasketballMatch.Gender.WOMEN:
54
+ gender = jayeson_lib_record_1.BasketballGender.WOMEN;
55
+ break;
56
+ }
57
+ }
58
+ meta = this.codecHelper.populatePKIntoMetaInfo(meta, key);
59
+ return new jayeson_lib_record_1.BasketballMatchImpl(host, guest, startTime, [], id, league, gender, country, meta);
60
+ });
61
+ }
62
+ decodeEvent(input, pool, action, key) {
63
+ var result = [];
64
+ let matchIdToEvents = {};
65
+ input.forEach(event => {
66
+ let id = pool[event.id];
67
+ let meta = event.metaInfo;
68
+ let eType = jayeson_lib_record_1.BasketballEventType.NONE;
69
+ switch (event.eventType.basketballEventType) {
70
+ case proto.BasketballEvent.Type.NONE:
71
+ eType = jayeson_lib_record_1.BasketballEventType.NONE;
72
+ break;
73
+ case proto.BasketballEvent.Type.FIRST_TO_20:
74
+ eType = jayeson_lib_record_1.BasketballEventType.FIRST_TO_20;
75
+ break;
76
+ case proto.BasketballEvent.Type.LAST_BASKET:
77
+ eType = jayeson_lib_record_1.BasketballEventType.LAST_BASKET;
78
+ break;
79
+ case proto.BasketballEvent.Type.TEAM_POINTS:
80
+ eType = jayeson_lib_record_1.BasketballEventType.TEAM_POINTS;
81
+ break;
82
+ case proto.BasketballEvent.Type.THREE_POINTERS:
83
+ eType = jayeson_lib_record_1.BasketballEventType.THREE_POINTERS;
84
+ break;
85
+ case proto.BasketballEvent.Type.HOME_POINT:
86
+ eType = jayeson_lib_record_1.BasketballEventType.HOME_POINT;
87
+ break;
88
+ case proto.BasketballEvent.Type.AWAY_POINT:
89
+ eType = jayeson_lib_record_1.BasketballEventType.AWAY_POINT;
90
+ break;
91
+ }
92
+ let mId = pool[event.matchId];
93
+ let states = [];
94
+ if (event.state != null) {
95
+ states.push(this.decodeState(mId, id, event.state, pool, action, key));
96
+ }
97
+ let ev = new jayeson_lib_record_1.BasketballEventImpl(id, [], states, mId, eType, meta);
98
+ if (matchIdToEvents[mId] === undefined) {
99
+ matchIdToEvents[mId] = [];
100
+ }
101
+ matchIdToEvents[mId].push(ev);
102
+ });
103
+ //add the matches
104
+ for (let matchId in matchIdToEvents) {
105
+ let currMatch = new jayeson_lib_record_1.BasketballMatchImpl('', '', 0, matchIdToEvents[matchId], matchId, '', jayeson_lib_record_1.BasketballGender.MEN, "", {});
106
+ result.push(currMatch);
107
+ }
108
+ return result;
109
+ }
110
+ decodeRecord(input, pool, action, key) {
111
+ let result = [];
112
+ let matchMap = {}; //map of match id to events array for that particular match
113
+ input.forEach(record => {
114
+ let id = this.codecHelper.coerceInt64(record.id);
115
+ let oddType = jayeson_lib_record_1.OddType[record.oddType.toString()];
116
+ let lbType = jayeson_lib_record_1.LBType[record.lbType.toString()];
117
+ let timeType = null;
118
+ let protoTimeType = record.timeType.basketballTimeType;
119
+ let str = proto.BasketballTimeType.SettleOn[protoTimeType.settle.toString()];
120
+ switch (str) {
121
+ case "FT":
122
+ timeType = jayeson_lib_record_1.BasketballTimeType.FT;
123
+ break;
124
+ case "H1":
125
+ timeType = jayeson_lib_record_1.BasketballTimeType.H1;
126
+ break;
127
+ case "H2":
128
+ timeType = jayeson_lib_record_1.BasketballTimeType.H2;
129
+ break;
130
+ case "Q1":
131
+ timeType = jayeson_lib_record_1.BasketballTimeType.Q1;
132
+ break;
133
+ case "Q2":
134
+ timeType = jayeson_lib_record_1.BasketballTimeType.Q2;
135
+ break;
136
+ case "Q3":
137
+ timeType = jayeson_lib_record_1.BasketballTimeType.Q3;
138
+ break;
139
+ case "Q4":
140
+ timeType = jayeson_lib_record_1.BasketballTimeType.Q4;
141
+ break;
142
+ }
143
+ let source = pool[record.source];
144
+ let oddFormat = jayeson_lib_record_1.OddFormat[record.format.toString()];
145
+ let meta = record.metaInfo;
146
+ let pivotValue = record.pivotValue;
147
+ let pivotType = jayeson_lib_record_1.PivotType[record.pivotType.toString()];
148
+ let pivotBias = jayeson_lib_record_1.PivotBias[record.pivotBias.toString()];
149
+ let bballRec = record.basketballRecord;
150
+ let isSwapped = false;
151
+ if (bballRec) {
152
+ isSwapped = bballRec.swapped;
153
+ }
154
+ let rateOver = this.codecHelper.formatRate(record.rates[0]);
155
+ let rateUnder = this.codecHelper.formatRate(record.rates[1]);
156
+ let rateEqual = this.codecHelper.formatRate(record.rates[2]);
157
+ let rateOverId = pool[record.rateIds[0]];
158
+ let rateUnderId = pool[record.rateIds[1]];
159
+ let rateEqualId = pool[record.rateIds[2]];
160
+ let eId = pool[record.eventId];
161
+ let mId = pool[record.matchId];
162
+ let rec = new jayeson_lib_record_1.BasketballRecord(mId, eId, id, oddType, lbType, timeType, source, oddFormat, meta, rateOver, rateUnder, rateEqual, pivotValue, pivotType, pivotBias, rateOverId, rateUnderId, rateEqualId, isSwapped);
163
+ if (matchMap[mId] === undefined) {
164
+ matchMap[mId] = {};
165
+ }
166
+ if (matchMap[mId][eId] === undefined) {
167
+ matchMap[mId][eId] = [];
168
+ }
169
+ matchMap[mId][eId].push(rec);
170
+ });
171
+ for (let mId in matchMap) {
172
+ let eventMap = matchMap[mId];
173
+ let eventArray = [];
174
+ for (let eId in eventMap) {
175
+ let ev = new jayeson_lib_record_1.BasketballEventImpl(eId, eventMap[eId], [], mId, jayeson_lib_record_1.BasketballEventType.NONE, {});
176
+ eventArray.push(ev);
177
+ }
178
+ let match = new jayeson_lib_record_1.BasketballMatchImpl('', '', 0, eventArray, mId, '', jayeson_lib_record_1.BasketballGender.MEN, "", {});
179
+ result.push(match);
180
+ }
181
+ return result;
182
+ }
183
+ decodeState(matchId, eventId, state, pool, action, key, time = Date.now()) {
184
+ let duration = state.duration;
185
+ let bballState = state.basketballEventState;
186
+ let seg = jayeson_lib_record_1.BasketballSegment[state.basketballEventState.segment.toString()];
187
+ let timeout = bballState.timeout;
188
+ var hostStat = state.participantStats[0].scores;
189
+ var guestStat = state.participantStats[1].scores;
190
+ if (hostStat.length < 7) {
191
+ var hostLength = hostStat.length;
192
+ for (var i = 0; hostLength + i < 7; i++) {
193
+ hostStat.push(-1);
194
+ }
195
+ }
196
+ if (guestStat.length < 7) {
197
+ var guestLength = guestStat.length;
198
+ for (var i = 0; guestLength + i < 7; i++) {
199
+ guestStat.push(-1);
200
+ }
201
+ }
202
+ let p1Stat = new jayeson_lib_record_1.BasketballStats(hostStat[0], hostStat[1], hostStat[2], hostStat[3], hostStat[4], hostStat[5], hostStat[6]);
203
+ let p2Stat = new jayeson_lib_record_1.BasketballStats(guestStat[0], guestStat[1], guestStat[2], guestStat[3], guestStat[4], guestStat[5], guestStat[6]);
204
+ let bookPriority = bballState.bookPriority;
205
+ let s = new jayeson_lib_record_1.BasketballEventState(p1Stat, p2Stat, duration, key, matchId, eventId, time, seg, timeout, bookPriority);
206
+ return s;
207
+ }
208
+ }
209
+ exports.BasketballCodec = BasketballCodec;
@@ -0,0 +1,202 @@
1
+ import { IBetEvent, IBetMatch, IBetRecord, IBetEventState, ISnapshot, PartitionKey } from '@jayesol/jayeson.lib.record';
2
+ import { IEndPointDispatcher, IEndPointGroupManager } from './dispatch';
3
+ import { FSRepo } from './core';
4
+ import { IMessageClass, Subscriber, EPEvent } from '@jayesol/jayeson.lib.delivery';
5
+ import * as T from 'ts-promise';
6
+ import { IndexedSnapshot, DeltaOutgoing, Outgoing, IndexedSnapshotImpl } from "./data_structure";
7
+ import { InEndPointEventHandler, SportsFeedInProcessor } from "./receive";
8
+ import { SportsFeedMessageGroup } from "./message_class";
9
+ import 'reflect-metadata';
10
+ import { RuleCombination } from '@jayesol/jayeson.model';
11
+ export declare class InsertMatch<M extends IBetMatch> {
12
+ private _after;
13
+ private _get;
14
+ constructor(_after: ISnapshot<IBetMatch>, _get: M[]);
15
+ after(): ISnapshot<IBetMatch>;
16
+ get(): M[];
17
+ }
18
+ export declare class UpdateMatch<M extends IBetMatch> {
19
+ private _after;
20
+ private _get;
21
+ constructor(_after: ISnapshot<IBetMatch>, _get: M[]);
22
+ after(): ISnapshot<IBetMatch>;
23
+ get(): M[];
24
+ }
25
+ export declare class DeleteMatch<M extends IBetMatch> {
26
+ private _after;
27
+ private _get;
28
+ constructor(_after: ISnapshot<IBetMatch>, _get: M[]);
29
+ after(): ISnapshot<IBetMatch>;
30
+ get(): M[];
31
+ }
32
+ export declare class InsertEvent<E extends IBetEvent> {
33
+ private _after;
34
+ private _get;
35
+ constructor(_after: ISnapshot<IBetMatch>, _get: E[]);
36
+ after(): ISnapshot<IBetMatch>;
37
+ get(): E[];
38
+ }
39
+ export declare class UpdateEvent<E extends IBetEvent> {
40
+ private _after;
41
+ private _get;
42
+ constructor(_after: ISnapshot<IBetMatch>, _get: E[]);
43
+ after(): ISnapshot<IBetMatch>;
44
+ get(): E[];
45
+ }
46
+ export declare class DeleteEvent<E extends IBetEvent> {
47
+ private _after;
48
+ private _get;
49
+ constructor(_after: ISnapshot<IBetMatch>, _get: E[]);
50
+ after(): ISnapshot<IBetMatch>;
51
+ get(): E[];
52
+ }
53
+ export declare class InsertOdd<R extends IBetRecord> {
54
+ private _after;
55
+ private _get;
56
+ constructor(_after: ISnapshot<IBetMatch>, _get: R[]);
57
+ after(): ISnapshot<IBetMatch>;
58
+ get(): R[];
59
+ }
60
+ export declare class UpdateOdd<R extends IBetRecord> {
61
+ private _after;
62
+ private _get;
63
+ constructor(_after: ISnapshot<IBetMatch>, _get: R[]);
64
+ after(): ISnapshot<IBetMatch>;
65
+ get(): R[];
66
+ }
67
+ export declare class DeleteOdd<R extends IBetRecord> {
68
+ private _after;
69
+ private _get;
70
+ constructor(_after: ISnapshot<IBetMatch>, _get: R[]);
71
+ after(): ISnapshot<IBetMatch>;
72
+ get(): R[];
73
+ }
74
+ export declare class Reset {
75
+ private _after;
76
+ private _get;
77
+ constructor(_after: ISnapshot<IBetMatch>, _get: PartitionKey[]);
78
+ after(): ISnapshot<IBetMatch>;
79
+ get(): PartitionKey[];
80
+ }
81
+ export interface DeltaEventHandler<M extends IBetMatch, E extends IBetEvent, R extends IBetRecord> {
82
+ onInsertMatch(insertMatch: InsertMatch<M>): void;
83
+ onUpdateMatch(updateMatch: UpdateMatch<M>): void;
84
+ onDeleteMatch(deleteMatch: DeleteMatch<M>): void;
85
+ onInsertEvent(insertEvent: InsertEvent<E>): void;
86
+ onUpdateEvent(updateEvent: UpdateEvent<E>): void;
87
+ onDeleteEvent(deleteEvent: DeleteEvent<E>): void;
88
+ onInsertOdd(insertOdd: InsertOdd<R>): void;
89
+ onUpdateOdd(updateOdd: UpdateOdd<R>): void;
90
+ onDeleteOdd(deleteOdd: DeleteOdd<R>): void;
91
+ onReset(resetKeys: Reset): void;
92
+ onSwitchFilterStart(requestId?: number): void;
93
+ onSwitchFilterEnd(): void;
94
+ onFullSnapshotStart(): void;
95
+ onFullSnapshotEnd(): void;
96
+ onSwitchFilterFail(requestId?: number): void;
97
+ }
98
+ export declare class FeedView<M extends IBetMatch> {
99
+ private _fsRepo;
100
+ private _epgm;
101
+ private _grp;
102
+ private _handlers;
103
+ constructor(manager: IEndPointGroupManager, repo: FSRepo, grp: SportsFeedMessageGroup);
104
+ fsRepo(): FSRepo;
105
+ epgm(): IEndPointGroupManager;
106
+ grp(): SportsFeedMessageGroup;
107
+ snapshot(): IndexedSnapshot;
108
+ register<E extends IBetEvent, R extends IBetRecord>(listener: DeltaEventHandler<M, E, R>): void;
109
+ unregister<E extends IBetEvent, R extends IBetRecord>(listener: DeltaEventHandler<M, E, R>): void;
110
+ private hasHandler;
111
+ private removeHandler;
112
+ handlerSize(): number;
113
+ cleanUp(): void;
114
+ }
115
+ export declare class AbstractComparableEPDispatcher implements IEndPointDispatcher {
116
+ private _stream;
117
+ id(): string;
118
+ submit(out: Outgoing): void;
119
+ onException(e: Error): void;
120
+ protected _grp: SportsFeedMessageGroup;
121
+ protected _readyToDispatch: boolean;
122
+ constructor(_stream: string, _grp: SportsFeedMessageGroup);
123
+ stream(): string;
124
+ grp(): SportsFeedMessageGroup;
125
+ isInitialized(): T.Promise<Boolean>;
126
+ readyToDispatch(): void;
127
+ isReadyToDispatch(): boolean;
128
+ }
129
+ export declare class MemoryDispatcher extends AbstractComparableEPDispatcher {
130
+ private _fsRepo;
131
+ private _handler;
132
+ static MEMORY_STREAM: string;
133
+ lastPushedSs: IndexedSnapshotImpl;
134
+ _id: string;
135
+ constructor(_fsRepo: FSRepo, _grp: SportsFeedMessageGroup, _handler: DeltaEventHandler<IBetMatch, IBetEvent, IBetRecord>);
136
+ grp(): SportsFeedMessageGroup;
137
+ handler(): DeltaEventHandler<IBetMatch, IBetEvent, IBetRecord>;
138
+ id(): string;
139
+ submit(out: Outgoing): void;
140
+ onException(e: Error): void;
141
+ handleMessage(msg: Outgoing): void;
142
+ protected pushSwitchFilterStart(requestId: number): void;
143
+ protected pushSwitchFilterEnd(): void;
144
+ protected pushFullSnapshotStart(): void;
145
+ protected pushFullSnapshotEnd(): void;
146
+ protected pushSwitchFilterFail(requestId: number): void;
147
+ protected pushInsertMatch(ds: DeltaOutgoing): void;
148
+ protected pushInsertEvent(ds: DeltaOutgoing): void;
149
+ protected pushInsertOdd(ds: DeltaOutgoing): void;
150
+ protected pushUpdateMatch(ds: DeltaOutgoing): void;
151
+ protected pushUpdateEvent(ds: DeltaOutgoing): void;
152
+ protected pushUpdateOdd(ds: DeltaOutgoing): void;
153
+ protected pushDeleteMatch(ds: DeltaOutgoing): void;
154
+ protected pushDeleteEvent(ds: DeltaOutgoing): void;
155
+ protected pushDeleteOdd(ds: DeltaOutgoing): void;
156
+ private pushReset;
157
+ protected events(matches: IBetMatch[]): IBetEvent[];
158
+ protected records(events: IBetEvent[]): IBetRecord[];
159
+ protected states(events: IBetEvent[]): IBetEventState[];
160
+ isSame(lhs: IMessageClass, rhs: IMessageClass): boolean;
161
+ isInitialized(): T.Promise<Boolean>;
162
+ }
163
+ export declare class SportsFeedClient implements DeltaEventHandler<IBetMatch, IBetEvent, IBetRecord> {
164
+ private _subscriber;
165
+ private _eventHandler;
166
+ private _viewTemplate;
167
+ private _epgm;
168
+ private _fsRepo;
169
+ private _grp;
170
+ private _views;
171
+ private filterRequestCounter;
172
+ private resolverMap;
173
+ constructor(grp: SportsFeedMessageGroup, fsRepo: FSRepo, epgm: IEndPointGroupManager, subscriber: Subscriber, eventHandler: InEndPointEventHandler, inProcessor: SportsFeedInProcessor);
174
+ subscriber(): Subscriber;
175
+ epgm(): IEndPointGroupManager;
176
+ InEndPointEventHandler(): InEndPointEventHandler;
177
+ fsRepo(): FSRepo;
178
+ grp(): SportsFeedMessageGroup;
179
+ eventHandler(): InEndPointEventHandler;
180
+ eventListener(event: EPEvent): void;
181
+ configureEventHandler(eventHandler: InEndPointEventHandler): void;
182
+ setUpStreamFilter(filterData: RuleCombination): T.Promise<Boolean>;
183
+ getSubscriber(): Subscriber;
184
+ start(): void;
185
+ view<M extends IBetMatch>(): FeedView<M>;
186
+ removeView<M extends IBetMatch>(view: FeedView<M>): void;
187
+ onSwitchFilterFail(requestId: number): void;
188
+ onSwitchFilterStart(requestId: number): void;
189
+ onInsertMatch(insertMatch: InsertMatch<IBetMatch>): void;
190
+ onUpdateMatch(updateMatch: UpdateMatch<IBetMatch>): void;
191
+ onDeleteMatch(deleteMatch: DeleteMatch<IBetMatch>): void;
192
+ onInsertEvent(insertEvent: InsertEvent<IBetEvent>): void;
193
+ onUpdateEvent(updateEvent: UpdateEvent<IBetEvent>): void;
194
+ onDeleteEvent(deleteEvent: DeleteEvent<IBetEvent>): void;
195
+ onInsertOdd(insertOdd: InsertOdd<IBetRecord>): void;
196
+ onUpdateOdd(updateOdd: UpdateOdd<IBetRecord>): void;
197
+ onDeleteOdd(deleteOdd: DeleteOdd<IBetRecord>): void;
198
+ onReset(resetKeys: Reset): void;
199
+ onSwitchFilterEnd(): void;
200
+ onFullSnapshotStart(): void;
201
+ onFullSnapshotEnd(): void;
202
+ }