Documentation
¶
Index ¶
- Constants
- func UnmarshalCancel(raw []byte) (apiv1.Cancel, error)
- type HeaderCarrier
- type Manager
- func (m *Manager) Close()
- func (m *Manager) Connect(ctx context.Context) error
- func (m *Manager) Healthcheck(ctx context.Context) error
- func (m *Manager) PublishCancel(ctx context.Context, source, opID, reason string) error
- func (m *Manager) PublishOperationUpdate(ctx context.Context, opID string) error
- func (m *Manager) SubscribeCancel(ctx context.Context, opID string, handler func(req apiv1.Cancel)) error
- func (m *Manager) SubscribeOperationUpdate(ctx context.Context, opID string) (<-chan jetstream.Msg, func(), error)
- type ManagerConfig
Constants ¶
const ( TypeLog = "dev.cvewatcher.mulval.operation.log" TypeSucceeded = "dev.cvewatcher.mulval.operation.succeeded" TypeFailed = "dev.cvewatcher.mulval.operation.failed" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HeaderCarrier ¶
HeaderCarrier adapts nats.Header to the TextMapCarrier interface so OpenTelemetry can inject and extract trace context
func (HeaderCarrier) Get ¶
func (c HeaderCarrier) Get(key string) string
func (HeaderCarrier) Keys ¶
func (c HeaderCarrier) Keys() []string
func (HeaderCarrier) Set ¶
func (c HeaderCarrier) Set(key, value string)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager wraps a NATS connection and JetStream context. It provisions the required streams and KV bucket on first connect and re-provisions on reconnect.
func NewManager ¶
func NewManager(ctx context.Context, config ManagerConfig) (*Manager, error)
func (*Manager) Close ¶
func (m *Manager) Close()
Close drains and closes the underlying NATS connection.
func (*Manager) Connect ¶
Connect establishes the NATS connection and provisions streams. Reconnection is handled automatically by the NATS client with callbacks that re-provision streams (idempotent) and update metrics.
func (*Manager) Healthcheck ¶
Healthcheck verifies the NATS connection and JetStream availability. It checks the connection status and performs a lightweight JetStream API call (AccountInfo)to confirm the server is reachable and JetStream is enabled.* Returns nil if healthy.
func (*Manager) PublishCancel ¶
PublishCancel wraps a CancelRequest in a CloudEvent and publishes it to the cancel stream with Nats-Msg-Id deduplication.