Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / indexed_db / leveldb / leveldb_write_batch.h
blob3fbd103dd4cc0a17bb7ae06fa67243725ce8d7e8
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_WRITE_BATCH_H_
6 #define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_WRITE_BATCH_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_piece.h"
11 namespace leveldb {
12 class WriteBatch;
15 namespace content {
17 // Wrapper around leveldb::WriteBatch.
18 // This class holds a collection of updates to apply atomically to a database.
19 class LevelDBWriteBatch {
20 public:
21 static scoped_ptr<LevelDBWriteBatch> Create();
22 ~LevelDBWriteBatch();
24 void Put(const base::StringPiece& key, const base::StringPiece& value);
25 void Remove(const base::StringPiece& key); // Add remove operation to the
26 // batch.
27 void Clear();
29 private:
30 friend class LevelDBDatabase;
31 LevelDBWriteBatch();
33 scoped_ptr<leveldb::WriteBatch> write_batch_;
36 } // namespace content
38 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_WRITE_BATCH_H_