英文:
Cayley with BoltDB backend?
问题
我是新手,正在尝试使用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的好文档。有什么建议吗?
英文:
I am new to Go and I am trying to setup a simple graph database using Cayley with BoltDB as the backend datastore. Right now I am trying to run cayley from the command line. Running this command:
cayley http --db="bolt"
Generates this error:
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
I feel like I am missing a step somewhere but I can't find any good documentation on using Cayley with Bolt. Any suggestions?
答案1
得分: 4
至少需要安装Bolt。
go get github.com/boltdb/bolt/...
并且需要提供持久的单个Bolt数据库文件的db_path。
cayley init --db=bolt --dbpath=/tmp/someBoltDB
英文:
At least bolt must be installed.
go get github.com/boltdb/bolt/...
and db_path to the persistent single Bolt database file must be provided
cayley init --db=bolt --dbpath=/tmp/someBoltDB
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论