Exemplo n.º 1
0
func transferBlocksFromFlatDB(repopath string, verbose bool) error {

	ldbpath := path.Join(repopath, "datastore")
	blockspath := path.Join(repopath, "blocks")
	fds, err := flatfs.New(blockspath, 4)
	if err != nil {
		return err
	}

	ldb, err := leveldb.NewDatastore(ldbpath, nil)
	if err != nil {
		return err
	}

	err = transferBlocks(fds, ldb, "", "/b/", verbose)
	if err != nil {
		return err
	}

	// Now remove the blocks directory
	err = os.RemoveAll(blockspath)
	if err != nil {
		return err
	}

	return nil
}
Exemplo n.º 2
0
func transferBlocksToFlatDB(repopath string, verbose bool) error {
	ldbpath := path.Join(repopath, "datastore")
	ldb, err := leveldb.NewDatastore(ldbpath, nil)
	if err != nil {
		return err
	}

	blockspath := path.Join(repopath, "blocks")
	err = os.Mkdir(blockspath, 0777)
	if err != nil && !os.IsExist(err) {
		return err
	}

	fds, err := flatfs.New(blockspath, 4)
	if err != nil {
		return err
	}

	return transferBlocks(ldb, fds, "/b/", "", verbose)
}