Skip to content

Commit

Permalink
search: first outline of bleve-leveldb store
Browse files Browse the repository at this point in the history
Issue: HOTPOT-1262
strib committed Dec 4, 2019
1 parent abc5e1a commit 269f6c7
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions go/kbfs/search/bleve_leveldb_store.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2019 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.

package search

import (
"github.com/blevesearch/bleve/index/store"
"github.com/keybase/client/go/kbfs/libfs"
"github.com/syndtr/goleveldb/leveldb"
billy "gopkg.in/src-d/go-billy.v4"
)

type bleveLevelDBStore struct {
db *leveldb.DB
}

var _ store.KVStore = (*bleveLevelDBStore)(nil)

func newBleveLevelDBStore(bfs billy.Filesystem, readOnly bool) (
*bleveLevelDBStore, error) {
s, err := libfs.OpenLevelDBStorage(bfs, readOnly)
if err != nil {
return nil, err
}
db, err := leveldb.Open(s, nil)
if err != nil {
return nil, err
}
return &bleveLevelDBStore{db: db}, nil
}

// Writer implements the store.KVStore interface for bleveLevelDBStore.
func (bldbs *bleveLevelDBStore) Writer() (store.KVWriter, error) {
return nil, nil
}

// Writer implements the store.KVStore interface for bleveLevelDBStore.
func (bldbs *bleveLevelDBStore) Reader() (store.KVReader, error) {
return nil, nil
}

// close implements the store.KVStore interface for bleveLevelDBStore.
func (bldbs *bleveLevelDBStore) Close() error {
return nil
}

0 comments on commit 269f6c7

Please sign in to comment.