Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 package types | 1 package types | 
| 2 | 2 | 
| 3 import ( | 3 import ( | 
| 4 "time" | 4 "time" | 
| 5 ) | 5 ) | 
| 6 | 6 | 
| 7 import ( | 7 import ( | 
| 8 "config" | 8 "config" | 
| 9 ) | 9 ) | 
| 10 | 10 | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 | 79 | 
| 80 // NewTile returns an new Tile object ready to be filled with data via populate( ). | 80 // NewTile returns an new Tile object ready to be filled with data via populate( ). | 
| 81 func NewTile() *Tile { | 81 func NewTile() *Tile { | 
| 82 return &Tile{ | 82 return &Tile{ | 
| 83 Traces: make([]*Trace, 0), | 83 Traces: make([]*Trace, 0), | 
| 84 ParamSet: make(map[string]Choices), | 84 ParamSet: make(map[string]Choices), | 
| 85 Commits: make([]*Commit, 0), | 85 Commits: make([]*Commit, 0), | 
| 86 } | 86 } | 
| 87 } | 87 } | 
| 88 | 88 | 
| 89 type TraceGUI struct { | |
| 
 
jcgregorio
2014/07/11 19:03:56
Add doc comment on where this is used.
 
kelvinly
2014/07/11 19:42:30
Done.
 
 | |
| 90 Data [][2]float64 `json:"data_ui"` | |
| 
 
jcgregorio
2014/07/11 19:03:56
Just "data" and "key" for the json should be fine.
 
kelvinly
2014/07/11 19:42:30
Done.
 
 | |
| 91 Key string `json:"key_ui"` | |
| 
 
jcgregorio
2014/07/11 19:03:56
Run gofmt over all the code.
 
kelvinly
2014/07/11 19:42:30
Done.
 
 | |
| 92 } | |
| 93 | |
| 94 type TileGUI struct { | |
| 
 
jcgregorio
2014/07/11 19:03:56
Add doc comment on where this is used.
 
kelvinly
2014/07/11 19:42:30
Done.
 
 | |
| 95 Traces []TraceGUI `json:"traces,omitempty"` | |
| 96 ParamSet [][]string `json:"params,omitempty"` | |
| 97 Commits []*Commit `json:"commits,omitempty"` | |
| 98 NameList []string `json:"names,omitempty"` | |
| 99 Scale int `json:"scale"` | |
| 100 TileIndex int `json:"tileIndex"` | |
| 101 } | |
| 102 | |
| 103 func NewGUITile(scale int, tileIndex int) *TileGUI { | |
| 104 return &TileGUI { | |
| 105 Traces: make([]TraceGUI, 0), | |
| 106 ParamSet: make([][]string, 0), | |
| 107 Commits: make([]*Commit, 0), | |
| 108 Scale: scale, | |
| 109 TileIndex: tileIndex, | |
| 110 } | |
| 111 } | |
| 112 | |
| 89 // TileStore is an interface representing the ability to save and restore Tiles. | 113 // TileStore is an interface representing the ability to save and restore Tiles. | 
| 90 type TileStore interface { | 114 type TileStore interface { | 
| 91 Put(scale, index int, tile *Tile) error | 115 Put(scale, index int, tile *Tile) error | 
| 92 | 116 | 
| 93 // Get returns the Tile for a given scale and index. Pass in -1 for inde x to | 117 // Get returns the Tile for a given scale and index. Pass in -1 for inde x to | 
| 94 // get the last tile for a given scale. Each tile contains its tile inde x and | 118 // get the last tile for a given scale. Each tile contains its tile inde x and | 
| 95 // scale. Get returns (nil, nil) if you pass in -1 and there is no data in | 119 // scale. Get returns (nil, nil) if you pass in -1 and there is no data in | 
| 96 // the store yet. | 120 // the store yet. | 
| 97 Get(scale, index int) (*Tile, error) | 121 Get(scale, index int) (*Tile, error) | 
| 98 } | 122 } | 
| (...skipping 19 matching lines...) Expand all Loading... | |
| 118 return true | 142 return true | 
| 119 } | 143 } | 
| 120 i.day = i.day.Add(-24 * time.Hour) | 144 i.day = i.day.Add(-24 * time.Hour) | 
| 121 return i.Date() != config.BEGINNING_OF_TIME.BqTableSuffix() | 145 return i.Date() != config.BEGINNING_OF_TIME.BqTableSuffix() | 
| 122 } | 146 } | 
| 123 | 147 | 
| 124 // Date returns the day formatted as we use them on BigQuery table name suffixes . | 148 // Date returns the day formatted as we use them on BigQuery table name suffixes . | 
| 125 func (i *DateIter) Date() string { | 149 func (i *DateIter) Date() string { | 
| 126 return i.day.Format("20060102") | 150 return i.day.Format("20060102") | 
| 127 } | 151 } | 
| OLD | NEW |