1

我是 Go 新手,我正在尝试使用 Cayley 和 BoltDB 作为后端数据存储来设置一个简单的图形数据库。现在我正在尝试从命令行运行 cayley。运行此命令:

cayley http --db="bolt"

生成此错误:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x8 pc=0x2517e7]

goroutine 16 [running]:
runtime.panic(0x6ae9e0, 0xbc1f44)
    /usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
github.com/boltdb/bolt.(*Bucket).Get(0x0, 0xc208000b68, 0x4, 0x8, 0x0, 0x0, 0x0)
    /Users/tbrown/Development/src/github.com/boltdb/bolt/bucket.go:256 +0x57
github.com/google/cayley/graph/bolt.(*QuadStore).getInt64ForKey(0xc20800eff0, 0xc208028270,     0x750ac0, 0x4, 0x0, 0xc20800e0b8, 0x0, 0x0)
    /Users/tbrown/Development/src/github.com/google/cayley/graph/bolt/quadstore.go:437 +0xd9
github.com/google/cayley/graph/bolt.func·009(0xc208028270, 0x0, 0x0)
    /Users/tbrown/Development/src/github.com/google/cayley/graph/bolt/quadstore.go:452 +0x76
github.com/boltdb/bolt.(*DB).View(0xc20807e180, 0xc2080a9a90, 0x0, 0x0)
    /Users/tbrown/Development/src/github.com/boltdb/bolt/db.go:490 +0xe4
github.com/google/cayley/graph/bolt.(*QuadStore).getMetadata(0xc20800eff0, 0x0, 0x0)
    /Users/tbrown/Development/src/github.com/google/cayley/graph/bolt/quadstore.go:458 +0x5a
github.com/google/cayley/graph/bolt.newQuadStore(0x75be50, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/tbrown/Development/src/github.com/google/cayley/graph/bolt/quadstore.go:91 +0x226
github.com/google/cayley/graph.NewQuadStore(0x7fff5fbff2b1, 0x4, 0x75be50, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/tbrown/Development/src/github.com/google/cayley/graph/quadstore.go:174 +0x21b
github.com/google/cayley/db.OpenQuadStore(0xc208048180, 0x0, 0x0, 0x0, 0x0)
    /Users/tbrown/Development/src/github.com/google/cayley/db/db.go:53 +0x176
github.com/google/cayley/db.Open(0xc208048180, 0x4, 0x0, 0x0)
    /Users/tbrown/Development/src/github.com/google/cayley/db/db.go:40 +0x3f
main.main()
    /Users/tbrown/Development/src/database_comparison/cayley/src/cayley/cayley.go:234 +0x77e

goroutine 19 [finalizer wait]:
runtime.park(0x17a40, 0xbc8118, 0xbc63a9)
    /usr/local/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0xbc8118, 0xbc63a9)
    /usr/local/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
    /usr/local/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1445

goroutine 20 [chan receive]:
github.com/barakmich/glog.(*loggingT).flushDaemon(0xbcb000)
    /Users/tbrown/Development/src/github.com/barakmich/glog/glog.go:923 +0x75
created by github.com/barakmich/glog.init·1
    /Users/tbrown/Development/src/github.com/barakmich/glog/glog.go:408 +0x37a

goroutine 17 [syscall]:
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1445

goroutine 22 [syscall]:
os/signal.loop()
    /usr/local/go/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
    /usr/local/go/src/pkg/os/signal/signal_unix.go:27 +0x32

我觉得我在某处遗漏了一步,但我找不到任何关于使用 Cayley 和 Bolt 的好的文档。有什么建议么?

4

1 回答 1

4

至少必须安装螺栓。

go get github.com/boltdb/bolt/...

并且必须提供持久化单个 Bolt 数据库文件的 db_path

cayley init --db=bolt --dbpath=/tmp/someBoltDB
于 2014-12-29T16:30:03.137 回答