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 // TraceGUI is used in the JSON returned from the tile handler. | |
| 
 
jcgregorio
2014/07/11 20:36:50
// used in TileGUI.
 
kelvinly
2014/07/11 20:51:58
Done.
 
 | |
| 90 type TraceGUI struct { | |
| 91 Data [][2]float64 `json:"data"` | |
| 92 Key string `json:"key"` | |
| 93 } | |
| 94 | |
| 95 // TileGUI is the JSON the server serves for tile requests. | |
| 96 type TileGUI struct { | |
| 97 Traces []TraceGUI `json:"traces,omitempty"` | |
| 98 ParamSet [][]string `json:"params,omitempty"` | |
| 99 Commits []*Commit `json:"commits,omitempty"` | |
| 100 NameList []string `json:"names,omitempty"` | |
| 101 Scale int `json:"scale"` | |
| 102 TileIndex int `json:"tileIndex"` | |
| 103 } | |
| 104 | |
| 105 func NewGUITile(scale int, tileIndex int) *TileGUI { | |
| 106 return &TileGUI{ | |
| 107 Traces: make([]TraceGUI, 0), | |
| 108 ParamSet: make([][]string, 0), | |
| 109 Commits: make([]*Commit, 0), | |
| 110 Scale: scale, | |
| 111 TileIndex: tileIndex, | |
| 112 } | |
| 113 } | |
| 114 | |
| 89 // TileStore is an interface representing the ability to save and restore Tiles. | 115 // TileStore is an interface representing the ability to save and restore Tiles. | 
| 90 type TileStore interface { | 116 type TileStore interface { | 
| 91 Put(scale, index int, tile *Tile) error | 117 Put(scale, index int, tile *Tile) error | 
| 92 | 118 | 
| 93 // Get returns the Tile for a given scale and index. Pass in -1 for inde x to | 119 // 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 | 120 // 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 | 121 // scale. Get returns (nil, nil) if you pass in -1 and there is no data in | 
| 96 // the store yet. | 122 // the store yet. | 
| 97 Get(scale, index int) (*Tile, error) | 123 Get(scale, index int) (*Tile, error) | 
| 98 } | 124 } | 
| (...skipping 19 matching lines...) Expand all Loading... | |
| 118 return true | 144 return true | 
| 119 } | 145 } | 
| 120 i.day = i.day.Add(-24 * time.Hour) | 146 i.day = i.day.Add(-24 * time.Hour) | 
| 121 return i.Date() != config.BEGINNING_OF_TIME.BqTableSuffix() | 147 return i.Date() != config.BEGINNING_OF_TIME.BqTableSuffix() | 
| 122 } | 148 } | 
| 123 | 149 | 
| 124 // Date returns the day formatted as we use them on BigQuery table name suffixes . | 150 // Date returns the day formatted as we use them on BigQuery table name suffixes . | 
| 125 func (i *DateIter) Date() string { | 151 func (i *DateIter) Date() string { | 
| 126 return i.day.Format("20060102") | 152 return i.day.Format("20060102") | 
| 127 } | 153 } | 
| OLD | NEW |