sanpwc commented on a change in pull request #114:
URL: https://github.com/apache/ignite-3/pull/114#discussion_r627764802
##########
File path:
modules/runner/src/main/java/org/apache/ignite/internal/storage/LocalConfigurationStorage.java
##########
@@ -49,47 +70,122 @@ public LocalConfigurationStorage(VaultManager vaultMgr) {
this.vaultMgr = vaultMgr;
}
- /** Map to store values. */
- private Map<String, Serializable> map = new ConcurrentHashMap<>();
-
/** Change listeners. */
private List<ConfigurationStorageListener> listeners = new
CopyOnWriteArrayList<>();
/** Storage version. */
- private AtomicLong version = new AtomicLong(0);
+ private AtomicLong ver = new AtomicLong(0);
+
+ /** Start key in range for searching local configuration keys. */
+ private static final ByteArray locKeysStartRange =
ByteArray.fromString(LOC_PREFIX + ".");
+
+ /** End key in range for searching local configuration keys. */
+ private static final ByteArray locKeysEndRange =
ByteArray.fromString(LOC_PREFIX + (char)('.' + 1));
/** {@inheritDoc} */
@Override public synchronized Data readAll() throws StorageException {
- return new Data(new HashMap<>(map), version.get(), 0);
+ Iterator<Entry> iter =
+ vaultMgr.range(locKeysStartRange, locKeysEndRange);
+
+ HashMap<String, Serializable> data = new HashMap<>();
+
+ while (iter.hasNext()) {
+ Entry val = iter.next();
+
+ data.put(val.key().toString().replaceFirst(LOC_PREFIX + ".", ""),
Review comment:
As @ibessonov mentioned above lets use substring or similar here instead
of regexp.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]