Skip to content

Commit

Permalink
doc: added doc
Browse files Browse the repository at this point in the history
  • Loading branch information
kfangw committed Jun 3, 2021
1 parent 102f695 commit eb41d05
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Libplanet.RocksDBStore/MonoRocksDBStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ public override TxExecution GetTxExecution(BlockHash blockHash, TxId txid)
return null;
}

/// <inheritdoc cref="BaseStore.PutTxIdBlockHashIndex(Guid, TxId, BlockHash)"/>
public override void PutTxIdBlockHashIndex(Guid chainId, TxId txId, BlockHash blockHash)
{
var cf = GetColumnFamily(_chainDb, chainId);
Expand All @@ -554,6 +555,7 @@ public override void PutTxIdBlockHashIndex(Guid chainId, TxId txId, BlockHash bl
);
}

/// <inheritdoc cref="BaseStore.GetTxIdBlockHashIndex(Guid, TxId)"/>
public override BlockHash? GetTxIdBlockHashIndex(Guid chainId, TxId txId)
{
var cf = GetColumnFamily(_chainDb, chainId);
Expand All @@ -565,6 +567,7 @@ public override void PutTxIdBlockHashIndex(Guid chainId, TxId txId, BlockHash bl
return new BlockHash(blockHashByte);
}

/// <inheritdoc cref="BaseStore.DeleteTxIdBlockHashIndex(Guid, TxId)"/>
public override void DeleteTxIdBlockHashIndex(Guid chainId, TxId txId)
{
var cf = GetColumnFamily(_chainDb, chainId);
Expand Down
3 changes: 3 additions & 0 deletions Libplanet.RocksDBStore/RocksDBStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ public override bool ContainsBlock(BlockHash blockHash)
return false;
}

/// <inheritdoc cref="BaseStore.PutTxIdBlockHashIndex(Guid, TxId, BlockHash)"/>
public override void PutTxIdBlockHashIndex(Guid chainId, TxId txId, BlockHash blockHash)
{
var cf = GetColumnFamily(_chainDb, chainId);
Expand All @@ -770,6 +771,7 @@ public override void PutTxIdBlockHashIndex(Guid chainId, TxId txId, BlockHash bl
);
}

/// <inheritdoc cref="BaseStore.GetTxIdBlockHashIndex(Guid, TxId)"/>
public override BlockHash? GetTxIdBlockHashIndex(Guid chainId, TxId txId)
{
var cf = GetColumnFamily(_chainDb, chainId);
Expand All @@ -781,6 +783,7 @@ public override void PutTxIdBlockHashIndex(Guid chainId, TxId txId, BlockHash bl
return new BlockHash(blockHashByte);
}

/// <inheritdoc cref="BaseStore.DeleteTxIdBlockHashIndex(Guid, TxId)"/>
public override void DeleteTxIdBlockHashIndex(Guid chainId, TxId txId)
{
var cf = GetColumnFamily(_chainDb, chainId);
Expand Down
3 changes: 3 additions & 0 deletions Libplanet/Store/BaseStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,17 @@ public abstract void PutBlock<T>(Block<T> block)
/// <inheritdoc cref="IStore.PutTxIdBlockHashIndex(Guid, TxId, BlockHash)"/>
public abstract void PutTxIdBlockHashIndex(Guid chainId, TxId txId, BlockHash blockHash);

/// <inheritdoc cref="IStore.HasTxIdBlockHashIndex(Guid, TxId)"/>
public bool HasTxIdBlockHashIndex(Guid chainId, TxId txId)
{
return GetTxIdBlockHashIndex(chainId, txId) != null;
}

/// <inheritdoc cref="IStore.DeleteTxIdBlockHashIndex(Guid, TxId)"/>
public abstract BlockHash? GetTxIdBlockHashIndex(
Guid chainId, TxId txId);

/// <inheritdoc cref="IStore.DeleteTxIdBlockHashIndex(Guid, TxId)"/>
public abstract void DeleteTxIdBlockHashIndex(Guid chainId, TxId txId);

/// <inheritdoc cref="IStore.SetBlockPerceivedTime(BlockHash, DateTimeOffset)"/>
Expand Down
3 changes: 3 additions & 0 deletions Libplanet/Store/DefaultStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ public override TxExecution GetTxExecution(BlockHash blockHash, TxId txid)
return null;
}

/// <inheritdoc cref="BaseStore.PutTxIdBlockHashIndex(Guid, TxId, BlockHash)"/>
public override void PutTxIdBlockHashIndex(Guid chainId, TxId txId, BlockHash blockHash)
{
var collection = TxIdBlockIndexCollection(chainId);
Expand Down Expand Up @@ -573,13 +574,15 @@ public override void PutTxIdBlockHashIndex(Guid chainId, TxId txId, BlockHash bl
}
}

/// <inheritdoc cref="BaseStore.GetTxIdBlockHashIndex(Guid, TxId)"/>
public override BlockHash? GetTxIdBlockHashIndex(Guid chainId, TxId txId)
{
var doc = TxIdBlockIndexCollection(chainId)
.FindOne(Query.EQ("TxId", new BsonValue(txId.ToByteArray())));
return doc is { } d ? d.BlockHash : (BlockHash?)null;
}

/// <inheritdoc cref="BaseStore.DeleteTxIdBlockHashIndex(Guid, TxId)"/>
public override void DeleteTxIdBlockHashIndex(Guid chainId, TxId txId)
{
TxIdBlockIndexCollection(chainId)
Expand Down
1 change: 0 additions & 1 deletion Libplanet/Store/IStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ void PutBlock<T>(Block<T> block)
TxExecution GetTxExecution(BlockHash blockHash, TxId txid);

/// <summary>
/// MARSHALL JANGJANG
/// Records a index for given pair <paramref name="txId"/> and <paramref name="blockHash"/>.
/// </summary>
/// <param name="chainId">The chain ID of the index.</param>
Expand Down

0 comments on commit eb41d05

Please sign in to comment.