@Override
  public void load() throws StoreException {
    synchronized (storeWriteLock) {
      if (started) {
        throw new StoreException("Store already started", StoreErrorCodes.StoreAlreadyStarted);
      }
      if (!initialized) {
        throw new StoreException("Store not initialized", StoreErrorCodes.StoreNotInitialized);
      }
      try {
        log.init();
        compactor.init();
        index = new PersistentIndex(dataDir, storeId, indexPersistScheduler, log, config, factory, recovery, hardDelete,
            diskIOScheduler, metrics, time, sessionId, storeDescriptor.getIncarnationId());
        compactor.initialize(index);
        if (config.storeRebuildTokenBasedOnCompactionHistory) {
          compactor.enablePersistIndexSegmentOffsets();
          index.enableRebuildTokenBasedOnCompactionHistory();
          buildCompactionHistory();
        }
        if (blobStoreStats == null) {
          blobStoreStats =
              new BlobStoreStats(storeId, index, config, time, longLivedTaskScheduler, taskScheduler, diskIOScheduler,
                  metrics);
        }
        metrics.initializeIndexGauges(storeId, index, capacityInBytes, blobStoreStats,
            config.storeEnableCurrentInvalidSizeMetric, config.storeEnableIndexDirectMemoryUsageMetric);
        checkCapacityAndUpdateReplicaStatusDelegate();
        remoteTokenTracker.start(config.storePersistRemoteTokenIntervalInSeconds);
        logger.trace("The store {} is successfully started", storeId);
        onSuccess("START");
        isDisabled.set(false);
        started = true;
        resolveStoreInitialState();
        if (replicaId != null) {
          replicaId.markDiskUp();
        }
        enableReplicaIfNeeded();
      } catch (Exception e) {
        if (fileLock != null) {
          // Release the file lock
          try {
            fileLock.unlock();
          } catch (Exception lockException) {
            logger.error("Failed to unlock file lock for dir " + dataDir, lockException);
          }
        }
        initialized = false;
        String err = String.format("Error while starting store for dir %s due to %s", dataDir, e.getMessage());
        throw new StoreException(err, e, StoreErrorCodes.InitializationError);
      }
    }
  }
Constructor for BlobStore, used in ambry-tools

@param storeId                     id of the BlobStore
@param config                      the settings for store configuration.
@param taskScheduler               the {@link ScheduledExecutorService} for executing background tasks.
@param longLivedTaskScheduler      the {@link ScheduledExecutorService} for executing long period background
                                   tasks.
@param diskManager                 the {@link DiskManager} object
@param diskIOScheduler             schedules disk IO operations.
@param diskSpaceAllocator          allocates log segment files.
@param metrics                     the {@link StorageManagerMetrics} instance to use.
@param storeUnderCompactionMetrics the {@link StoreMetrics} object used by stores created for compaction.
@param dataDir                     directory that will be used by the BlobStore for data
@param capacityInBytes             capacity of the BlobStore
@param factory                     the {@link StoreKeyFactory} for parsing store keys.
@param recovery                    the {@link MessageStoreRecovery} instance to use.
@param hardDelete                  the {@link MessageStoreHardDelete} instance to use.
@param time                        the {@link Time} instance to use.
@param indexPersistScheduler       a dedicated {@link ScheduledExecutorService} for persisting index segments.
ambry-store/src/main/java/com/github/ambry/store/BlobStore.java