提交 b223dc2d 作者: Juan Batiz-Benet

fix vendoring problems from migrations

上级 0917c1cb
......@@ -160,10 +160,6 @@
"Rev": "74bec4b83f6d45d1402c1e9d94c0c29e39f6e0ea"
},
{
"ImportPath": "github.com/jbenet/go-migrate",
"Rev": "593be6b4b24a87e4d380e54339721ad4b4c6543c"
},
{
"ImportPath": "github.com/jbenet/go-msgio",
"Rev": "dbae89193876910c736b2ce1291fa8bbcf299d77"
},
......
package callback
import (
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dsq "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dsq "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
)
type Datastore struct {
......
......@@ -3,8 +3,8 @@ package coalesce
import (
"sync"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dsq "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dsq "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
)
var (
......
......@@ -6,9 +6,9 @@ import (
"testing"
"time"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dscb "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/callback"
dssync "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dscb "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/callback"
dssync "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
)
type mock struct {
......
......@@ -6,9 +6,9 @@ import (
"path/filepath"
"testing"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/flatfs"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/flatfs"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
)
func tempdir(t testing.TB) (path string, cleanup func()) {
......
......@@ -3,9 +3,9 @@ package mount_test
import (
"testing"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/mount"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/mount"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
)
func TestPutBadNothing(t *testing.T) {
......
......@@ -4,8 +4,8 @@ import (
"fmt"
"sync"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dsq "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dsq "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
)
type tiered []ds.Datastore
......
......@@ -3,9 +3,9 @@ package tiered
import (
"testing"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dscb "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/callback"
dsq "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dscb "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/callback"
dsq "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
)
func testHas(t *testing.T, dses []ds.Datastore, k ds.Key, v interface{}) {
......
......@@ -4,8 +4,8 @@ import (
"sync"
"time"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dsq "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dsq "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/query"
)
var (
......
......@@ -4,7 +4,7 @@ import (
"testing"
"time"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
)
func testHas(t *testing.T, d ds.Datastore, k ds.Key, v interface{}) {
......
The MIT License (MIT)
Copyright (c) 2014 Juan Batiz-Benet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
# go-migrate
This is a very simple migration framework. See "Migrations" in https://github.com/jbenet/random-ideas/issues/33
This package includes:
- `migrate` package -- lib to write migration programs
## The model
The idea here is that we have some thing -- usually a directory -- that needs to be migrated between different representation versions. This may be because there has been an upgrade.
package migrate
import (
"flag"
"fmt"
"os"
)
type Flags struct {
Force bool
Revert bool
Path string // file path to migrate for fs based migrations
}
func (f *Flags) Setup() {
flag.BoolVar(&f.Force, "f", false, "whether to force a migration (ignores warnings)")
flag.BoolVar(&f.Revert, "revert", false, "whether to apply the migration backwards")
flag.StringVar(&f.Path, "path", "", "file path to migrate for fs based migrations")
}
func (f *Flags) Parse() {
flag.Parse()
}
func Run(m Migration) error {
f := Flags{}
f.Setup()
f.Parse()
if !m.Reversible() {
if f.Revert {
return fmt.Errorf("migration %d is irreversible", m.Versions())
}
if !f.Force {
return fmt.Errorf("migration %d is irreversible (use -f to proceed)", m.Versions())
}
}
if f.Revert {
return m.Revert(Options{f})
} else {
return m.Apply(Options{f})
}
}
func Main(m Migration) {
if err := Run(m); err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n", err)
os.Exit(1)
}
}
// Package migrate is used to write migrations between representations of things.
package migrate
package migrate
import (
"fmt"
)
// Options are migration options. For now all flags are options.
type Options struct {
Flags
}
// Migration represents
type Migration interface {
// Versions is the "v-to-v" version string.
Versions() string
// Reversible returns whether this migration can be reverted.
// Endeavor to make them all reversible. This is here only to warn users
// in case this is not the case.
Reversible() bool
// Apply applies the migration in question.
Apply(Options) error
// Revert un-applies the migration in question. This should be best-effort.
// Some migrations are definitively one-way. If so, return an error.
Revert(Options) error
}
func SplitVersion(s string) (from int, to int) {
_, err := fmt.Scanf(s, "%d-to-%d", &from, &to)
if err != nil {
panic(err.Error())
}
return
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论