code: public void syncInternalStateFromFileSystem(boolean alsoSyncRemoteState) {
          // Make sure versions missing from the file-system are cleaned up from the internal state
          for (Long version: versionToEnabledMap.keySet()) {
              File[] existingVersionDirs = ReadOnlyUtils.getVersionDirs(rootDir, version, version);
              if (existingVersionDirs.length == 0) {
                  removeVersion(version, alsoSyncRemoteState);
              }
          }
  
          // Make sure we have all versions on the file-system in the internal state
          File[] versionDirs = ReadOnlyUtils.getVersionDirs(rootDir);
          if (versionDirs != null) {
              for (File versionDir: versionDirs) {
                  long versionNumber = ReadOnlyUtils.getVersionId(versionDir);
                  boolean versionEnabled = isVersionEnabled(versionDir);
                  versionToEnabledMap.put(versionNumber, versionEnabled);
              }
          }
  
          // Identify the current version (based on a symlink in the file-system)
          File currentVersionDir = ReadOnlyUtils.getCurrentVersion(rootDir);
          if (currentVersionDir != null) {
              currentVersion = ReadOnlyUtils.getVersionId(currentVersionDir);
          } else {
              currentVersion = -1; // Should we throw instead?
          }
  
          logger.info("Successfully synced internal state from local file-system: " + this.toString());
      }
docs: Compares the StoreVersionManager's internal state with the content on the file-system
  of the rootDir provided at construction time.
  
  TODO: If the StoreVersionManager supports non-RO stores in the future,
  we should move some of the ReadOnlyUtils functions below to another Utils class.