sysclient

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRequestTimeout = 60 * time.Second
)

Variables

View Source
var (
	ErrValidation      = errors.New("validation error")
	ErrInvalidServerID = errors.New("server with given ID does not exist")
)

Functions

This section is empty.

Types

type FetchOpt

type FetchOpt func(*FetchOpts) error

type FetchOpts

type FetchOpts struct {
	Timeout     time.Duration
	ReadTimeout time.Duration
	Expected    int
}

type HealthStatus

type HealthStatus int
const (
	StatusOK HealthStatus = iota
	StatusUnavailable
	StatusError
)

func (HealthStatus) MarshalJSON

func (hs HealthStatus) MarshalJSON() ([]byte, error)

func (HealthStatus) String

func (hs HealthStatus) String() string

func (*HealthStatus) UnmarshalJSON

func (hs *HealthStatus) UnmarshalJSON(data []byte) error

type Healthz

type Healthz struct {
	Status HealthStatus `json:"status"`
	Error  string       `json:"error,omitempty"`
}

type HealthzResp

type HealthzResp struct {
	Server  server.ServerInfo `json:"server"`
	Healthz Healthz           `json:"data"`
}

type JSZResp

type JSZResp struct {
	Server server.ServerInfo `json:"server"`
	JSInfo server.JSInfo     `json:"data"`
}

type SysClient

type SysClient struct {
	// contains filtered or unexported fields
}

SysClient can be used to request monitoring data from the server. This is used by the stream-check and consumer-check commands

func New

func New(nc *nats.Conn, trace bool) SysClient

New creates an instace of SyscClient

func (*SysClient) CollectClusterAccounts added in v0.3.0

func (s *SysClient) CollectClusterAccounts(timeout time.Duration, active int) ([]*server.AccountDetail, error)

CollectClusterAccounts gathers account-level JetStream metadata from the cluster. It fetches paged JSZ responses and merges streams across pages for each account.

func (*SysClient) Fetch

func (s *SysClient) Fetch(subject string, data []byte, opts ...FetchOpt) ([]*nats.Msg, error)

Fetch publishes a request to the given subject and collects replies. If FetchOpts.Expected > 0, it blocks until that number of replies is received or the timeout elapses. If FetchOpts.Expected == 0, it collects as many replies as possible until the discovery interval elapses with no new data.

func (*SysClient) FetchJszPaged added in v0.3.0

func (s *SysClient) FetchJszPaged(baseOpts server.JszEventOptions, limit int, timeout time.Duration, active int, fn func([]*server.AccountDetail)) error

FetchJszPaged pages through JSZ account data from all servers. It calls the provided function for each page of AccountDetail results.

func (*SysClient) FindServers

func (s *SysClient) FindServers(stdin bool, expected int, timeout time.Duration, readTimeout time.Duration, getConsumer bool) ([]JSZResp, error)

func (*SysClient) Healthz

func (s *SysClient) Healthz(id string, opts server.HealthzOptions) (*HealthzResp, error)

func (*SysClient) JszPing

func (s *SysClient) JszPing(opts server.JszEventOptions, fopts ...FetchOpt) ([]JSZResp, error)

JszPing sends a PING request to the JSZ endpoint and returns parsed responses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL