validation

package
v0.0.0-...-2b78ec0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NameCache

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

NameCache provides a cache for agent name validation results. It uses a worker to process validation requests from a queue.

func NewNameCache

func NewNameCache(chatCompletion chat.ChatCompletion) *NameCache

NewNameCache creates a new name cache with the given chat completion instance.

func NewNameCacheWithConcurrency

func NewNameCacheWithConcurrency(chatCompletion chat.ChatCompletion, concurrencyLimit int) *NameCache

NewNameCacheWithConcurrency creates a new name cache with the given chat completion instance and a specified concurrency limit for validation workers.

func (*NameCache) EnqueueForValidation

func (c *NameCache) EnqueueForValidation(name string)

EnqueueForValidation adds a name to the validation queue.

func (*NameCache) IsValid

func (c *NameCache) IsValid(name string) bool

IsValid checks if a name is valid according to the cache. If the name is not in the cache, it enqueues it for validation and returns false (considering it invalid until proven otherwise).

func (*NameCache) IsValidWithWait

func (c *NameCache) IsValidWithWait(ctx context.Context, name string) (bool, error)

IsValidWithWait checks if a name is valid according to the cache. If the name is not in the cache, it enqueues it for validation and waits for the validation to complete or until the context is done.

func (*NameCache) Run

func (c *NameCache) Run(ctx context.Context) error

Run starts the main validation worker in a goroutine. It returns after spawning so that you can manage it externally via context cancellation or wait-group.

func (*NameCache) SetValidity

func (c *NameCache) SetValidity(name string, valid bool)

SetValidity manually sets the validity of a name in the cache.

Jump to

Keyboard shortcuts

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