Documentation
¶
Index ¶
- Variables
- func ClearCurrent()
- func ConfigFromJWT(ctx context.Context, rawJWT string) (config.HomeConfig, error)
- func HashKeyPart(value string) string
- func KVDelBestEffort(ctx context.Context, keys ...string) bool
- func KVDelRequired(ctx context.Context, keys ...string) (bool, int64, error)
- func KVExpireBestEffort(ctx context.Context, key string, ttl time.Duration) bool
- func KVExpireRequired(ctx context.Context, key string, ttl time.Duration) (bool, error)
- func KVGetJSONBestEffort(ctx context.Context, key string, out any) (bool, bool)
- func KVGetJSONRequired(ctx context.Context, key string, out any) (bool, bool, error)
- func KVSetBytesBestEffort(ctx context.Context, key string, value []byte, ttl time.Duration) bool
- func KVSetBytesRequired(ctx context.Context, key string, value []byte, ttl time.Duration) (bool, error)
- func KVSetJSONBestEffort(ctx context.Context, key string, value any, ttl time.Duration) bool
- func KVSetJSONRequired(ctx context.Context, key string, value any, ttl time.Duration) (bool, error)
- func KVSetNXBestEffort(ctx context.Context, key string, value []byte, ttl time.Duration) bool
- func KVSetNXRequired(ctx context.Context, key string, value []byte, ttl time.Duration) (bool, bool, error)
- func SetCurrent(client *Client)
- type Client
- func (c *Client) Close()
- func (c *Client) Enabled() bool
- func (c *Client) GetConfig(ctx context.Context) ([]byte, error)
- func (c *Client) GetModels(ctx context.Context, headers http.Header, query url.Values) ([]byte, error)
- func (c *Client) GetRefreshAuth(ctx context.Context, authIndex string) ([]byte, error)
- func (c *Client) HeartbeatOK() bool
- func (c *Client) KVDel(ctx context.Context, keys ...string) (int64, error)
- func (c *Client) KVExpire(ctx context.Context, key string, ttl time.Duration) (bool, error)
- func (c *Client) KVGet(ctx context.Context, key string) ([]byte, bool, error)
- func (c *Client) KVIncrBy(ctx context.Context, key string, delta int64) (int64, error)
- func (c *Client) KVMGet(ctx context.Context, keys ...string) ([][]byte, []bool, error)
- func (c *Client) KVMSet(ctx context.Context, pairs map[string][]byte) error
- func (c *Client) KVSet(ctx context.Context, key string, value []byte, opts KVSetOptions) (bool, error)
- func (c *Client) KVSetNX(ctx context.Context, key string, value []byte, ttl time.Duration) (bool, error)
- func (c *Client) KVTTL(ctx context.Context, key string) (time.Duration, bool, error)
- func (c *Client) LPushUsage(ctx context.Context, payload []byte) error
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) RPopAuth(ctx context.Context, requestedModel string, sessionID string, ...) ([]byte, error)
- func (c *Client) RPushAppLog(ctx context.Context, payload []byte) error
- func (c *Client) RPushRequestLog(ctx context.Context, payload []byte) error
- func (c *Client) StartConfigSubscriber(ctx context.Context, onConfig func([]byte) error)
- type KVSetOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDisabled = errors.New("home client disabled") ErrNotConnected = errors.New("home not connected") ErrEmptyResponse = errors.New("home returned empty response") ErrAuthNotFound = errors.New("home auth not found") ErrConfigNotFound = errors.New("home config not found") ErrModelsNotFound = errors.New("home models not found") )
Functions ¶
func ConfigFromJWT ¶ added in v7.1.12
ConfigFromJWT prepares a Home config from the JWT and ensures local mTLS files exist.
func HashKeyPart ¶ added in v7.2.0
func KVDelBestEffort ¶ added in v7.2.0
func KVDelRequired ¶ added in v7.2.0
func KVExpireBestEffort ¶ added in v7.2.0
func KVExpireRequired ¶ added in v7.2.0
func KVGetJSONBestEffort ¶ added in v7.2.0
func KVGetJSONRequired ¶ added in v7.2.0
func KVSetBytesBestEffort ¶ added in v7.2.0
func KVSetBytesRequired ¶ added in v7.2.0
func KVSetJSONBestEffort ¶ added in v7.2.0
func KVSetJSONRequired ¶ added in v7.2.0
func KVSetNXBestEffort ¶ added in v7.2.0
func KVSetNXRequired ¶ added in v7.2.0
func SetCurrent ¶
func SetCurrent(client *Client)
SetCurrent sets the active home client used by runtime integrations.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func CurrentKVClient ¶ added in v7.2.0
func New ¶
func New(homeCfg config.HomeConfig) *Client
func (*Client) GetRefreshAuth ¶
func (*Client) HeartbeatOK ¶
func (*Client) RPushAppLog ¶ added in v7.1.29
func (*Client) RPushRequestLog ¶
func (*Client) StartConfigSubscriber ¶
StartConfigSubscriber connects to home, fetches config once via GET config, then subscribes to the "config" channel to receive runtime config updates.
The subscription connection is treated as the home heartbeat. HeartbeatOK is set to true only after the initial GET config succeeds and the SUBSCRIBE connection is established. When the subscription ends unexpectedly, HeartbeatOK becomes false and the loop reconnects.
Click to show internal directories.
Click to hide internal directories.