chore: align slurp config and scaffolding

This commit is contained in:
anthonyrawlins
2025-09-27 21:03:12 +10:00
parent acc4361463
commit 4a77862289
47 changed files with 5133 additions and 4274 deletions

View File

@@ -3,18 +3,19 @@ package storage
import (
"context"
"fmt"
"strings"
"sync"
"time"
"chorus/pkg/ucxl"
slurpContext "chorus/pkg/slurp/context"
"chorus/pkg/ucxl"
)
// BatchOperationsImpl provides efficient batch operations for context storage
type BatchOperationsImpl struct {
contextStore *ContextStoreImpl
batchSize int
maxConcurrency int
contextStore *ContextStoreImpl
batchSize int
maxConcurrency int
operationTimeout time.Duration
}
@@ -22,8 +23,8 @@ type BatchOperationsImpl struct {
func NewBatchOperations(contextStore *ContextStoreImpl, batchSize, maxConcurrency int, timeout time.Duration) *BatchOperationsImpl {
return &BatchOperationsImpl{
contextStore: contextStore,
batchSize: batchSize,
maxConcurrency: maxConcurrency,
batchSize: batchSize,
maxConcurrency: maxConcurrency,
operationTimeout: timeout,
}
}
@@ -89,7 +90,7 @@ func (cs *ContextStoreImpl) BatchStore(
result.ErrorCount++
key := workResult.Item.Context.UCXLAddress.String()
result.Errors[key] = workResult.Error
if batch.FailOnError {
// Cancel remaining operations
result.ProcessingTime = time.Since(start)
@@ -164,11 +165,11 @@ func (cs *ContextStoreImpl) BatchRetrieve(
// Process results
for workResult := range resultsCh {
addressStr := workResult.Address.String()
if workResult.Error != nil {
result.ErrorCount++
result.Errors[addressStr] = workResult.Error
if batch.FailOnError {
// Cancel remaining operations
result.ProcessingTime = time.Since(start)