testkv

package
v1.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDebugBackend

func NewDebugBackend(backend ormtable.Backend, debugger Debugger) ormtable.Backend

NewDebugBackend wraps both stores from a Backend with a debugger.

func NewDebugStore

func NewDebugStore(store kv.Store, debugger Debugger, storeName string) kv.Store

NewDebugStore wraps the store with the debugger instance returning a debug store wrapper.

func NewSharedMemBackend

func NewSharedMemBackend() ormtable.Backend

NewSharedMemBackend returns a Backend instance which uses a single backing memory store to simulate legacy scenarios where only a single KV-store is available to modules.

func NewSplitMemBackend

func NewSplitMemBackend() ormtable.Backend

NewSplitMemBackend returns a Backend instance which uses two separate memory stores to simulate behavior when there are really two separate backing stores.

Types

type Debugger

type Debugger interface {

	// Log logs a single log message.
	Log(string)

	// Decode decodes a key-value entry into a debug string.
	Decode(key, value []byte) string
}

Debugger is an interface that handles debug info from the debug store wrapper.

type EntryCodecDebugger

type EntryCodecDebugger struct {
	EntryCodec ormkv.EntryCodec
	Print      func(string)
}

EntryCodecDebugger is a Debugger instance that uses an EntryCodec and Print function for debugging.

func (*EntryCodecDebugger) Decode

func (d *EntryCodecDebugger) Decode(key, value []byte) string

func (*EntryCodecDebugger) Log

func (d *EntryCodecDebugger) Log(s string)

Jump to

Keyboard shortcuts

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