Documentation
¶
Index ¶
Constants ¶
const ( // Default applies when callers omit a namespace. Default = "default" // MaxLength caps the length of namespaces, queue names, and key segments. MaxLength = 128 )
Variables ¶
This section is empty.
Functions ¶
func NormalizeComponent ¶
NormalizeComponent lowercases and validates a single name component.
func NormalizeKey ¶
NormalizeKey lowercases and validates a lock key. Keys may contain '/' to denote hierarchical segments; each segment must satisfy NormalizeComponent.
Types ¶
type Config ¶
type Config struct {
Query QueryEngines `json:"query"`
}
Config captures namespace-level configuration.
func ConfigFromProto ¶
func ConfigFromProto(msg *lockdproto.NamespaceConfig) Config
ConfigFromProto converts the protobuf namespace config into the Go struct.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default namespace configuration.
func (*Config) Normalize ¶
func (c *Config) Normalize()
Normalize applies default values for unset fields.
func (Config) SelectEngine ¶
func (c Config) SelectEngine(hint search.EngineHint, caps search.Capabilities) (search.EngineHint, error)
SelectEngine determines the engine to use for the namespace based on the provided hint and actual adapter capabilities.
func (Config) ToProto ¶
func (c Config) ToProto() *lockdproto.NamespaceConfig
ToProto converts the config into the protobuf representation.
type ConfigLoadResult ¶
ConfigLoadResult captures a namespace config and its ETag.
type ConfigProvider ¶
type ConfigProvider interface {
DefaultNamespaceConfig() Config
}
ConfigProvider exposes the default namespace configuration for backends.
type ConfigStore ¶
type ConfigStore struct {
// contains filtered or unexported fields
}
ConfigStore persists namespace configuration documents inside the storage backend.
func NewConfigStore ¶
func NewConfigStore(backend storage.Backend, crypto *storage.Crypto, logger pslog.Logger, defaultCfg Config) *ConfigStore
NewConfigStore builds a ConfigStore backed by backend. When backend is nil a nil store is returned.
func (*ConfigStore) Default ¶
func (s *ConfigStore) Default() Config
Default returns the store's default namespace configuration.
func (*ConfigStore) Load ¶
func (s *ConfigStore) Load(ctx context.Context, namespace string) (ConfigLoadResult, error)
Load retrieves the namespace config and its ETag. When no config exists the default configuration is returned with an empty ETag.
type FallbackMode ¶
type FallbackMode string
FallbackMode determines how queries behave when the preferred engine is unavailable.
const ( // FallbackScan allows queries to fall back to the scan engine. FallbackScan FallbackMode = "scan" // FallbackNone disables fallback; queries fail if the preferred engine is unavailable. FallbackNone FallbackMode = "none" )
type QueryEngines ¶
type QueryEngines struct {
Preferred search.EngineHint `json:"preferred_engine"`
Fallback FallbackMode `json:"fallback_engine"`
}
QueryEngines describes the preferred and fallback engines for /v1/query.