Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: server/logdog/storage/memory/memory.go

Issue 1872903002: LogDog: Enable keys-only BigTable queries. (Closed) Base URL: https://github.com/luci/luci-go@logdog-archive-v2
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 memory 5 package memory
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "sync" 9 "sync"
10 "time" 10 "time"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return nil 114 return nil
115 }) 115 })
116 if err != nil { 116 if err != nil {
117 return err 117 return err
118 } 118 }
119 119
120 // Punt all of the records upstream. We copy the data to prevent the 120 // Punt all of the records upstream. We copy the data to prevent the
121 // callback from accidentally mutating it. We reuse the data buffer to t ry 121 // callback from accidentally mutating it. We reuse the data buffer to t ry
122 // and catch errors when the callback retains the data. 122 // and catch errors when the callback retains the data.
123 for _, r := range recs { 123 for _, r := range recs {
124 » » dataCopy := make([]byte, len(r.data)) 124 » » var dataCopy []byte
125 » » copy(dataCopy, r.data) 125 » » if !req.KeysOnly {
126 » » » dataCopy = make([]byte, len(r.data))
127 » » » copy(dataCopy, r.data)
128 » » }
126 if !cb(r.index, dataCopy) { 129 if !cb(r.index, dataCopy) {
127 break 130 break
128 } 131 }
129 } 132 }
130 133
131 return nil 134 return nil
132 } 135 }
133 136
134 // Tail implements storage.Storage. 137 // Tail implements storage.Storage.
135 func (s *Storage) Tail(p types.StreamPath) ([]byte, types.MessageIndex, error) { 138 func (s *Storage) Tail(p types.StreamPath) ([]byte, types.MessageIndex, error) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 199 }
197 200
198 if s.streams == nil { 201 if s.streams == nil {
199 s.streams = map[types.StreamPath]*logStream{} 202 s.streams = map[types.StreamPath]*logStream{}
200 } 203 }
201 s.streams[p] = ls 204 s.streams[p] = ls
202 } 205 }
203 206
204 return ls 207 return ls
205 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698