| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package bigtable | 5 package bigtable |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "testing" | 9 "testing" |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if item, _ := coll.Get(enc); item != nil { | 66 if item, _ := coll.Get(enc); item != nil { |
| 67 return storage.ErrExists | 67 return storage.ErrExists |
| 68 } | 68 } |
| 69 | 69 |
| 70 if err := coll.Set(enc, d); err != nil { | 70 if err := coll.Set(enc, d); err != nil { |
| 71 panic(err) | 71 panic(err) |
| 72 } | 72 } |
| 73 return nil | 73 return nil |
| 74 } | 74 } |
| 75 | 75 |
| 76 func (t *btTableTest) getLogData(c context.Context, rk *rowKey, limit int, keysO
nly bool, cb btGetCallback) error { | 76 func (t *btTableTest) getLogData(c context.Context, rk *rowKey, limit int64, key
sOnly bool, cb btGetCallback) error { |
| 77 if t.err != nil { | 77 if t.err != nil { |
| 78 return t.err | 78 return t.err |
| 79 } | 79 } |
| 80 | 80 |
| 81 enc := []byte(rk.encode()) | 81 enc := []byte(rk.encode()) |
| 82 prefix := rk.pathPrefix() | 82 prefix := rk.pathPrefix() |
| 83 var ierr error | 83 var ierr error |
| 84 err := t.collection().VisitItemsAscend(enc, !keysOnly, func(i *gkvlite.I
tem) bool { | 84 err := t.collection().VisitItemsAscend(enc, !keysOnly, func(i *gkvlite.I
tem) bool { |
| 85 var drk *rowKey | 85 var drk *rowKey |
| 86 drk, ierr = decodeRowKey(string(i.Key)) | 86 drk, ierr = decodeRowKey(string(i.Key)) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 Project: "test-project", | 159 Project: "test-project", |
| 160 Zone: "test-zone", | 160 Zone: "test-zone", |
| 161 Cluster: "test-cluster", | 161 Cluster: "test-cluster", |
| 162 LogTable: "test-log-table", | 162 LogTable: "test-log-table", |
| 163 }, | 163 }, |
| 164 ctx: context.Background(), | 164 ctx: context.Background(), |
| 165 client: nil, | 165 client: nil, |
| 166 table: &bt, | 166 table: &bt, |
| 167 } | 167 } |
| 168 | 168 |
| 169 » » get := func(path string, index int, limit int) ([]string, error)
{ | 169 » » get := func(path string, index int, limit int64) ([]string, erro
r) { |
| 170 req := storage.GetRequest{ | 170 req := storage.GetRequest{ |
| 171 Path: types.StreamPath(path), | 171 Path: types.StreamPath(path), |
| 172 Index: types.MessageIndex(index), | 172 Index: types.MessageIndex(index), |
| 173 Limit: limit, | 173 Limit: limit, |
| 174 } | 174 } |
| 175 got := []string{} | 175 got := []string{} |
| 176 err := s.Get(&req, func(idx types.MessageIndex, d []byte
) bool { | 176 err := s.Get(&req, func(idx types.MessageIndex, d []byte
) bool { |
| 177 got = append(got, string(d)) | 177 got = append(got, string(d)) |
| 178 return true | 178 return true |
| 179 }) | 179 }) |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 Convey(`Will fail to extract if the family does not exis
t.`, func() { | 339 Convey(`Will fail to extract if the family does not exis
t.`, func() { |
| 340 So(getReadItem(fakeRow, "invalid", "invalid"), S
houldBeNil) | 340 So(getReadItem(fakeRow, "invalid", "invalid"), S
houldBeNil) |
| 341 }) | 341 }) |
| 342 | 342 |
| 343 Convey(`Will fail to extract if the column does not exis
t.`, func() { | 343 Convey(`Will fail to extract if the column does not exis
t.`, func() { |
| 344 So(getReadItem(fakeRow, "log", "invalid"), Shoul
dBeNil) | 344 So(getReadItem(fakeRow, "log", "invalid"), Shoul
dBeNil) |
| 345 }) | 345 }) |
| 346 }) | 346 }) |
| 347 }) | 347 }) |
| 348 } | 348 } |
| OLD | NEW |