Documentation ¶
Overview ¶
Package schemacache provides wrapper functions for interacting with instances of the generic (vtadmin/cache).Cache that store schemas.
Index ¶
- func AddOrBackfill(c *schemaCache, schemas []*vtadminpb.Schema, key Key, d time.Duration, ...)
- func LoadAll(c *schemaCache, key Key, opts LoadOptions) (schemas []*vtadminpb.Schema, ok bool, err error)
- func LoadOne(c *schemaCache, key Key, opts LoadOptions) (schema *vtadminpb.Schema, found bool, err error)
- type Key
- type LoadOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOrBackfill ¶
func AddOrBackfill(c *schemaCache, schemas []*vtadminpb.Schema, key Key, d time.Duration, opts LoadOptions)
AddOrBackfill takes a (schemas, key, duration) triple (see cache.Add) and a LoadOptions and either adds the schemas to the cache directly for the key, or enqueues a backfill for the key. Which of these occurs depends on the given LoadOptions. If the options, when passed to Load(All|One) would result in a full payload of the cached data, then the schemas are added to the cache directly. Otherwise, data would be missing for future Load(All|One) calls, so we enqueue a backfill to fetch the full payload and add that to the cache.
Callers are expected to call this function in the background, so it returns nothing and only logs warnings on failures.
func LoadAll ¶
func LoadAll(c *schemaCache, key Key, opts LoadOptions) (schemas []*vtadminpb.Schema, ok bool, err error)
LoadAll returns the slice of all schemas cached for the given key, filtering down based on LoadOptions.
The boolean return value will be false if there is nothing in the cache for key.
func LoadOne ¶
func LoadOne(c *schemaCache, key Key, opts LoadOptions) (schema *vtadminpb.Schema, found bool, err error)
LoadOne loads a single schema for the given key, filtering down based on the LoadOptions. If there is not exactly one schema for the key, an error is returned.
The boolean return value will be false if there is nothing in the cache for key.
Types ¶
type LoadOptions ¶
type LoadOptions struct { BaseRequest *vtctldatapb.GetSchemaRequest AggregateSizes bool // contains filtered or unexported fields }
LoadOptions is the set of options used by Load(All|One) to filter down fully- cached schema payloads.