[bisq-network/bisq] Reduce initial request size (#4233)

Florian Reimair notifications at github.com
Wed May 20 08:29:19 UTC 2020

@freimair commented on this pull request.

> +
+    @Override
+    protected void readFromResources(String postFix) {
+        // check Version.VERSION and see if we have latest r/o data store file in working directory
+        if (!new File(absolutePathOfStorageDir + File.separator + getFileName() + "_" + Version.VERSION).exists())
+            makeFileFromResourceFile(postFix); // if we have the latest file, we are good, else do stuff // TODO are we?
+        else {
+            // load stores/storage
+            File dbDir = new File(absolutePathOfStorageDir);
+            List<File> resourceFiles = Arrays.asList(dbDir.list((dir, name) -> name.startsWith(getFileName() + "_"))).stream().map(s -> new File(s)).collect(Collectors.toList());
+            history = new HashMap<>();
+            store = readStore(getFileName());
+            resourceFiles.forEach(file -> {
+                SplitStore tmp = readStore(file.getName().replace(postFix, ""));
+                history.put(file.getName().replace(postFix, "").replace(getFileName(), "").replace("_", ""), tmp);

> Do we depend on having all the previous stores since we're only checking for the last one?

exactly. And you may have spotted something here.

When we have the last one, we already did the transformation to the new split store system. Hence, I assumed that from now on we already have the historical stores. On a Bisq update, only the newest store is checked and if it isn't there, we need to copy it from resources and un-duplicate things in our live data store.

But you are correct, that might need a bit more effort to make the whole system more robust.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200520/331057ea/attachment-0001.html>

More information about the bisq-github mailing list