Documentation
¶
Index ¶
- Constants
- Variables
- func ClearCurrent()
- func ClearCurrentIf(client *Client)
- func ConfigFromJWT(ctx context.Context, rawJWT string) (config.HomeConfig, error)
- func HashKeyPart(value string) string
- func IsAmbiguousDispatchError(err error) bool
- 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 NewAmbiguousDispatchError(err error) error
- func NewReleaseFlusher(configProvider func() internalconfig.CredentialConcurrencyConfig, ...) *releaseFlusher
- func ReportPluginStatus(ctx context.Context, client PluginStatusClient, nodeID string, ...) error
- func SetCurrent(client *Client)
- type Client
- func (c *Client) AbortAmbiguousDispatch()
- 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) GetPluginSync(ctx context.Context, request pluginstore.PluginSyncRequest) (pluginstore.PluginSyncResponse, error)
- func (c *Client) GetPluginTasks(ctx context.Context) ([]PluginTask, error)
- func (c *Client) GetRefreshAuth(ctx context.Context, authIndex string) ([]byte, error)
- func (c *Client) HeartbeatOK() bool
- func (c *Client) KVCompareAndSwap(ctx context.Context, key string, expected []byte, expectedExists bool, ...) (bool, error)
- 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) LPushInFlightSnapshot(ctx context.Context, payload []byte) error
- func (c *Client) LPushUsage(ctx context.Context, payload []byte) error
- func (c *Client) LimiterConfig() config.CredentialConcurrencyConfig
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) PushConcurrencyRelease(ctx context.Context, frame ConcurrencyReleaseFrame) 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) RPushPluginStatus(ctx context.Context, payload []byte) error
- func (c *Client) RPushRequestLog(ctx context.Context, payload []byte) error
- func (c *Client) RunConfigSubscriberLifetime(ctx context.Context, onConfig func([]byte) error, onReady func()) error
- func (c *Client) SetLifecycleConfig(cfg config.CredentialConcurrencyConfig) error
- func (c *Client) SetManagedLifetime(managed bool)
- func (c *Client) StartConfigSubscriber(ctx context.Context, onConfig func([]byte) error)
- type ConcurrencyReleaseFrame
- type DispatchError
- type InFlightAccountedStatus
- type InFlightAggregate
- type InFlightFrameKind
- type InFlightRequestDetail
- type InFlightSnapshotFrame
- type KVSetOptions
- type PluginStatusClient
- type PluginTask
Constants ¶
const ( InFlightFramePart InFlightFrameKind = "part" InFlightFrameOverflow InFlightFrameKind = "overflow" InFlightAccounted InFlightAccountedStatus = "accounted" InFlightUnaccounted InFlightAccountedStatus = "unaccounted" )
Variables ¶
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") ErrPluginSyncUnsupported = errors.New("home plugin sync is unsupported") ErrDispatchFenced = errors.New("home auth dispatch is fenced") )
Functions ¶
func ClearCurrentIf ¶ added in v7.2.96
func ClearCurrentIf(client *Client)
ClearCurrentIf removes the active client only when it is client.
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 IsAmbiguousDispatchError ¶ added in v7.2.96
IsAmbiguousDispatchError reports whether Home may have processed the dispatch request.
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 NewAmbiguousDispatchError ¶ added in v7.2.96
NewAmbiguousDispatchError marks a post-send transport failure as requiring a client abort.
func NewReleaseFlusher ¶ added in v7.2.96
func NewReleaseFlusher(configProvider func() internalconfig.CredentialConcurrencyConfig, send func(context.Context, ConcurrencyReleaseFrame) error) *releaseFlusher
NewReleaseFlusher creates a flusher that reads timing updates from the current limiter configuration.
func ReportPluginStatus ¶ added in v7.2.33
func ReportPluginStatus(ctx context.Context, client PluginStatusClient, nodeID string, report homeplugins.SyncReport) error
ReportPluginStatus marshals the given report, sets NodeID and UpdatedAt, and pushes it to the provided client with a timeout.
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) AbortAmbiguousDispatch ¶ added in v7.2.96
func (c *Client) AbortAmbiguousDispatch()
AbortAmbiguousDispatch fences this client after an auth dispatch response is ambiguous.
func (*Client) Close ¶
func (c *Client) Close()
Close permanently ends this client's dispatch lifetime.
func (*Client) GetPluginSync ¶ added in v7.2.82
func (c *Client) GetPluginSync(ctx context.Context, request pluginstore.PluginSyncRequest) (pluginstore.PluginSyncResponse, error)
func (*Client) GetPluginTasks ¶ added in v7.2.32
func (c *Client) GetPluginTasks(ctx context.Context) ([]PluginTask, error)
func (*Client) GetRefreshAuth ¶
func (*Client) HeartbeatOK ¶
func (*Client) KVCompareAndSwap ¶ added in v7.2.85
func (c *Client) KVCompareAndSwap(ctx context.Context, key string, expected []byte, expectedExists bool, value []byte, ttl time.Duration) (bool, error)
KVCompareAndSwap atomically replaces a value only when its current state matches the expected state.
func (*Client) LPushInFlightSnapshot ¶ added in v7.2.96
LPushInFlightSnapshot publishes a bounded in-flight observation frame.
func (*Client) LimiterConfig ¶ added in v7.2.96
func (c *Client) LimiterConfig() config.CredentialConcurrencyConfig
LimiterConfig returns the latest immutable, validated Home limiter configuration.
func (*Client) PushConcurrencyRelease ¶ added in v7.2.96
func (c *Client) PushConcurrencyRelease(ctx context.Context, frame ConcurrencyReleaseFrame) error
PushConcurrencyRelease sends one cumulative concurrency release frame through an independent client.
func (*Client) RPushAppLog ¶ added in v7.1.29
func (*Client) RPushPluginStatus ¶ added in v7.2.32
func (*Client) RPushRequestLog ¶
func (*Client) RunConfigSubscriberLifetime ¶ added in v7.2.96
func (c *Client) RunConfigSubscriberLifetime(ctx context.Context, onConfig func([]byte) error, onReady func()) error
RunConfigSubscriberLifetime runs one GET, SUBSCRIBE, and receive lifetime. Reconnection is owned by the service so each replacement can install a new client lifetime.
func (*Client) SetLifecycleConfig ¶ added in v7.2.96
func (c *Client) SetLifecycleConfig(cfg config.CredentialConcurrencyConfig) error
func (*Client) SetManagedLifetime ¶ added in v7.2.96
SetManagedLifetime defers client shutdown to the Service lifetime owner.
type ConcurrencyReleaseFrame ¶ added in v7.2.96
type ConcurrencyReleaseFrame struct {
CredentialID string `json:"credential_id"`
Model string `json:"model"`
ReleaseSeq int64 `json:"release_seq"`
}
ConcurrencyReleaseFrame is the cumulative release accepted by Home for one credential and model.
type DispatchError ¶ added in v7.2.96
DispatchError classifies whether Home may have processed an auth dispatch request.
func (*DispatchError) Error ¶ added in v7.2.96
func (e *DispatchError) Error() string
func (*DispatchError) Unwrap ¶ added in v7.2.96
func (e *DispatchError) Unwrap() error
type InFlightAccountedStatus ¶ added in v7.2.96
type InFlightAccountedStatus string
type InFlightAggregate ¶ added in v7.2.96
type InFlightAggregate struct {
CredentialID string `json:"credential_id"`
Model string `json:"model"`
Status InFlightAccountedStatus `json:"status"`
Count int64 `json:"count"`
}
type InFlightFrameKind ¶ added in v7.2.96
type InFlightFrameKind string
type InFlightRequestDetail ¶ added in v7.2.96
type InFlightSnapshotFrame ¶ added in v7.2.96
type InFlightSnapshotFrame struct {
Kind InFlightFrameKind `json:"kind"`
Revision int64 `json:"revision"`
ObservedAt time.Time `json:"observed_at"`
BarrierRevision int64 `json:"barrier_revision"`
PartIndex *int `json:"part_index,omitempty"`
PartCount *int `json:"part_count,omitempty"`
DetailsTruncated bool `json:"details_truncated,omitempty"`
Aggregates []InFlightAggregate `json:"aggregates,omitempty"`
Details []InFlightRequestDetail `json:"details,omitempty"`
AggregateGroupCount int `json:"aggregate_group_count,omitempty"`
}
type KVSetOptions ¶ added in v7.2.0
type PluginStatusClient ¶ added in v7.2.33
PluginStatusClient defines the interface for pushing plugin status reports.
type PluginTask ¶ added in v7.2.32
type PluginTask struct {
ID uint `json:"id"`
Operation string `json:"operation"`
PluginID string `json:"plugin_id"`
TargetNodeType string `json:"target_node_type,omitempty"`
TargetNodeID string `json:"target_node_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}