Documentation ¶
Index ¶
- Constants
- func NewStorage(config *storagebackend.ConfigForResource, gr schema.GroupResource, ...) (storage.Interface, factory.DestroyFunc, error)
- type Decoder
- type RESTOptionsGetter
- type Requirements
- type Storage
- func (s *Storage) Count(key string) (int64, error)
- func (s *Storage) Create(ctx context.Context, key string, obj runtime.Object, out runtime.Object, ...) error
- func (s *Storage) Delete(ctx context.Context, key string, out runtime.Object, ...) error
- func (s *Storage) Get(ctx context.Context, key string, opts storage.GetOptions, ...) error
- func (s *Storage) GetList(ctx context.Context, key string, opts storage.ListOptions, ...) error
- func (s *Storage) GuaranteedUpdate(ctx context.Context, key string, destination runtime.Object, ...) error
- func (s *Storage) RequestWatchProgress(ctx context.Context) error
- func (s *Storage) Versioner() storage.Versioner
- func (s *Storage) Watch(ctx context.Context, key string, opts storage.ListOptions) (watch.Interface, error)
Constants ¶
const FolderAnnoKey = "grafana.app/folder"
const ListDeletedKey = "grafana.app/listDeleted"
const ListHistoryKey = "grafana.app/listHistory"
const SortByKey = "grafana.app/sortBy"
Variables ¶
This section is empty.
Functions ¶
func NewStorage ¶
func NewStorage( config *storagebackend.ConfigForResource, gr schema.GroupResource, store entityStore.EntityStoreClient, codec runtime.Codec, keyFunc func(obj runtime.Object) (string, error), newFunc func() runtime.Object, newListFunc func() runtime.Object, getAttrsFunc storage.AttrFunc, ) (storage.Interface, factory.DestroyFunc, error)
Types ¶
type RESTOptionsGetter ¶
func NewRESTOptionsGetter ¶
func NewRESTOptionsGetter(cfg *setting.Cfg, store entityStore.EntityStoreClient, codec runtime.Codec) *RESTOptionsGetter
func (*RESTOptionsGetter) GetRESTOptions ¶
func (f *RESTOptionsGetter) GetRESTOptions(resource schema.GroupResource) (generic.RESTOptions, error)
type Requirements ¶
type Requirements struct { // Equals folder Folder *string // SortBy is a list of fields to sort by SortBy []string // ListDeleted is a flag to list deleted entities ListDeleted bool // ListHistory is a resource name to list the history of ListHistory string // ListOriginKeys needs to include the origin key of a given entity in order for it to be selected. ListOriginKeys []string }
func ReadLabelSelectors ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage implements storage.Interface and stores resources in unified storage
func (*Storage) Count ¶
Count returns number of different entries under the key (generally being path prefix).
func (*Storage) Create ¶
func (s *Storage) Create(ctx context.Context, key string, obj runtime.Object, out runtime.Object, ttl uint64) error
Create adds a new object at a key unless it already exists. 'ttl' is time-to-live in seconds (0 means forever). If no error is returned and out is not nil, out will be set to the read value from database.
func (*Storage) Delete ¶
func (s *Storage) Delete(ctx context.Context, key string, out runtime.Object, preconditions *storage.Preconditions, validateDeletion storage.ValidateObjectFunc, cachedExistingObject runtime.Object) error
Delete removes the specified key and returns the value that existed at that spot. If key didn't exist, it will return NotFound storage error. If 'cachedExistingObject' is non-nil, it can be used as a suggestion about the current version of the object to avoid read operation from storage to get it. However, the implementations have to retry in case suggestion is stale.
func (*Storage) Get ¶
func (s *Storage) Get(ctx context.Context, key string, opts storage.GetOptions, objPtr runtime.Object) error
Get unmarshals object found at key into objPtr. On a not found error, will either return a zero object of the requested type, or an error, depending on 'opts.ignoreNotFound'. Treats empty responses and nil response nodes exactly like a not found error. The returned contents may be delayed, but it is guaranteed that they will match 'opts.ResourceVersion' according 'opts.ResourceVersionMatch'.
func (*Storage) GetList ¶
func (s *Storage) GetList(ctx context.Context, key string, opts storage.ListOptions, listObj runtime.Object) error
GetList unmarshalls objects found at key into a *List api object (an object that satisfies runtime.IsList definition). If 'opts.Recursive' is false, 'key' is used as an exact match. If `opts.Recursive' is true, 'key' is used as a prefix. The returned contents may be delayed, but it is guaranteed that they will match 'opts.ResourceVersion' according 'opts.ResourceVersionMatch'.
func (*Storage) GuaranteedUpdate ¶
func (s *Storage) GuaranteedUpdate( ctx context.Context, key string, destination runtime.Object, ignoreNotFound bool, preconditions *storage.Preconditions, tryUpdate storage.UpdateFunc, cachedExistingObject runtime.Object, ) error
GuaranteedUpdate keeps calling 'tryUpdate()' to update key 'key' (of type 'destination') retrying the update until success if there is index conflict. Note that object passed to tryUpdate may change across invocations of tryUpdate() if other writers are simultaneously updating it, so tryUpdate() needs to take into account the current contents of the object when deciding how the update object should look. If the key doesn't exist, it will return NotFound storage error if ignoreNotFound=false else `destination` will be set to the zero value of it's type. If the eventual successful invocation of `tryUpdate` returns an output with the same serialized contents as the input, it won't perform any update, but instead set `destination` to an object with those contents. If 'cachedExistingObject' is non-nil, it can be used as a suggestion about the current version of the object to avoid read operation from storage to get it. However, the implementations have to retry in case suggestion is stale.
func (*Storage) RequestWatchProgress ¶
func (*Storage) Watch ¶
func (s *Storage) Watch(ctx context.Context, key string, opts storage.ListOptions) (watch.Interface, error)
Watch begins watching the specified key. Events are decoded into API objects, and any items selected by 'p' are sent down to returned watch.Interface. resourceVersion may be used to specify what version to begin watching, which should be the current resourceVersion, and no longer rv+1 (e.g. reconnecting without missing any updates). If resource version is "0", this interface will get current object at given key and send it in an "ADDED" event, before watch starts.