exposed Get/Set/Delete Internal methods
these are to be used to store side-channel information along with the index
This commit is contained in:
parent
40a8154bab
commit
0500a572af
4
index.go
4
index.go
@ -62,6 +62,10 @@ type Index interface {
|
|||||||
Mapping() *IndexMapping
|
Mapping() *IndexMapping
|
||||||
|
|
||||||
Stats() *IndexStat
|
Stats() *IndexStat
|
||||||
|
|
||||||
|
GetInternal(key []byte) ([]byte, error)
|
||||||
|
SetInternal(key, val []byte) error
|
||||||
|
DeleteInternal(key []byte) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// A Classifier is an interface describing any object
|
// A Classifier is an interface describing any object
|
||||||
|
@ -533,3 +533,27 @@ func (i *indexImpl) Close() {
|
|||||||
func (i *indexImpl) Stats() *IndexStat {
|
func (i *indexImpl) Stats() *IndexStat {
|
||||||
return i.stats
|
return i.stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *indexImpl) GetInternal(key []byte) ([]byte, error) {
|
||||||
|
i.mutex.RLock()
|
||||||
|
defer i.mutex.RUnlock()
|
||||||
|
|
||||||
|
reader := i.i.Reader()
|
||||||
|
defer reader.Close()
|
||||||
|
|
||||||
|
return reader.GetInternal(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *indexImpl) SetInternal(key, val []byte) error {
|
||||||
|
i.mutex.RLock()
|
||||||
|
defer i.mutex.RUnlock()
|
||||||
|
|
||||||
|
return i.i.SetInternal(key, val)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *indexImpl) DeleteInternal(key []byte) error {
|
||||||
|
i.mutex.RLock()
|
||||||
|
defer i.mutex.RUnlock()
|
||||||
|
|
||||||
|
return i.i.DeleteInternal(key)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user