Example #1
0
func NewLevelDBStore(basePath string) LogeStore {

	var opts = levigo.NewOptions()
	opts.SetCreateIfMissing(true)
	db, err := levigo.Open(basePath, opts)

	if err != nil {
		panic(fmt.Sprintf("Can't open DB at %s: %v", basePath, err))
	}

	var store = &levelDBStore{
		basePath: basePath,
		db:       db,
		types:    spack.NewTypeSet(),

		writeQueue: make(chan *levelDBContext),
		flushed:    false,
	}

	store.types.LastTag = ldb_START_TAG
	store.loadTypeMetadata()
	go store.writer()

	return store
}
Example #2
0
func NewMemStore() LogeStore {
	return &memStore{
		objects:    make(objectMap),
		spackTypes: spack.NewTypeSet(),
	}
}