********************
classes
********************
btscmd md => PlatformLoader
PlatformLoader:
* Loads the platform specific dll
* Calls ->start_marketdata() with a full vector<security_info>
SharedList<T> / SharedListWriter
* Shared memory list object which spans across shared memory segments as necessary
* O(N) walk
* atomic add()
* Single adder / multiple readers
* no delete
* Custom header
SecurityIDRecorder
* add_security(security, lambda callback) -> int returns security id instantly
* security_persisted callback when security id is safely persisted
SecurityIndex
* Platform Implementation helper
* Maps exhange_id to (ProducerHandle + Data)
*
CacheEntry / CacheEntryDepth (CacheStructure.h)
* CacheEntry(symbol, depth, # legs) -- size determined in constructor
* Simple inheritance tree for optional depth
* Has FixedSecurity
* Fits in SharedList<T>
* CRITICAL fields are at the front cache aligned. bbo/depth. Security goes at the end
* size, is_public(), is_persisted, is_resolved (spread)
* statistics like bbo/trade counters
* is_status_ok
* bbo, depth, trade, status, open, close
FixedSecurity / FixsdSpreadSecurity
* Normalized version of our protobuf security
* Has methods to convert to pb Security
* Size known at construction w/ # legs - spread legs of type security_key
* Can use a union for option/future fields
MDProducer(symbol, type)
* manages lifetime of SharedList instances
* Hands out MDProducerHandle - entry for one security
MDProducerHandle
* pointers to shared memory
* update methods
MDConsumer
* list of securities
* find_security_id(symbol, type, etc)
* get_cache_handle(security id#)
* Hands out MDCacheHandle
- if security is null add MDCacheHandle to a list to be updated
next time securities are polled
MDCacheHandle
* If security is not present add this is "null"
* has pointers to relevant shared memory
********************
* Cache Structure
********************
2 Shared memory segment for each (SYMBOL, TYPE) - md_hot (bbo,depth,status), md_cold (others)
When a new security is discovered
1. id is allocated to the security
2. New CacheEntry is allocated in appropriate arena (is_public=false)
3. md_cache entry count is incremented
4. When id is persisted is_public=true, increment version on cache arena