2014-09-24 14:13:14 +02:00
|
|
|
// Copyright (c) 2014 Couchbase, Inc.
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
// except in compliance with the License. You may obtain a copy of the License at
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
// Unless required by applicable law or agreed to in writing, software distributed under the
|
|
|
|
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
|
|
// either express or implied. See the License for the specific language governing permissions
|
|
|
|
// and limitations under the License.
|
|
|
|
|
|
|
|
package null
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/blevesearch/bleve/index/store"
|
2015-09-02 17:50:06 +02:00
|
|
|
"github.com/blevesearch/bleve/registry"
|
2014-09-24 14:13:14 +02:00
|
|
|
)
|
|
|
|
|
2015-09-02 17:50:06 +02:00
|
|
|
const Name = "null"
|
|
|
|
|
2014-09-24 14:13:14 +02:00
|
|
|
type Store struct{}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func New(mo store.MergeOperator, config map[string]interface{}) (store.KVStore, error) {
|
|
|
|
return &Store{}, nil
|
2015-04-24 23:11:47 +02:00
|
|
|
}
|
|
|
|
|
2014-09-24 14:13:14 +02:00
|
|
|
func (i *Store) Close() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2014-10-31 14:40:23 +01:00
|
|
|
func (i *Store) Reader() (store.KVReader, error) {
|
2015-09-23 20:25:47 +02:00
|
|
|
return &reader{}, nil
|
2014-09-24 14:13:14 +02:00
|
|
|
}
|
|
|
|
|
2014-10-31 14:40:23 +01:00
|
|
|
func (i *Store) Writer() (store.KVWriter, error) {
|
2015-09-23 20:25:47 +02:00
|
|
|
return &writer{}, nil
|
2014-09-24 14:13:14 +02:00
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
type reader struct{}
|
2015-04-03 22:50:48 +02:00
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (r *reader) Get(key []byte) ([]byte, error) {
|
2014-09-24 14:13:14 +02:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2016-01-14 00:12:10 +01:00
|
|
|
func (r *reader) MultiGet(keys [][]byte) ([][]byte, error) {
|
|
|
|
return make([][]byte, len(keys)), nil
|
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (r *reader) PrefixIterator(prefix []byte) store.KVIterator {
|
|
|
|
return &iterator{}
|
2014-09-24 14:13:14 +02:00
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (r *reader) RangeIterator(start, end []byte) store.KVIterator {
|
|
|
|
return &iterator{}
|
2014-09-24 14:13:14 +02:00
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (r *reader) Close() error {
|
|
|
|
return nil
|
2014-09-24 14:13:14 +02:00
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
type iterator struct{}
|
2014-09-24 14:13:14 +02:00
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (i *iterator) SeekFirst() {}
|
|
|
|
func (i *iterator) Seek(k []byte) {}
|
|
|
|
func (i *iterator) Next() {}
|
2014-09-24 14:13:14 +02:00
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (i *iterator) Current() ([]byte, []byte, bool) {
|
2014-09-24 14:13:14 +02:00
|
|
|
return nil, nil, false
|
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (i *iterator) Key() []byte {
|
2014-09-24 14:13:14 +02:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (i *iterator) Value() []byte {
|
2014-09-24 14:13:14 +02:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (i *iterator) Valid() bool {
|
2014-09-24 14:13:14 +02:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (i *iterator) Close() error {
|
2014-10-31 14:40:23 +01:00
|
|
|
return nil
|
2014-09-24 14:13:14 +02:00
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
type batch struct{}
|
2014-09-24 14:13:14 +02:00
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (i *batch) Set(key, val []byte) {}
|
|
|
|
func (i *batch) Delete(key []byte) {}
|
|
|
|
func (i *batch) Merge(key, val []byte) {}
|
|
|
|
func (i *batch) Reset() {}
|
2016-01-08 02:54:21 +01:00
|
|
|
func (i *batch) Close() error { return nil }
|
2014-09-24 14:13:14 +02:00
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
type writer struct{}
|
2014-09-24 14:13:14 +02:00
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (w *writer) NewBatch() store.KVBatch {
|
|
|
|
return &batch{}
|
2014-09-24 14:13:14 +02:00
|
|
|
}
|
|
|
|
|
2016-01-14 01:19:04 +01:00
|
|
|
func (w *writer) NewBatchEx(options store.KVBatchOptions) ([]byte, store.KVBatch, error) {
|
|
|
|
return make([]byte, options.TotalBytes), w.NewBatch(), nil
|
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (w *writer) ExecuteBatch(store.KVBatch) error {
|
2014-09-24 14:13:14 +02:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-09-23 20:25:47 +02:00
|
|
|
func (w *writer) Close() error {
|
2014-09-24 14:13:14 +02:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-09-02 17:50:06 +02:00
|
|
|
func init() {
|
2015-09-23 20:25:47 +02:00
|
|
|
registry.RegisterKVStore(Name, New)
|
2015-09-02 17:50:06 +02:00
|
|
|
}
|