Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration 11-12: migrate CIDsv1 to raw multihashes #95

Merged
merged 13 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ test_go: $(shell ls -d fs-repo-*-to-* | sed -e 's/fs-repo/test_go.fs-repo/')

test_go.%: MIGRATION=$*
test_go.%:
@cd $(MIGRATION) && go test -mod=vendor
@cd $(MIGRATION)/migration && go test -mod=vendor
8 changes: 4 additions & 4 deletions fs-repo-10-to-11/migration/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (
"github.com/ipfs/go-blockservice"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-filestore"
"github.com/ipfs/go-ipfs-blockstore"
"github.com/ipfs/go-ipfs-exchange-offline"
blockstore "github.com/ipfs/go-ipfs-blockstore"
offline "github.com/ipfs/go-ipfs-exchange-offline"
"github.com/ipfs/go-ipfs-pinner/pinconv"
"github.com/ipfs/go-ipfs/plugin/loader"
"github.com/ipfs/go-ipfs/repo"
"github.com/ipfs/go-ipfs/repo/fsrepo"
"github.com/ipfs/go-ipfs/repo/fsrepo/migrations"
"github.com/ipfs/go-ipld-format"
format "github.com/ipfs/go-ipld-format"
"github.com/ipfs/go-merkledag"

migrate "github.com/ipfs/fs-repo-migrations/tools/go-migrate"
Expand Down Expand Up @@ -88,7 +88,7 @@ func (m Migration) Apply(opts migrate.Options) error {

err = migrations.WriteRepoVersion(opts.Path, toVer)
if err != nil {
return fmt.Errorf("failed to update version file to %s: %v", toVer, err)
return fmt.Errorf("failed to update version file to %d: %v", toVer, err)
}

log.Print("updated version file")
Expand Down
7 changes: 7 additions & 0 deletions fs-repo-11-to-12/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: build clean

build:
go build -mod=vendor

clean:
go clean
17 changes: 17 additions & 0 deletions fs-repo-11-to-12/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module github.com/ipfs/fs-repo-migrations/fs-repo-11-to-12

go 1.15

require (
github.com/hsanjuan/ipfs-lite v1.1.19
github.com/ipfs/fs-repo-migrations v1.7.1
github.com/ipfs/go-cid v0.0.7
github.com/ipfs/go-datastore v0.4.5
github.com/ipfs/go-filestore v1.0.0
github.com/ipfs/go-ipfs v0.8.0
github.com/ipfs/go-ipfs-blockstore v1.0.3 // indirect
github.com/ipfs/go-ipfs-ds-help v1.0.0
github.com/ipfs/go-ipfs-pinner v0.1.1
github.com/ipfs/go-ipld-format v0.2.0
github.com/otiai10/copy v1.5.1
)
1,376 changes: 1,376 additions & 0 deletions fs-repo-11-to-12/go.sum

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions fs-repo-11-to-12/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main

import (
mg11 "github.com/ipfs/fs-repo-migrations/fs-repo-11-to-12/migration"
migrate "github.com/ipfs/fs-repo-migrations/go-migrate"
)

func main() {
m := mg11.Migration{}
migrate.Main(&m)
}
25 changes: 25 additions & 0 deletions fs-repo-11-to-12/migration/generate_repotest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# This script can be used to generate the repotest folder that is used
# to test the migration, using go-ipfs v0.8.0.

export IPFS_PATH=repotest

mkdir a
echo "file1" > a/file1
mkdir b
echo "file2" > b/file2
mkdir c
echo "file3" > c/file3

ipfs init

# A: add with both v0 and v1
ipfs add -r --pin=false a
ipfs add -r --cid-version=1 --raw-leaves=false --pin=false a

# B: add with v1
ipfs add -r --cid-version=1 --raw-leaves=false --pin=false b

# C: add with v0
ipfs add -r --pin=false c
Loading