~ubuntu-branches/debian/sid/golang-github-blevesearch-bleve/sid

« back to all changes in this revision

Viewing changes to index/store/null/null.go

  • Committer: Package Import Robot
  • Author(s): Michael Lustfield
  • Date: 2017-03-30 16:06:03 UTC
  • Revision ID: package-import@ubuntu.com-20170330160603-0oogmb960l7918jx
Tags: upstream-0.5.0+git20170324.202.4702785f
ImportĀ upstreamĀ versionĀ 0.5.0+git20170324.202.4702785f

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  Copyright (c) 2014 Couchbase, Inc.
 
2
//
 
3
// Licensed under the Apache License, Version 2.0 (the "License");
 
4
// you may not use this file except in compliance with the License.
 
5
// You may obtain a copy of the License at
 
6
//
 
7
//              http://www.apache.org/licenses/LICENSE-2.0
 
8
//
 
9
// Unless required by applicable law or agreed to in writing, software
 
10
// distributed under the License is distributed on an "AS IS" BASIS,
 
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
12
// See the License for the specific language governing permissions and
 
13
// limitations under the License.
 
14
 
 
15
package null
 
16
 
 
17
import (
 
18
        "github.com/blevesearch/bleve/index/store"
 
19
        "github.com/blevesearch/bleve/registry"
 
20
)
 
21
 
 
22
const Name = "null"
 
23
 
 
24
type Store struct{}
 
25
 
 
26
func New(mo store.MergeOperator, config map[string]interface{}) (store.KVStore, error) {
 
27
        return &Store{}, nil
 
28
}
 
29
 
 
30
func (i *Store) Close() error {
 
31
        return nil
 
32
}
 
33
 
 
34
func (i *Store) Reader() (store.KVReader, error) {
 
35
        return &reader{}, nil
 
36
}
 
37
 
 
38
func (i *Store) Writer() (store.KVWriter, error) {
 
39
        return &writer{}, nil
 
40
}
 
41
 
 
42
type reader struct{}
 
43
 
 
44
func (r *reader) Get(key []byte) ([]byte, error) {
 
45
        return nil, nil
 
46
}
 
47
 
 
48
func (r *reader) MultiGet(keys [][]byte) ([][]byte, error) {
 
49
        return make([][]byte, len(keys)), nil
 
50
}
 
51
 
 
52
func (r *reader) PrefixIterator(prefix []byte) store.KVIterator {
 
53
        return &iterator{}
 
54
}
 
55
 
 
56
func (r *reader) RangeIterator(start, end []byte) store.KVIterator {
 
57
        return &iterator{}
 
58
}
 
59
 
 
60
func (r *reader) Close() error {
 
61
        return nil
 
62
}
 
63
 
 
64
type iterator struct{}
 
65
 
 
66
func (i *iterator) SeekFirst()    {}
 
67
func (i *iterator) Seek(k []byte) {}
 
68
func (i *iterator) Next()         {}
 
69
 
 
70
func (i *iterator) Current() ([]byte, []byte, bool) {
 
71
        return nil, nil, false
 
72
}
 
73
 
 
74
func (i *iterator) Key() []byte {
 
75
        return nil
 
76
}
 
77
 
 
78
func (i *iterator) Value() []byte {
 
79
        return nil
 
80
}
 
81
 
 
82
func (i *iterator) Valid() bool {
 
83
        return false
 
84
}
 
85
 
 
86
func (i *iterator) Close() error {
 
87
        return nil
 
88
}
 
89
 
 
90
type batch struct{}
 
91
 
 
92
func (i *batch) Set(key, val []byte)   {}
 
93
func (i *batch) Delete(key []byte)     {}
 
94
func (i *batch) Merge(key, val []byte) {}
 
95
func (i *batch) Reset()                {}
 
96
func (i *batch) Close() error          { return nil }
 
97
 
 
98
type writer struct{}
 
99
 
 
100
func (w *writer) NewBatch() store.KVBatch {
 
101
        return &batch{}
 
102
}
 
103
 
 
104
func (w *writer) NewBatchEx(options store.KVBatchOptions) ([]byte, store.KVBatch, error) {
 
105
        return make([]byte, options.TotalBytes), w.NewBatch(), nil
 
106
}
 
107
 
 
108
func (w *writer) ExecuteBatch(store.KVBatch) error {
 
109
        return nil
 
110
}
 
111
 
 
112
func (w *writer) Close() error {
 
113
        return nil
 
114
}
 
115
 
 
116
func init() {
 
117
        registry.RegisterKVStore(Name, New)
 
118
}