0
0
Fork 0

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:
Marty Schoch 2014-10-22 16:03:55 -04:00
parent 40a8154bab
commit 0500a572af
2 changed files with 28 additions and 0 deletions

View File

@ -62,6 +62,10 @@ type Index interface {
Mapping() *IndexMapping
Stats() *IndexStat
GetInternal(key []byte) ([]byte, error)
SetInternal(key, val []byte) error
DeleteInternal(key []byte) error
}
// A Classifier is an interface describing any object

View File

@ -533,3 +533,27 @@ func (i *indexImpl) Close() {
func (i *indexImpl) Stats() *IndexStat {
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)
}