Skip to content

Commit

Permalink
docs: add todo for missing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
doitian committed Oct 29, 2020
1 parent dc08990 commit 3728f14
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions db/src/write_batch.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
//! TODO(doc): @quake
use crate::db::cf_handle;
use crate::{internal_error, Col, Result};
use rocksdb::{OptimisticTransactionDB, WriteBatch};
use std::sync::Arc;

/// TODO(doc): @quake
pub struct RocksDBWriteBatch {
pub(crate) db: Arc<OptimisticTransactionDB>,
pub(crate) inner: WriteBatch,
}

impl RocksDBWriteBatch {
/// TODO(doc): @quake
pub fn len(&self) -> usize {
self.inner.len()
}
Expand All @@ -18,15 +21,18 @@ impl RocksDBWriteBatch {
self.inner.size_in_bytes()
}

/// TODO(doc): @quake
pub fn is_empty(&self) -> bool {
self.inner.is_empty()
}

/// TODO(doc): @quake
pub fn put(&mut self, col: Col, key: &[u8], value: &[u8]) -> Result<()> {
let cf = cf_handle(&self.db, col)?;
self.inner.put_cf(cf, key, value).map_err(internal_error)
}

/// TODO(doc): @quake
pub fn delete(&mut self, col: Col, key: &[u8]) -> Result<()> {
let cf = cf_handle(&self.db, col)?;
self.inner.delete_cf(cf, key).map_err(internal_error)
Expand All @@ -44,6 +50,7 @@ impl RocksDBWriteBatch {
.map_err(internal_error)
}

/// TODO(doc): @quake
pub fn clear(&mut self) -> Result<()> {
self.inner.clear().map_err(internal_error)
}
Expand Down
1 change: 1 addition & 0 deletions spec/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pub(crate) const DEFAULT_PRIMARY_EPOCH_REWARD_HALVING_INTERVAL: EpochNumber =
/// TODO(doc): @zhangsoledad
pub const MAX_BLOCK_BYTES: u64 = TWO_IN_TWO_OUT_BYTES * TWO_IN_TWO_OUT_COUNT;
pub(crate) const MAX_BLOCK_CYCLES: u64 = TWO_IN_TWO_OUT_CYCLES * TWO_IN_TWO_OUT_COUNT;
/// TODO(doc): @zhangsoledad
// 1.5 * TWO_IN_TWO_OUT_COUNT
pub const MAX_BLOCK_PROPOSALS_LIMIT: u64 = 1_500;
const PROPOSER_REWARD_RATIO: Ratio = Ratio(4, 10);
Expand Down
2 changes: 2 additions & 0 deletions spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ pub mod default_params {
GENESIS_EPOCH_LENGTH
}

/// TODO(doc): @zhangsoledad
pub fn max_block_proposals_limit() -> u64 {
MAX_BLOCK_PROPOSALS_LIMIT
}
Expand Down Expand Up @@ -155,6 +156,7 @@ pub struct Params {
/// TODO(doc): @zhangsoledad
#[serde(default)]
pub permanent_difficulty_in_dummy: bool,
/// TODO(doc): @zhangsoledad
#[serde(default = "default_params::max_block_proposals_limit")]
pub max_block_proposals_limit: u64,
}
Expand Down
8 changes: 8 additions & 0 deletions store/src/write_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ use ckb_db::RocksDBWriteBatch;
use ckb_error::Error;
use ckb_types::{packed, prelude::*};

/// TODO(doc): @quake
pub struct StoreWriteBatch {
pub(crate) inner: RocksDBWriteBatch,
}

impl StoreWriteBatch {
/// TODO(doc): @quake
pub fn put(&mut self, col: Col, key: &[u8], value: &[u8]) -> Result<(), Error> {
self.inner.put(col, key, value)
}

/// TODO(doc): @quake
pub fn delete(&mut self, col: Col, key: &[u8]) -> Result<(), Error> {
self.inner.delete(col, key)
}
Expand All @@ -22,18 +25,22 @@ impl StoreWriteBatch {
self.inner.size_in_bytes()
}

/// TODO(doc): @quake
pub fn len(&self) -> usize {
self.inner.len()
}

/// TODO(doc): @quake
pub fn is_empty(&self) -> bool {
self.inner.is_empty()
}

/// TODO(doc): @quake
pub fn clear(&mut self) -> Result<(), Error> {
self.inner.clear()
}

/// TODO(doc): @quake
pub fn insert_cells(
&mut self,
cells: impl Iterator<
Expand All @@ -56,6 +63,7 @@ impl StoreWriteBatch {
Ok(())
}

/// TODO(doc): @quake
pub fn delete_cells(
&mut self,
out_points: impl Iterator<Item = packed::OutPoint>,
Expand Down
2 changes: 2 additions & 0 deletions util/app-config/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ pub struct PeerIDArgs {
pub peer_id: secio::PeerId,
}

/// TODO(doc): @doitian
pub struct MigrateArgs {
/// TODO(doc): @doitian
pub config: Box<CKBAppConfig>,
}
1 change: 1 addition & 0 deletions util/app-config/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub const CMD_PEERID: &str = "peer-id";
pub const CMD_GEN_SECRET: &str = "gen";
/// TODO(doc): @doitian
pub const CMD_FROM_SECRET: &str = "from-secret";
/// TODO(doc): @doitian
pub const CMD_MIGRATE: &str = "migrate";

/// TODO(doc): @doitian
Expand Down

0 comments on commit 3728f14

Please sign in to comment.