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