Skip to content

Commit 536f5d5

Browse files
authored
Merge pull request #95 from ipfs/feat/repo-migration-raw-multihashes
Migration 11-12: migrate CIDsv1 to raw multihashes
2 parents ea2bc1a + f91ca2d commit 536f5d5

File tree

3,914 files changed

+963522
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,914 files changed

+963522
-5
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ test_go: $(shell ls -d fs-repo-*-to-* | sed -e 's/fs-repo/test_go.fs-repo/')
4040

4141
test_go.%: MIGRATION=$*
4242
test_go.%:
43-
@cd $(MIGRATION) && go test -mod=vendor
43+
@cd $(MIGRATION)/migration && go test -mod=vendor

fs-repo-10-to-11/migration/migration.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import (
1111
"github.com/ipfs/go-blockservice"
1212
"github.com/ipfs/go-datastore"
1313
"github.com/ipfs/go-filestore"
14-
"github.com/ipfs/go-ipfs-blockstore"
15-
"github.com/ipfs/go-ipfs-exchange-offline"
14+
blockstore "github.com/ipfs/go-ipfs-blockstore"
15+
offline "github.com/ipfs/go-ipfs-exchange-offline"
1616
"github.com/ipfs/go-ipfs-pinner/pinconv"
1717
"github.com/ipfs/go-ipfs/plugin/loader"
1818
"github.com/ipfs/go-ipfs/repo"
1919
"github.com/ipfs/go-ipfs/repo/fsrepo"
2020
"github.com/ipfs/go-ipfs/repo/fsrepo/migrations"
21-
"github.com/ipfs/go-ipld-format"
21+
format "github.com/ipfs/go-ipld-format"
2222
"github.com/ipfs/go-merkledag"
2323

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

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

9494
log.Print("updated version file")

fs-repo-11-to-12/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.PHONY: build clean
2+
3+
build:
4+
go build -mod=vendor
5+
6+
clean:
7+
go clean

fs-repo-11-to-12/go.mod

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module github.com/ipfs/fs-repo-migrations/fs-repo-11-to-12
2+
3+
go 1.15
4+
5+
require (
6+
github.com/hsanjuan/ipfs-lite v1.1.19
7+
github.com/ipfs/fs-repo-migrations v1.7.1
8+
github.com/ipfs/go-cid v0.0.7
9+
github.com/ipfs/go-datastore v0.4.5
10+
github.com/ipfs/go-filestore v1.0.0
11+
github.com/ipfs/go-ipfs v0.8.0
12+
github.com/ipfs/go-ipfs-blockstore v1.0.3 // indirect
13+
github.com/ipfs/go-ipfs-ds-help v1.0.0
14+
github.com/ipfs/go-ipfs-pinner v0.1.1
15+
github.com/ipfs/go-ipld-format v0.2.0
16+
github.com/otiai10/copy v1.5.1
17+
)

fs-repo-11-to-12/go.sum

Lines changed: 1376 additions & 0 deletions
Large diffs are not rendered by default.

fs-repo-11-to-12/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package main
2+
3+
import (
4+
mg11 "github.com/ipfs/fs-repo-migrations/fs-repo-11-to-12/migration"
5+
migrate "github.com/ipfs/fs-repo-migrations/go-migrate"
6+
)
7+
8+
func main() {
9+
m := mg11.Migration{}
10+
migrate.Main(&m)
11+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# This script can be used to generate the repotest folder that is used
4+
# to test the migration, using go-ipfs v0.8.0.
5+
6+
export IPFS_PATH=repotest
7+
8+
mkdir a
9+
echo "file1" > a/file1
10+
mkdir b
11+
echo "file2" > b/file2
12+
mkdir c
13+
echo "file3" > c/file3
14+
15+
ipfs init
16+
17+
# A: add with both v0 and v1
18+
ipfs add -r --pin=false a
19+
ipfs add -r --cid-version=1 --raw-leaves=false --pin=false a
20+
21+
# B: add with v1
22+
ipfs add -r --cid-version=1 --raw-leaves=false --pin=false b
23+
24+
# C: add with v0
25+
ipfs add -r --pin=false c

0 commit comments

Comments
 (0)