kiwiTree

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidPatternSrc indicates the source string to create a Pattern is invalid.
	ErrInvalidPatternSrc = errors.New("invalid pattern source")

	// ErrInternal indicates some unexpected internal failure.
	ErrInternal = errors.New("internal failure")

	// ErrNotFound indicates the specified Matcher was not found in the underlying storage.
	ErrNotFound = errors.New("not found")

	// ErrShouldRetry indicates a storage entity is locked and the operation should be retried.
	ErrShouldRetry = errors.New("retry the operation")
)

Functions

This section is empty.

Types

type Service

type Service interface {

	// Create creates a new key/pattern pair and registers it. Repeating the same Create call yields the same state.
	// Returns ErrShouldRetry when the corresponding entity in the underlying storage is temporarily locked.
	Create(ctx context.Context, k string, pattern string) (err error)

	// LockCreate sets a lock in the underlying storage to prevent the creation of the same key/pattern pair.
	// Returns ErrNotFound if the specified pattern is not present.
	LockCreate(ctx context.Context, k string, pattern string) (err error)

	// UnlockCreate unsets the lock set by LockCreate, if any. Otherwise, the result depends on the underlying
	// storage implementation.
	UnlockCreate(ctx context.Context, k string, pattern string) (err error)

	// Delete removes a specified key/pattern from the underlying storage.
	// Returns ErrNotFound when the specified model.MatcherData is missing in the underlying storage.
	Delete(ctx context.Context, k string, pattern string) (err error)
}

Service represents the kiwi-tree service.

func NewLoggingMiddleware

func NewLoggingMiddleware(svc Service, log *slog.Logger) Service

func NewService

func NewService(client kiwiTree.ServiceClient) Service

func NewServiceMock

func NewServiceMock() Service

Jump to

Keyboard shortcuts

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