code: func (m *Migrator) Migrate() (bool, error) {
  	// Check if we should attempt a migration
  	if _, err := os.Stat(m.mdbPath); os.IsNotExist(err) {
  		return false, nil
  	}
  
  	// Connect the stores
  	if err := m.mdbConnect(m.raftPath); err != nil {
  		return false, fmt.Errorf("Failed to connect MDB: %s", err)
  	}
  	defer m.mdbStore.Close()
  
  	if err := m.boltConnect(m.boltTempPath); err != nil {
  		return false, fmt.Errorf("Failed to connect BoltDB: %s", err)
  	}
  	defer m.boltStore.Close()
  
  	// Ensure we clean up the temp file during failure cases
  	defer os.Remove(m.boltTempPath)
  
  	// Migrate the stable store
  	if err := m.migrateStableStore(); err != nil {
  		return false, fmt.Errorf("Failed to migrate stable store: %v", err)
  	}
  
  	// Migrate the log store
  	if err := m.migrateLogStore(); err != nil {
  		return false, fmt.Errorf("Failed to migrate log store: %v", err)
  	}
  
  	// Activate the new BoltDB file
  	if err := m.activateBoltStore(); err != nil {
  		return false, fmt.Errorf("Failed to activate Bolt store: %s", err)
  	}
  
  	// Move the old MDB dir to its backup location
  	if err := m.archiveMDBStore(); err != nil {
  		return false, fmt.Errorf("Failed to archive LMDB data: %s", err)
  	}
  
  	return true, nil
  }
docs: // Migrate is the high-level function we call when we want to attempt
  // to migrate all of our LMDB data into BoltDB. If an error is
  // encountered, the BoltStore is nuked from disk, since it is useless.
  // The migration can be attempted again, as the LMDB data should
  // still be intact. Returns a bool indicating whether a migration
  // was completed, and any error.