OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" | 5 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // | 39 // |
40 // Global metadata | 40 // Global metadata |
41 // --------------- | 41 // --------------- |
42 // The prefix is <0, 0, 0>, followed by a metadata type byte: | 42 // The prefix is <0, 0, 0>, followed by a metadata type byte: |
43 // | 43 // |
44 // <0, 0, 0, 0> => backing store schema version [SchemaVersionKey] | 44 // <0, 0, 0, 0> => backing store schema version [SchemaVersionKey] |
45 // <0, 0, 0, 1> => maximum allocated database [MaxDatabaseIdKey] | 45 // <0, 0, 0, 1> => maximum allocated database [MaxDatabaseIdKey] |
46 // <0, 0, 0, 2> => SerializedScriptValue version [DataVersionKey] | 46 // <0, 0, 0, 2> => SerializedScriptValue version [DataVersionKey] |
47 // <0, 0, 0, 3> | 47 // <0, 0, 0, 3> |
48 // => Blob journal | 48 // => Blob journal |
49 // The format of the journal is: | 49 // The format of the journal is: {database_id, blobKey}*. |
50 // {database_id (var int), blobKey (var int)}*. | |
51 // If the blobKey is kAllBlobsKey, the whole database should be deleted. | 50 // If the blobKey is kAllBlobsKey, the whole database should be deleted. |
52 // [BlobJournalKey] | 51 // [BlobJournalKey] |
53 // <0, 0, 0, 4> => Live blob journal; same format. [LiveBlobJournalKey] | 52 // <0, 0, 0, 4> => Live blob journal; same format. [LiveBlobJournalKey] |
54 // <0, 0, 0, 100, database id> | 53 // <0, 0, 0, 100, database id> |
55 // => Existence implies the database id is in the free list | 54 // => Existence implies the database id is in the free list |
56 // [DatabaseFreeListKey] | 55 // [DatabaseFreeListKey] |
57 // <0, 0, 0, 201, origin, database name> => Database id [DatabaseNameKey] | 56 // <0, 0, 0, 201, origin, database name> => Database id [DatabaseNameKey] |
58 // | 57 // |
59 // | 58 // |
60 // Database metadata: [DatabaseMetaDataKey] | 59 // Database metadata: [DatabaseMetaDataKey] |
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { | 2029 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { |
2031 scoped_ptr<IndexedDBKey> key; | 2030 scoped_ptr<IndexedDBKey> key; |
2032 StringPiece slice(encoded_primary_key_); | 2031 StringPiece slice(encoded_primary_key_); |
2033 if (!DecodeIDBKey(&slice, &key)) { | 2032 if (!DecodeIDBKey(&slice, &key)) { |
2034 // TODO(jsbell): Return error. | 2033 // TODO(jsbell): Return error. |
2035 } | 2034 } |
2036 return key.Pass(); | 2035 return key.Pass(); |
2037 } | 2036 } |
2038 | 2037 |
2039 } // namespace content | 2038 } // namespace content |
OLD | NEW |