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 datastore | 5 package datastore |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "io" | 9 "io" |
10 "io/ioutil" | 10 "io/ioutil" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 if t.Kind() != reflect.Ptr { | 239 if t.Kind() != reflect.Ptr { |
240 return errors.New("not a pointer") | 240 return errors.New("not a pointer") |
241 } | 241 } |
242 if t.Elem().Kind() != reflect.Struct { | 242 if t.Elem().Kind() != reflect.Struct { |
243 return errors.New("does not point to a struct") | 243 return errors.New("does not point to a struct") |
244 } | 244 } |
245 return nil | 245 return nil |
246 } | 246 } |
247 | 247 |
248 func (d *datastoreImpl) ExistsMulti(keys []*Key) ([]bool, error) { | 248 func (d *datastoreImpl) ExistsMulti(keys []*Key) (BoolList, error) { |
249 lme := errors.NewLazyMultiError(len(keys)) | 249 lme := errors.NewLazyMultiError(len(keys)) |
250 » ret := make([]bool, len(keys)) | 250 » ret := make(BoolList, len(keys)) |
251 i := 0 | 251 i := 0 |
252 err := d.RawInterface.GetMulti(keys, nil, func(_ PropertyMap, err error)
error { | 252 err := d.RawInterface.GetMulti(keys, nil, func(_ PropertyMap, err error)
error { |
253 if err == nil { | 253 if err == nil { |
254 ret[i] = true | 254 ret[i] = true |
255 } else if err != ErrNoSuchEntity { | 255 } else if err != ErrNoSuchEntity { |
256 lme.Assign(i, err) | 256 lme.Assign(i, err) |
257 } | 257 } |
258 i++ | 258 i++ |
259 return nil | 259 return nil |
260 }) | 260 }) |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 } | 432 } |
433 } | 433 } |
434 | 434 |
435 if isRoot(currentDir) { | 435 if isRoot(currentDir) { |
436 return nil, fmt.Errorf("datastore: failed to find index
YAML file") | 436 return nil, fmt.Errorf("datastore: failed to find index
YAML file") |
437 } | 437 } |
438 | 438 |
439 currentDir = filepath.Dir(currentDir) | 439 currentDir = filepath.Dir(currentDir) |
440 } | 440 } |
441 } | 441 } |
OLD | NEW |