pos_ledger_db/change_set.rs
1// Copyright (c) The Diem Core Contributors
2// SPDX-License-Identifier: Apache-2.0
3
4// Copyright 2021 Conflux Foundation. All rights reserved.
5// Conflux is free software and distributed under GNU General Public License.
6// See http://www.gnu.org/licenses/
7
8use schemadb::SchemaBatch;
9
10/// Structure that collects changes to be made to the DB in one transaction.
11///
12/// This is required to be converted to `SealedChangeSet` before committing
13/// to the DB.
14pub(crate) struct ChangeSet {
15 /// A batch of db alternations.
16 pub batch: SchemaBatch,
17}
18
19impl ChangeSet {
20 /// Constructor.
21 pub fn new() -> Self {
22 Self {
23 batch: SchemaBatch::new(),
24 }
25 }
26}
27
28/// ChangeSet that's ready to be committed to the DB.
29///
30/// This is a wrapper type just to make sure `ChangeSet` to be committed is
31/// sealed properly.
32pub(crate) struct SealedChangeSet {
33 /// A batch of db alternations.
34 pub batch: SchemaBatch,
35}