Files
osmedeus/internal/distributed/shared.go
T
j3ssie 1403d20a4d feat: add LLM step executor with vision and tool support, event workflow system, and inheritance
- Add LLM executor supporting OpenAI vision, tool calling, embeddings, and structured outputs
- Introduce event emitter/receiver workflows with deduplication and filtering (generate_event functions)
- Add workflow extends/override system enabling inheritance chains and step merge modes
- Update function naming to snake_case across all testdata (fileExists→file_exists, etc.)
- Add comprehensive test fixtures for linter, events, CDN, step dependencies, and extends workflows
2026-01-20 18:23:57 +08:00

45 lines
943 B
Go

package distributed
import (
"sync"
"github.com/j3ssie/osmedeus/v5/internal/config"
)
var (
sharedClient *Client
sharedOnce sync.Once
sharedErr error
)
// GetSharedClient returns a singleton Redis client for distributed mode.
// Returns nil if Redis is not configured.
func GetSharedClient() (*Client, error) {
cfg := config.Get()
if cfg == nil || !cfg.IsRedisConfigured() {
return nil, nil
}
sharedOnce.Do(func() {
sharedClient, sharedErr = NewClientFromConfig(cfg)
})
return sharedClient, sharedErr
}
// ResetSharedClient resets the shared client (useful for testing)
func ResetSharedClient() {
if sharedClient != nil {
sharedClient.Close()
}
sharedClient = nil
sharedOnce = sync.Once{}
sharedErr = nil
}
// SetSharedClient sets the shared client (useful for testing or custom initialization)
func SetSharedClient(client *Client) {
sharedClient = client
sharedOnce.Do(func() {}) // Mark as initialized
}