Skip to content
Permalink
Browse files

Implement IDisposable in BaseStore

  • Loading branch information
earlbread committed Feb 10, 2020
1 parent 0b210e6 commit dd9c8211244beaf1763430d1ffcdfac7eee4f347
Showing with 10 additions and 5 deletions.
  1. +2 −0 CHANGES.md
  2. +2 −2 Libplanet.RocksDBStore/RocksDBStore.cs
  3. +4 −1 Libplanet/Store/BaseStore.cs
  4. +2 −2 Libplanet/Store/DefaultStore.cs
@@ -10,6 +10,8 @@ To be released.

### Backward-incompatible network protocol changes

- `BaseStore` class became to implement `IDisposable`. [[#785]]

### Backward-incompatible storage format changes

### Added APIs
@@ -24,7 +24,7 @@ namespace Libplanet.RocksDBStore
/// for some complex indices.
/// </summary>
/// <seealso cref="IStore"/>
public class RocksDBStore : BaseStore, IDisposable
public class RocksDBStore : BaseStore
{
private const string IndexColPrefix = "index_";

@@ -742,7 +742,7 @@ public override long CountBlocks()
return IterateBlockHashes().LongCount();
}

public void Dispose()
public override void Dispose()
{
_liteDb?.Dispose();
_rocksDb?.Dispose();
@@ -11,7 +11,7 @@

namespace Libplanet.Store
{
public abstract class BaseStore : IStore
public abstract class BaseStore : IStore, IDisposable
{
/// <inheritdoc />
public abstract IEnumerable<Guid> ListChainIds();
@@ -183,5 +183,8 @@ public virtual long CountBlocks()

/// <inheritdoc/>
public abstract void DeleteChainId(Guid chainId);

/// <inheritdoc/>
public abstract void Dispose();
}
}
@@ -25,7 +25,7 @@ namespace Libplanet.Store
/// for some complex indices.
/// </summary>
/// <seealso cref="IStore"/>
public class DefaultStore : BaseStore, IDisposable
public class DefaultStore : BaseStore
{
private const string IndexColPrefix = "index_";

@@ -852,7 +852,7 @@ public override long CountBlocks()
return IterateBlockHashes().LongCount();
}

public void Dispose()
public override void Dispose()
{
_db?.Dispose();
_memoryStream?.Dispose();

0 comments on commit dd9c821

Please sign in to comment.
You can’t perform that action at this time.