Documentation
¶
Index ¶
- type AddNeuronRequest
- type BrainWorker
- func (w *BrainWorker) Matrix() *core.Matrix
- func (w *BrainWorker) SetSentimentAnalyzer(a *sentiment.Analyzer)
- func (w *BrainWorker) SetVectorizer(v *vector.Vectorizer, alpha float64, queryRepeat int)
- func (w *BrainWorker) Stats() map[string]any
- func (w *BrainWorker) Stop()
- func (w *BrainWorker) Submit(op *Operation) (any, error)
- func (w *BrainWorker) SubmitAsync(op *Operation)
- type ListNeuronsRequest
- type OpType
- type Operation
- type SearchRequest
- type UpdateNeuronRequest
- type WorkerPool
- func (p *WorkerPool) ActiveCount() int
- func (p *WorkerPool) Evict(indexID core.IndexID) error
- func (p *WorkerPool) ForEach(fn func(core.IndexID, *BrainWorker))
- func (p *WorkerPool) Get(indexID core.IndexID) (*BrainWorker, error)
- func (p *WorkerPool) GetOrCreate(indexID core.IndexID) (*BrainWorker, error)
- func (p *WorkerPool) ListIndexes() []string
- func (p *WorkerPool) PersistAll() error
- func (p *WorkerPool) SetMaxIdleTime(d time.Duration)
- func (p *WorkerPool) SetMaxNeurons(max int)
- func (p *WorkerPool) SetSentimentAnalyzer(a *sentiment.Analyzer)
- func (p *WorkerPool) SetVectorAlpha(alpha float64)
- func (p *WorkerPool) SetVectorizer(v *vector.Vectorizer, alpha float64)
- func (p *WorkerPool) SetVectorizerWithRepeat(v *vector.Vectorizer, alpha float64, queryRepeat int)
- func (p *WorkerPool) Shutdown() error
- func (p *WorkerPool) Stats() map[string]any
- func (p *WorkerPool) Truncate(indexID core.IndexID) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddNeuronRequest ¶
Request types
type BrainWorker ¶
type BrainWorker struct {
// contains filtered or unexported fields
}
BrainWorker is a dedicated goroutine per user brain
func NewBrainWorker ¶
func NewBrainWorker(indexID core.IndexID, matrix *core.Matrix) *BrainWorker
NewBrainWorker creates a new worker for a user
func (*BrainWorker) Matrix ¶
func (w *BrainWorker) Matrix() *core.Matrix
Matrix returns the underlying matrix
func (*BrainWorker) SetSentimentAnalyzer ¶
func (w *BrainWorker) SetSentimentAnalyzer(a *sentiment.Analyzer)
SetSentimentAnalyzer attaches a sentiment analyzer to the underlying engine for auto-labeling on write and sentiment-aware scoring on search.
func (*BrainWorker) SetVectorizer ¶
func (w *BrainWorker) SetVectorizer(v *vector.Vectorizer, alpha float64, queryRepeat int)
SetVectorizer attaches a vectorizer to the underlying engine for auto-embedding on write and hybrid scoring on search.
func (*BrainWorker) Submit ¶
func (w *BrainWorker) Submit(op *Operation) (any, error)
Submit queues an operation and waits for result
func (*BrainWorker) SubmitAsync ¶
func (w *BrainWorker) SubmitAsync(op *Operation)
SubmitAsync queues an operation without waiting
type ListNeuronsRequest ¶
type OpType ¶
type OpType int
Operation types for the worker
const ( // Brain-like naming (primary) OpWrite OpType = iota // Add/create neuron (memory formation) OpRead // Get neuron (memory retrieval) OpSearch // Search neurons (associative recall) OpTouch // Update neuron (memory modification) OpForget // Delete neuron (memory erasure) OpRecall // List neurons (memory scanning) OpFire // Activate neuron (neural firing) OpDecay // Energy decay (forgetting curve) OpConsolidate // Memory consolidation (depth increase) OpPrune // Remove dead neurons (synaptic pruning) OpReorg // Reorganize matrix (neural plasticity) OpGetStats // Get statistics OpShutdown // Shutdown worker )
type SearchRequest ¶
type UpdateNeuronRequest ¶
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool manages all brain workers with isolation
func NewWorkerPool ¶
func NewWorkerPool(store *persistence.Store, bounds core.MatrixBounds) *WorkerPool
NewWorkerPool creates a new worker pool
func (*WorkerPool) ActiveCount ¶
func (p *WorkerPool) ActiveCount() int
ActiveCount returns number of active workers
func (*WorkerPool) Evict ¶
func (p *WorkerPool) Evict(indexID core.IndexID) error
Evict removes a worker and persists its state
func (*WorkerPool) ForEach ¶
func (p *WorkerPool) ForEach(fn func(core.IndexID, *BrainWorker))
ForEach executes a function on each worker
func (*WorkerPool) Get ¶
func (p *WorkerPool) Get(indexID core.IndexID) (*BrainWorker, error)
Get returns existing worker or nil
func (*WorkerPool) GetOrCreate ¶
func (p *WorkerPool) GetOrCreate(indexID core.IndexID) (*BrainWorker, error)
GetOrCreate returns existing worker or creates new one
func (*WorkerPool) ListIndexes ¶
func (p *WorkerPool) ListIndexes() []string
ListIndexes returns all active index IDs
func (*WorkerPool) PersistAll ¶
func (p *WorkerPool) PersistAll() error
PersistAll persists all active workers
func (*WorkerPool) SetMaxIdleTime ¶
func (p *WorkerPool) SetMaxIdleTime(d time.Duration)
SetMaxIdleTime updates the idle eviction threshold at runtime.
func (*WorkerPool) SetMaxNeurons ¶
func (p *WorkerPool) SetMaxNeurons(max int)
SetMaxNeurons updates matrix capacity bounds for active and future indexes.
func (*WorkerPool) SetSentimentAnalyzer ¶
func (p *WorkerPool) SetSentimentAnalyzer(a *sentiment.Analyzer)
SetSentimentAnalyzer attaches a global sentiment analyzer to the pool. All existing and future workers will use it.
func (*WorkerPool) SetVectorAlpha ¶
func (p *WorkerPool) SetVectorAlpha(alpha float64)
SetVectorAlpha updates the vector alpha used by existing and future workers.
func (*WorkerPool) SetVectorizer ¶
func (p *WorkerPool) SetVectorizer(v *vector.Vectorizer, alpha float64)
SetVectorizer attaches a global vectorizer to the pool. All existing and future workers will use it.
func (*WorkerPool) SetVectorizerWithRepeat ¶
func (p *WorkerPool) SetVectorizerWithRepeat(v *vector.Vectorizer, alpha float64, queryRepeat int)
SetVectorizerWithRepeat attaches a global vectorizer with explicit query repeat count.
func (*WorkerPool) Shutdown ¶
func (p *WorkerPool) Shutdown() error
Shutdown gracefully shuts down all workers
func (*WorkerPool) Stats ¶
func (p *WorkerPool) Stats() map[string]any
Stats returns pool statistics