mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Initial refactoring work for plugins kvstore * Replace implementations for keystore and angularstore * Cleanup * add interface check * lint * fix storeKeyGetter not being called in namespacedstore set * Fix tests * Comments * Add tests * Fix invalid cap in ListKeys when store is empty * Update docstrings * Add setLastUpdatedOnDelete * Renamed DefaultStoreKeyGetterFunc, add TestDefaultStoreKeyGetter * Sort imports * PR review: removed last_updated key * PR review: Removed setLastUpdatedOnDelete * Re-added relevant tests * PR review: Removed SingleKeyStore * PR review: Removed custom marshaling support * Renamed marshaler.go to marshal.go * PR review: removed unused interfaces * PR review: Moved marshal into namespacedstore.go * PR review: removed storekeygetter * Removed unused file cachekvstore.go * Renamed NamespacedStore to CacheKvStore * removed todo
26 lines
571 B
Go
26 lines
571 B
Go
package keystore
|
|
|
|
import (
|
|
"github.com/grafana/grafana/pkg/infra/kvstore"
|
|
"github.com/grafana/grafana/pkg/plugins"
|
|
"github.com/grafana/grafana/pkg/services/pluginsintegration/cachekvstore"
|
|
)
|
|
|
|
// Service is a service for storing and retrieving public keys.
|
|
type Service struct {
|
|
*cachekvstore.CacheKvStore
|
|
}
|
|
|
|
const (
|
|
namespace = "plugin.publickeys"
|
|
prefix = "key-"
|
|
)
|
|
|
|
var _ plugins.KeyStore = (*Service)(nil)
|
|
|
|
func ProvideService(kv kvstore.KVStore) *Service {
|
|
return &Service{
|
|
CacheKvStore: cachekvstore.NewCacheKvStoreWithPrefix(kv, namespace, prefix),
|
|
}
|
|
}
|