Documentation ¶
Overview ¶
Package mapstore facilitates saving key value pairs into a Kubernetes ConfigMap.
package main import ( "fmt" "log" "github.com/unrolled/mapstore" ) func main() { mapStore, err := mapstore.New("my-custom-config-map-name", false) if err != nil { log.Fatalf("error creating mapstore (possible rbac issue?): %v", err) } err = mapStore.Set("my-key", []byte("my value lives here")) if err != nil { log.Fatalf("error setting value: %v", err) } val, err := mapStore.Get("my-key") if err != nil { log.Fatalf("error getting value: %v", err) } fmt.Printf("Value from ConfigMap: %#v\n", val) }
Index ¶
- Variables
- func VerifyConnection(testMapNamespace, testMapName string) error
- type AdvancedInterface
- type Interface
- type Manager
- func (k *Manager) Delete(key string) error
- func (k *Manager) ForceSet(key string, value []byte) error
- func (k *Manager) Get(key string) ([]byte, error)
- func (k *Manager) Keys() ([]string, error)
- func (k *Manager) Raw() (map[string][]byte, error)
- func (k *Manager) Set(key string, value []byte) error
- func (k *Manager) Truncate() error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func VerifyConnection ¶
VerifyConnection is a helper function that creates a temporary ConfigMap to ensure cluster connectivity and RBAC settings.
Types ¶
type AdvancedInterface ¶ added in v1.0.1
type AdvancedInterface interface { Interface Raw() (map[string][]byte, error) ForceSet(key string, value []byte) error }
AdvancedInterface defines the required methods and a few optional methods for the Manager implementation.
type Interface ¶ added in v1.0.1
type Interface interface { Keys() ([]string, error) Get(key string) ([]byte, error) Set(key string, value []byte) error Delete(key string) error Truncate() error }
Interface defines the required methods to satisfy the Manager implementation.
type Manager ¶ added in v1.0.1
Manager is a thread safe key value store backed by a Kubernetes ConfigMap.
func (*Manager) Delete ¶ added in v1.0.1
Delete removes the given key from the underlying ConfigMap.
func (*Manager) ForceSet ¶ added in v1.0.1
ForceSet is the same as Set, but does not check if the values are equal first.
func (*Manager) Get ¶ added in v1.0.1
Get uses the supplied key and attempts to return the corresponding value from the ConfigMap.