Cayley与BoltDB后端?

时间:2014-12-29 15:50:33

标签: go backend datastore cayley boltdb

我是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的好文档。有什么建议吗?

1 个答案:

答案 0 :(得分:4)

至少必须安装螺栓。

go get github.com/boltdb/bolt/...
必须提供

和db_path到持久性单个Bolt数据库文件

cayley init --db=bolt --dbpath=/tmp/someBoltDB