本文整理汇总了Golang中github.com/syndtr/goleveldb/leveldb/storage.Storage类的典型用法代码示例。如果您正苦于以下问题:Golang Storage类的具体用法?Golang Storage怎么用?Golang Storage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Storage类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
// Main method. Will panic if things are so bad that the application
// will not start.
func main() {
flag.Parse()
log.Println("Event store to use:", *eventStorePath)
log.Println("Command socket path:", *commandSocketZPath)
log.Println("Event publishing socket path:", *eventPublishZPath)
log.Println()
var stor storage.Storage
if *inMemoryStore {
log.Println("!!! WARNING: Using in-memory store.")
log.Println("!!! Events will not be persisted.")
log.Println()
stor = &storage.MemStorage{}
} else {
stor, err := storage.OpenFile(*eventStorePath)
if err != nil {
log.Panicln("could not create DB storage")
}
defer stor.Close()
}
estore, err := eventstore.New(stor)
if err != nil {
log.Panicln(os.Stderr, "could not create event store")
}
context, err := zmq.NewContext()
if err != nil {
log.Panicln(err)
}
initParams := server.InitParams{
Store: estore,
CommandSocketZPath: commandSocketZPath,
EvPubSocketZPath: eventPublishZPath,
ZMQContext: context,
}
serv, err := server.New(&initParams)
if err != nil {
panic(err.Error())
}
sigchan := make(chan os.Signal, 5)
serverStopper := func() {
sig := <-sigchan
if sig == os.Interrupt {
serv.Stop()
}
}
go serverStopper()
signal.Notify(sigchan)
serv.Start()
serv.Wait()
}
开发者ID:JensRantil,项目名称:gorewind,代码行数:58,代码来源:gorewind.go
示例2: openSession
func openSession(stor storage.Storage, o *opt.Options) (s *session, err error) {
if stor == nil || o == nil {
return nil, os.ErrInvalid
}
storLock, err := stor.Lock()
if err != nil {
return
}
s = new(session)
s.stor = stor
s.storLock = storLock
s.cmp = &iComparer{o.GetComparer()}
s.o = newIOptions(s, *o)
s.tops = newTableOps(s, s.o.GetMaxOpenFiles())
s.setVersion(&version{s: s})
return
}
开发者ID:29n,项目名称:goleveldb,代码行数:17,代码来源:session.go
示例3: newSession
func newSession(stor storage.Storage, o *opt.Options) (s *session, err error) {
if stor == nil {
return nil, os.ErrInvalid
}
storLock, err := stor.Lock()
if err != nil {
return
}
s = &session{
stor: stor,
storLock: storLock,
}
s.setOptions(o)
s.tops = newTableOps(s, s.o.GetMaxOpenFiles())
s.setVersion(&version{s: s})
return
}
开发者ID:pombredanne,项目名称:goleveldb,代码行数:17,代码来源:session.go
示例4: newSession
// Creates new initialized session instance.
func newSession(stor storage.Storage, o *opt.Options) (s *session, err error) {
if stor == nil {
return nil, os.ErrInvalid
}
storLock, err := stor.Lock()
if err != nil {
return
}
s = &session{
stor: stor,
storLock: storLock,
}
s.setOptions(o)
s.tops = newTableOps(s, s.o.GetMaxOpenFiles())
s.setVersion(&version{s: s})
s.log("[email protected] F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock D·DeletedEntry L·Level Q·SeqNum T·TimeElapsed")
return
}
开发者ID:GDXN,项目名称:syncthing,代码行数:19,代码来源:session.go
示例5: newSession
// Creates new initialized session instance.
func newSession(stor storage.Storage, o *opt.Options) (s *session, err error) {
if stor == nil {
return nil, os.ErrInvalid
}
storLock, err := stor.Lock()
if err != nil {
return
}
s = &session{
stor: stor,
storLock: storLock,
stCompPtrs: make([]iKey, o.GetNumLevel()),
}
s.setOptions(o)
s.tops = newTableOps(s, s.o.GetCachedOpenFiles())
s.setVersion(newVersion(s))
s.log("[email protected] F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed")
return
}
开发者ID:ericcapricorn,项目名称:syncthing,代码行数:20,代码来源:session.go
示例6: newSession
// Creates new initialized session instance.
func newSession(stor storage.Storage, o *opt.Options) (s *session, err error) {
if stor == nil {
return nil, os.ErrInvalid
}
storLock, err := stor.Lock()
if err != nil {
return
}
s = &session{
stor: stor,
storLock: storLock,
fileRef: make(map[int64]int),
}
s.setOptions(o)
s.tops = newTableOps(s)
s.setVersion(newVersion(s))
s.log("[email protected] F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed")
return
}
开发者ID:syndtr,项目名称:goleveldb,代码行数:20,代码来源:session.go
注:本文中的github.com/syndtr/goleveldb/leveldb/storage.Storage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论