Help us shape the future of Go! Take the 2026 Go Developer Survey

store

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventAdded    = "ADDED"
	EventModified = "MODIFIED"
	EventDeleted  = "DELETED"
	EventBookmark = "BOOKMARK"
	EventError    = "ERROR"
)

Variables

This section is empty.

Functions

func KeyFor

func KeyFor(group, resource, namespace, name string) string

func ParseKey

func ParseKey(key string) (group, resource, namespace, name string, err error)

Types

type Lease

type Lease struct {
	ID        int64
	TTL       time.Duration
	Keys      []string
	ExpiresAt time.Time
}

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Close

func (s *MemoryStore) Close() error

func (*MemoryStore) Compact

func (s *MemoryStore) Compact(beforeRevision int64) error

func (*MemoryStore) CurrentRevision

func (s *MemoryStore) CurrentRevision() int64

func (*MemoryStore) Delete

func (s *MemoryStore) Delete(key string) error

func (*MemoryStore) Get

func (s *MemoryStore) Get(key string) (*StoredObject, error)

func (*MemoryStore) List

func (s *MemoryStore) List(prefix string) ([]*StoredObject, error)

func (*MemoryStore) Put

func (s *MemoryStore) Put(key string, obj *StoredObject) error

func (*MemoryStore) Unwatch

func (s *MemoryStore) Unwatch(ch <-chan WatchEvent)

func (*MemoryStore) Watch

func (s *MemoryStore) Watch(prefix string, sinceRevision int64) (<-chan WatchEvent, error)

type SQLiteStore added in v0.11.0

type SQLiteStore struct {
	// contains filtered or unexported fields
}

func NewSQLiteStore added in v0.11.0

func NewSQLiteStore(path string) (*SQLiteStore, error)

func (*SQLiteStore) Close added in v0.11.0

func (s *SQLiteStore) Close() error

func (*SQLiteStore) Compact added in v0.11.0

func (s *SQLiteStore) Compact(beforeRevision int64) error

func (*SQLiteStore) CurrentRevision added in v0.11.0

func (s *SQLiteStore) CurrentRevision() int64

func (*SQLiteStore) Delete added in v0.11.0

func (s *SQLiteStore) Delete(key string) error

func (*SQLiteStore) Get added in v0.11.0

func (s *SQLiteStore) Get(key string) (*StoredObject, error)

func (*SQLiteStore) List added in v0.11.0

func (s *SQLiteStore) List(prefix string) ([]*StoredObject, error)

func (*SQLiteStore) Put added in v0.11.0

func (s *SQLiteStore) Put(key string, obj *StoredObject) error

func (*SQLiteStore) Unwatch added in v0.11.0

func (s *SQLiteStore) Unwatch(ch <-chan WatchEvent)

func (*SQLiteStore) Watch added in v0.11.0

func (s *SQLiteStore) Watch(prefix string, sinceRevision int64) (<-chan WatchEvent, error)

type Store

type Store interface {
	Get(key string) (*StoredObject, error)
	Put(key string, obj *StoredObject) error
	Delete(key string) error
	List(prefix string) ([]*StoredObject, error)
	Watch(prefix string, sinceRevision int64) (<-chan WatchEvent, error)
	Unwatch(ch <-chan WatchEvent)
	CurrentRevision() int64
	Compact(beforeRevision int64) error
	Close() error
}

type StoredObject

type StoredObject struct {
	Key            string          `json:"key"`
	Value          json.RawMessage `json:"value"`
	Revision       int64           `json:"revision"`
	ModRevision    int64           `json:"mod_revision"`
	CreateRevision int64           `json:"create_revision"`
	Version        int64           `json:"version"`
	Lease          int64           `json:"lease,omitempty"`
	Deleted        bool            `json:"deleted,omitempty"`
}

type WatchEvent

type WatchEvent struct {
	Type   string        `json:"type"`
	Object *StoredObject `json:"object"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL