package store
import "k8s.io/kubernetes/pkg/kubelet/util/store"
Package store hosts a Store interface and its implementations.
Index ¶
- Variables
- func ValidateKey(key string) error
- type FileStore
- func (f *FileStore) Delete(key string) error
- func (f *FileStore) List() ([]string, error)
- func (f *FileStore) Read(key string) ([]byte, error)
- func (f *FileStore) Write(key string, data []byte) error
- type Store
Variables ¶
var ( // ErrKeyNotFound is the error returned if key is not found in Store. ErrKeyNotFound = fmt.Errorf("key is not found") )
Functions ¶
func ValidateKey ¶
ValidateKey returns an error if the given key does not meet the requirement of the key format and length.
Types ¶
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore is an implementation of the Store interface which stores data in files.
func (*FileStore) Delete ¶
Delete deletes the key file.
func (*FileStore) List ¶
List returns all keys in the store.
func (*FileStore) Read ¶
Read reads the data from the file named key.
func (*FileStore) Write ¶
Write writes the given data to a file named key.
type Store ¶
type Store interface { // key must contain one or more characters in [A-Za-z0-9] // Write writes data with key. Write(key string, data []byte) error // Read retrieves data with key // Read must return ErrKeyNotFound if key is not found. Read(key string) ([]byte, error) // Delete deletes data by key // Delete must not return error if key does not exist Delete(key string) error // List lists all existing keys. List() ([]string, error) }
Store provides the interface for storing keyed data. Store must be thread-safe
func NewFileStore ¶
func NewFileStore(path string, fs utilfs.Filesystem) (Store, error)
NewFileStore returns an instance of FileStore.
Source Files ¶
doc.go filestore.go store.go
- Version
- v1.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 3 hours ago –
Tools for package owners.