Chromium Code Reviews| 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 "io" | |
|
iannucci
2016/01/13 19:12:20
always use
import (
"io"
)
style. It's easier
nishanths (utexas)
2016/01/14 21:12:56
Done.
| |
| 8 | |
| 7 // TestingSnapshot is an opaque implementation-defined snapshot type. | 9 // TestingSnapshot is an opaque implementation-defined snapshot type. |
| 8 type TestingSnapshot interface { | 10 type TestingSnapshot interface { |
| 9 ImATestingSnapshot() | 11 ImATestingSnapshot() |
| 10 } | 12 } |
| 11 | 13 |
| 12 // Testable is the testable interface for fake datastore implementations. | 14 // Testable is the testable interface for fake datastore implementations. |
| 13 type Testable interface { | 15 type Testable interface { |
| 14 // AddIndex adds the provided index. | 16 // AddIndex adds the provided index. |
| 15 // Blocks all datastore access while the index is built. | 17 // Blocks all datastore access while the index is built. |
| 16 // Panics if any of the IndexDefinition objects are not Compound() | 18 // Panics if any of the IndexDefinition objects are not Compound() |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 // - AllocateIDs returns an error. | 68 // - AllocateIDs returns an error. |
| 67 // - Put'ing incomplete Keys returns an error. | 69 // - Put'ing incomplete Keys returns an error. |
| 68 // - Transactions are disabled and will return an error. | 70 // - Transactions are disabled and will return an error. |
| 69 // | 71 // |
| 70 // This is mainly only useful when using an embedded in-memory datastore as | 72 // This is mainly only useful when using an embedded in-memory datastore as |
| 71 // a fully-consistent 'datastore-lite'. In particular, this is useful fo r the | 73 // a fully-consistent 'datastore-lite'. In particular, this is useful fo r the |
| 72 // txnBuf filter which uses it to fulfil queries in a buffered transacti on, | 74 // txnBuf filter which uses it to fulfil queries in a buffered transacti on, |
| 73 // but never wants the in-memory versions of these entities to bleed thr ough | 75 // but never wants the in-memory versions of these entities to bleed thr ough |
| 74 // to the user code. | 76 // to the user code. |
| 75 DisableSpecialEntities(bool) | 77 DisableSpecialEntities(bool) |
| 78 | |
| 79 // ParseIndexYAML parses the contents of a index YAML file into | |
| 80 // a list of datastore.IndexDefinitions. | |
| 81 // | |
| 82 // ParseIndexYAML panics if there was an error during parsing. | |
| 83 ParseIndexYAML(content io.Reader) []*IndexDefinition | |
| 84 | |
| 85 // FindAndAddIndexYAML walks up from the directory of the source file | |
| 86 // until it finds a `index.yaml` or `index.yml` file. | |
| 87 // If an index YAML file is found, it opens and parses the file, | |
| 88 // and adds all the indexes found. | |
| 89 // | |
| 90 // FindAndAddIndexYAML panics if the root of the drive is reached withou t | |
| 91 // finding an index YAML file. FindAndAddIndexYAML also panics if there is | |
| 92 // an error reading the found index YAML file. | |
| 93 FindAndAddIndexYAML() | |
|
dnj
2016/01/13 16:16:40
I don't think this capability needs to be added to
iannucci
2016/01/13 19:12:20
If anything they should be top level methods in se
nishanths (utexas)
2016/01/14 21:12:56
Done. Moved to service/datastore with the method s
| |
| 76 } | 94 } |
| OLD | NEW |