Documentation ¶
Overview ¶
Package lite implements SQLite backend used for local persistent caches in proxies and nodes and for standalone auth service deployments.
Index ¶
- Constants
- func GetName() string
- type Backend
- func (l *Backend) AtomicWrite(ctx context.Context, condacts []backend.ConditionalAction) (revision string, err error)
- func (l *Backend) Clock() clockwork.Clock
- func (l *Backend) Close() error
- func (l *Backend) CloseWatchers()
- func (l *Backend) CompareAndSwap(ctx context.Context, expected backend.Item, replaceWith backend.Item) (*backend.Lease, error)
- func (l *Backend) ConditionalDelete(ctx context.Context, key []byte, revision string) error
- func (l *Backend) ConditionalUpdate(ctx context.Context, i backend.Item) (*backend.Lease, error)
- func (l *Backend) Create(ctx context.Context, i backend.Item) (*backend.Lease, error)
- func (l *Backend) Delete(ctx context.Context, key []byte) error
- func (l *Backend) DeleteRange(ctx context.Context, startKey, endKey []byte) error
- func (l *Backend) Get(ctx context.Context, key []byte) (*backend.Item, error)
- func (l *Backend) GetName() string
- func (l *Backend) GetRange(ctx context.Context, startKey []byte, endKey []byte, limit int) (*backend.GetResult, error)
- func (l *Backend) KeepAlive(ctx context.Context, lease backend.Lease, expires time.Time) error
- func (l *Backend) NewWatcher(ctx context.Context, watch backend.Watch) (backend.Watcher, error)
- func (l *Backend) Put(ctx context.Context, i backend.Item) (*backend.Lease, error)
- func (l *Backend) SetClock(clock clockwork.Clock)
- func (l *Backend) Update(ctx context.Context, i backend.Item) (*backend.Lease, error)
- type Config
Constants ¶
const ( // BackendName is the name of this backend. BackendName = "sqlite" // AlternativeName is another name of this backend. AlternativeName = "dir" // SyncFull fsyncs the database file on disk after every write. SyncFull = "FULL" // JournalMemory keeps the rollback journal in memory instead of storing it // on disk. JournalMemory = "MEMORY" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backend ¶
Backend uses SQLite to implement storage interfaces
func NewWithConfig ¶
NewWithConfig returns a new instance of lite backend using configuration struct as a parameter
func (*Backend) AtomicWrite ¶
func (*Backend) CloseWatchers ¶
func (l *Backend) CloseWatchers()
CloseWatchers closes all the watchers without closing the backend
func (*Backend) CompareAndSwap ¶
func (l *Backend) CompareAndSwap(ctx context.Context, expected backend.Item, replaceWith backend.Item) (*backend.Lease, error)
CompareAndSwap compares item with existing item and replaces is with replaceWith item
func (*Backend) ConditionalDelete ¶
func (*Backend) ConditionalUpdate ¶
func (*Backend) DeleteRange ¶
DeleteRange deletes range of items with keys between startKey and endKey Note that elements deleted by range do not produce any events
func (*Backend) GetRange ¶
func (l *Backend) GetRange(ctx context.Context, startKey []byte, endKey []byte, limit int) (*backend.GetResult, error)
GetRange returns query range
func (*Backend) NewWatcher ¶
NewWatcher returns a new event watcher
func (*Backend) Put ¶
Put puts value into backend (creates if it does not exist, updates it otherwise)
type Config ¶
type Config struct { // Path is a path to the database directory Path string `json:"path,omitempty"` // BufferSize is a default buffer size // used to pull events BufferSize int `json:"buffer_size,omitempty"` // PollStreamPeriod is a polling period for event stream PollStreamPeriod time.Duration `json:"poll_stream_period,omitempty"` // EventsOff turns events off EventsOff bool `json:"events_off,omitempty"` // Clock allows to override clock used in the backend Clock clockwork.Clock `json:"-"` // Sync sets the synchronous pragma Sync string `json:"sync,omitempty"` // BusyTimeout sets busy timeout in milliseconds BusyTimeout int `json:"busy_timeout,omitempty"` // Journal sets the journal_mode pragma Journal string `json:"journal,omitempty"` }
Config structure represents configuration section
func (*Config) CheckAndSetDefaults ¶
CheckAndSetDefaults is a helper returns an error if the supplied configuration is not enough to connect to sqlite
func (*Config) ConnectionURI ¶
ConnectionURI returns a connection string usable with sqlite according to the Config.