public bool Open() { lock (this) { if (lockCount == 0) { ++lockCount; return(blockStore.Open()); } ++lockCount; return(false); } }
public void ChangeStore(IBlockStore newStore) { lock (this) { if (lockCount > 0) { blockStore.Close(); newStore.Open(); } if (newStore is FileBlockStore) { isCompressed = false; } else if (newStore is CompressedBlockStore) { isCompressed = true; } else { throw new ApplicationException("Unknown block_store type"); } blockStore = newStore; } }