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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// CCXT-pro Cache types — Value-shaped facades.
//
// Reflects the TS classes (`ArrayCache`, `ArrayCacheByTimestamp`,
// `ArrayCacheBySymbolById`, `ArrayCacheBySymbolBySide`) into Rust as
// unit-struct factories that return `Value::Dict` "marker maps". The
// marker carries a `__cacheKind` tag, an optional `maxSize` cap, an
// ordered `_data` Vec for the rolling buffer, plus per-class
// bookkeeping fields (`_hashmap`, `_new_updates_by_symbol`, …).
//
// All append/clear/getLimit/length/indexing logic lives in
// `Value::*` methods (see `value.rs` and `runtime.rs`) — the
// transpiled tests in `rust/tests/base_ws/test.cache.rs` call those
// methods directly on the Value-typed locals the transpiler emits
// (`cache.append(...)`, `cache.get_limit(...)`, `cache.clear()`,
// `cache[i]`, `get_array_length(&cache)`).
use crateValue;
use IndexMap;
/// Cache kind tag stored at `__cacheKind` inside the marker map.
/// Drives the dispatch in `Value::append`.
pub const KIND_ARRAY_CACHE: &str = "ArrayCache";
pub const KIND_ARRAY_CACHE_BY_TIMESTAMP: &str = "ArrayCacheByTimestamp";
pub const KIND_ARRAY_CACHE_BY_SYMBOL_ID: &str = "ArrayCacheBySymbolById";
pub const KIND_ARRAY_CACHE_BY_SYMBOL_SIDE: &str = "ArrayCacheBySymbolBySide";
// Prediction-market cache: like BySymbolById but keys the outer bucket on
// `outcome` (several outcomes of one market can share an order id), so it needs
// a distinct tag or the append dispatch merges two outcomes into one row.
pub const KIND_ARRAY_CACHE_BY_OUTCOME_ID: &str = "ArrayCacheByOutcomeById";
/// Internal constructor: builds the marker `Value::Dict` with default
/// bookkeeping fields. Per-kind overrides flip specific fields after.
// ─── public factories ─────────────────────────────────────────────────────
;
;
;
;
/// Prediction-market analogue of `ArrayCacheBySymbolById`, keyed by outcome id
/// instead of symbol id. Behaviourally identical for the cache marker, so it
/// reuses the same kind.
;