-
Notifications
You must be signed in to change notification settings - Fork 9
/
storage.go
32 lines (26 loc) · 980 Bytes
/
storage.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package runtime
import (
"github.com/safing/portbase/database/iterator"
"github.com/safing/portbase/database/query"
"github.com/safing/portbase/database/record"
"github.com/safing/portbase/database/storage"
)
// storageWrapper is a simple wrapper around storage.InjectBase and
// Registry and make sure the supported methods are handled by
// the registry rather than the InjectBase defaults.
// storageWrapper is mainly there to keep the method landscape of
// Registry as small as possible.
type storageWrapper struct {
storage.InjectBase
Registry *Registry
}
func (sw *storageWrapper) Get(key string) (record.Record, error) {
return sw.Registry.Get(key)
}
func (sw *storageWrapper) Put(r record.Record) (record.Record, error) {
return sw.Registry.Put(r)
}
func (sw *storageWrapper) Query(q *query.Query, local, internal bool) (*iterator.Iterator, error) {
return sw.Registry.Query(q, local, internal)
}
func (sw *storageWrapper) ReadOnly() bool { return false }