forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce metadata database to SharedProtoDatabase.
The metadata database is primarily for storing corruption information at the moment. Adds the creation/loading of entries from the metadata DB on shared database init, and causes the database load to fail if metadata can't be loaded, since that would be potentially dangerous. Adds an async check for corruption information during SharedProtoDatabaseClient init, and sets the corruption flag accordingly so IsCorrupt() is correct. Bug: 870813 Change-Id: Id24cd2c5c2aeed21d0e8bb108cc4126c3acb3049 Reviewed-on: https://chromium-review.googlesource.com/c/1356224 Commit-Queue: Troy Hildebrandt <thildebr@chromium.org> Reviewed-by: Tommy Nyquist <nyquist@chromium.org> Cr-Commit-Position: refs/heads/master@{#619703}
- Loading branch information
Troy Hildebrandt
authored and
Commit Bot
committed
Jan 3, 2019
1 parent
36ab751
commit 7baaeb3
Showing
11 changed files
with
506 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
syntax = "proto2"; | ||
|
||
option optimize_for = LITE_RUNTIME; | ||
|
||
package leveldb_proto; | ||
|
||
// A proto to for storing metadata related to a SharedProtoDatabase client. | ||
// | ||
// Next tag: 3 | ||
message SharedDBMetadataProto { | ||
// For the global database, this is value increases every time a corruption | ||
// is discovered, as a way for clients to determine whether there's been a | ||
// corruption since the last time they checked. | ||
// For clients, this number is set to the global value when they check their | ||
// corruption status, to indicate that we don't need to tell them there was | ||
// a corruption next time they check. | ||
optional uint64 corruptions = 1; | ||
|
||
// Timestamp for when the database was modified. | ||
optional uint64 last_modified = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "components/leveldb_proto/proto_database_wrapper.h" | ||
|
||
#include "components/leveldb_proto/proto_database_provider.h" | ||
|
||
namespace leveldb_proto { | ||
|
||
void GetSharedDBInstance( | ||
ProtoDatabaseProvider* db_provider, | ||
base::OnceCallback<void(scoped_refptr<SharedProtoDatabase>)> callback) { | ||
DCHECK(base::SequencedTaskRunnerHandle::IsSet()); | ||
db_provider->GetSharedDBInstance(std::move(callback), | ||
base::SequencedTaskRunnerHandle::Get()); | ||
} | ||
|
||
} // namespace leveldb_proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.