Skip to content

Commit

Permalink
fix some todo's and typos
Browse files Browse the repository at this point in the history
Signed-off-by: garyschulte <garyschulte@gmail.com>
  • Loading branch information
garyschulte committed Jul 13, 2023
1 parent 9d9afed commit e26a189
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ KeyValueStorage create(
* key-space. Segments created with the identifier of an existing segment should have the same
* data as that existing segment.
*
* @param segments list of segments identifiers that comprise the created segmented storage
* will contain.
* @param segments list of segments identifiers that comprise the created segmented storage.
* @param configuration common configuration available to plugins, in a populated state.
* @param metricsSystem metrics component for recording key-value storage events.
* @return the storage instance reserved for the given segment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ public SegmentedKeyValueStorageTransaction startTransaction() throws StorageExce
public RocksDBColumnarKeyValueSnapshot takeSnapshot()
throws StorageException {
throwIfClosed();
return new RocksDBColumnarKeyValueSnapshot(db, metrics);
return new RocksDBColumnarKeyValueSnapshot(db, this::safeColumnHandle, metrics);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Stream;

import org.apache.commons.lang3.tuple.Pair;
import org.apache.tuweni.bytes.Bytes;
import org.rocksdb.ColumnFamilyHandle;
import org.rocksdb.OptimisticTransactionDB;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -60,9 +62,10 @@ public class RocksDBColumnarKeyValueSnapshot implements SegmentedKeyValueStorage
*/
RocksDBColumnarKeyValueSnapshot(
final OptimisticTransactionDB db,
final Function<SegmentIdentifier, ColumnFamilyHandle> columnFamilyMapper,
final RocksDBMetrics metrics) {
this.db = db;
this.snapTx = new RocksDBSnapshotTransaction(db, /*TODO get segment MAPPER*/ null, metrics);
this.snapTx = new RocksDBSnapshotTransaction(db, columnFamilyMapper, metrics);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,4 @@ public InMemoryKeyValueStorage(final Map<Bytes, Optional<byte[]>> initialMap) {
super(SEGMENT_IDENTIFIER, new SegmentedInMemoryKeyValueStorage(asSegmentMap(initialMap)));
rwLock = ((SegmentedInMemoryKeyValueStorage) storage).rwLock;
}

// private InMemoryKeyValueStorage(final SegmentedInMemoryKeyValueStorage storage) {
// super(SEGMENT_IDENTIFIER, storage);
// rwLock = storage.rwLock;
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ public class KeyValueStorageTransactionValidatorDecorator
private final Supplier<Boolean> isClosed;
private boolean active = true;

//TODO: get rid of this constructor, it is here just for unsegmented / V0 usage
public KeyValueStorageTransactionValidatorDecorator(
final KeyValueStorageTransaction toDecorate) {
this(toDecorate, () -> false);
}


/**
* Instantiates a new Key value storage transaction transition validator decorator.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public boolean tryDelete(final byte[] key) {

@Override
public KeyValueStorageTransaction startTransaction() throws StorageException {
return new KeyValueStorageTransactionValidatorDecorator(new MemoryTransaction());
return new KeyValueStorageTransactionValidatorDecorator(new MemoryTransaction(), this::isClosed);
}

@Override
Expand Down

0 comments on commit e26a189

Please sign in to comment.