debug

package
v0.0.0-...-113b215 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0, BSD-2-Clause Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandNames = map[Command]string{
	ShutdownCommand:     "Shutdown",
	IterateCommand:      "Iterate",
	IterateKeysCommand:  "IterateKeys",
	ClearCommand:        "Clear",
	GetCommand:          "Get",
	SetCommand:          "Set",
	HasCommand:          "Has",
	DeleteCommand:       "Delete",
	DeletePrefixCommand: "DeletePrefix",
}

CommandNames contains a map from the command to its human-readable name.

Functions

func New

func New(store kvstore.KVStore, callback AccessCallback, commandsFilter ...Command) kvstore.KVStore

New creates a new KVStore with debug callbacks. This can for example be used for debugging and to examine what the KVStore is doing. store is the underlying store to which all methods will be forwarded. callback will be called for all requests to the KVStore. commandsFilter optional filter to only report certain requests to the callback.

Types

type AccessCallback

type AccessCallback func(command Command, parameters ...[]byte)

AccessCallback is the type of the callback function that can be used to hook the access to the callback.

type Command

type Command = bitmask.BitMask

Command is a type that represents a specific method in the KVStore.

const (
	// IterateCommand represents a call to the Iterate method of the store.
	IterateCommand Command = 1 << iota

	// IterateKeysCommand represents a call to the IterateKeys method of the store.
	IterateKeysCommand

	// ClearCommand represents a call to the Clear method of the store.
	ClearCommand

	// GetCommand represents a call to the Get method of the store.
	GetCommand

	// SetCommand represents a call to the Set method of the store.
	SetCommand

	// HasCommand represents a call to the Has method of the store.
	HasCommand

	// DeleteCommand represents a call to the Delete method of the store.
	DeleteCommand

	// DeletePrefixCommand represents a call to the DeletePrefix method of the store.
	DeletePrefixCommand

	// AllCommands represents the collection of all commands.
	AllCommands = IterateCommand | IterateKeysCommand | ClearCommand | GetCommand | SetCommand | HasCommand | DeleteCommand | DeletePrefixCommand

	// ShutdownCommand represents a call to the Shutdown method of the store.
	ShutdownCommand Command = 0
)

Jump to

Keyboard shortcuts

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