chiark / gitweb /
canon: show commod assignments
[ypp-sc-tools.main.git] / yarrg / notes
1 m.{153,155} Admiral, 3580s
2
3 using only cols 2,3 (buy)
4
5 changes in price,qty by island, commod, stall
6         295 rows out of 4281
7 changes in total qty by island, commod, price
8         540 rows out of 2106
9
10 stall "Couchablanca" adds lots of offers (100ish), lots else
11
12 ----------------------------------------
13
14 m.{151,153} Admiral, 38s
15
16 using only cols 2,3 (buy)
17
18 changes in price,qty by island, commod, stall
19         2 rows out of 4179
20
21 two stocks changed at one stall
22
23
24 m.{149,151} Admiral, 84s
25
26 no changes
27
28 ----------------------------------------
29
30 m.{020,145} Turtle, 271944s
31
32 by stall
33         391 / 1056      53 stall changes, 128 commod changes, if sorted
34 by price
35         334 / 797
36
37 ----------------------------------------
38
39 m.{117,145} Turtle, 47797s
40
41 by stall
42         130 / 1023
43 by price
44         135 / 757
45
46
47 ========================================
48
49 very few price changes, mostly qty changes
50
51
52 ====================
53
54 files
55   ARCHIVE-%{ocean}s-lock.par                    never removed
56   ARCHIVE-%{ocean}s-main.par                    updated by rename
57   ARCHIVE-%{ocean}s-auxil.par                   appended/renamed, len in main
58   ARCHIVE-%{ocean}s-log-%{isleid}s.par          appended/renamed, len in main
59   ARCHIVE-%{ocean}s-old-%{isleid}s-%4d.par.gz   created, count in main
60
61  others files is always updated before main
62  so lockfree readers should open main, then other files
63
64 format is a series of lines
65
66  all    !yarrg-archive [...]                            magic, 1st line
67
68  main   !stalls <stallslenbytes> [...]
69  main   !island <islandid> <islandloglenbytes> <islandoldfiles> \
70                 [...] "<islandname>
71  main   <commodid>= <commodname>
72
73  auxil  <stallid>=:<stallname>
74  auxil  <metadataid>=&<metadatalenbytes>\n<metadata>
75
76  log/old <metadataid>&<timestamp>               applies to following data
77  log/old [<stallid>:]<commodid>                                 delete offer
78  log/old [<stallid>:]<commodid>@<newprice>                      adjust price
79  log/old [<stallid>:]<commodid>[@<newprice>]-<qtyreduced>       adjust qty
80  log/old [<stallid>:]<commodid>[@<newprice>]+<qtyincreased>     maybe price
81  log     ^<uploadlenbytes-padded-to-4-base62-digits>
82                         applies to previous data
83                         includes 6-byte len of one ^... line
84
85 log file is a series of diffs most recent last; each diff is
86   metadataid&timestamp, zero or more commods, ^uploadlenbytes
87   the commodid
88
89  for a log file, there may be some trailing garbage
90  not referred to in main file (see "length of log file")
91
92         for a z file, the file length is definitive and the last
93          entry is always valid if the file is referred to in the main
94          file, but any z file not mentioned in the main file is
95          garbage
96
97 format for a diff
98  Each diff records a change "going backwards", ie you apply the
99  diff to a more recent state to get an earlier state; the metadata
100  corresponds to the earlier state; diffs at the physical end, ie
101  logical start, of the file, contain information without previous
102  context (ie start from empty, no offers)
103
104         diff format version                     Plain   uint8 constant 0x01
105
106         timestamp delta
107          (amount by which this timestamp
108          is later than the previous upload in this file,
109          or later than 0 if there is no previous pload in this file)
110                                                 Plain   vuint time_t
111
112         for each payload stream, ie:
113         for Meta, Stall, Commod, Price, Qty:
114             in an uncompressed diff:
115                 uncompressed data               Plain   some number of bytes
116                  the uncompressed data is in the order shown below
117             in a compressed diff:
118                 compressed length               Plain   vuint
119                 compressed data                 Plain   that number of bytes
120                  the compressed data for each stream forms a continuous
121                  compression stream within each file, starting with
122                  the last diff in the file and then running backwards
123
124         diff length (reverse pointer)           Frame   uint32
125          includes length of exactly the
126          data sections marked "Plain"
127
128 format inside the payload streams
129  uncompressed streams, literally in this order
130  compressed streams: read each substream in order, but ordering
131   between substreams with a diff is semantic but not physical
132
133         metadata excluding
134          ocean, island, timestamp               Meta    uint16 metadata length
135                                                 Meta    uint8*length metadata
136
137         for each stall
138
139                 stall name                      Stall   uint16 name length
140                                                 Stall   uint8*length name
141
142                 for each commod which has changed price
143                  including ones which have been added
144
145                         commodid                Commod  uint16 commodity id
146
147                         buy price delta         Price   uint16
148                         sell price delta        Price   uint16
149                           in case of added offers, previous price
150                           is taken to be best price from previous upload
151                           at this island, or 0 if previously no offers
152
153                 sentinel commodid               Commod  uint16 constant 0x0000
154
155                 for each commod which has changed qty
156                  including ones which have been added or removed
157
158                         commodid                Commod  uint16 commodity id
159                         buy qty delta           Qty     uint16
160                         sell qty delta          Qty     uint16
161
162                 sentinel commodid               Commod  uint16 constant 0x0000
163
164         sentinel stall name                     Stall   uint16 constant 0x0000