Versions in this module Expand all Collapse all v0 v0.2.0 Nov 13, 2026 v0.1.0 Nov 13, 2026 Changes in this version + const DefaultPollWait + const MaxBatch + const MaxMessageBytes + const Version + var ErrBadRequest = errors.New("narad: bad request") + var ErrBatchFull = errors.New("narad: batch is full") + var ErrClosed = errors.New("narad: client closed") + var ErrExists = errors.New("narad: already exists") + var ErrForbidden = errors.New("narad: forbidden") + var ErrLeaseLost = errors.New("narad: lease lost") + var ErrNameTaken = errors.New("narad: topic name taken in another letter case") + var ErrNoEnvelope = errors.New("narad: message has no envelope") + var ErrNoLease = errors.New("narad: message holds no lease") + var ErrNoNodes = errors.New("narad: no healthy nodes") + var ErrNotFound = errors.New("narad: not found") + var ErrOffsetGone = errors.New("narad: offset gone") + var ErrServer = errors.New("narad: server error") + var ErrThrottled = errors.New("narad: throttled") + var ErrTooLarge = errors.New("narad: message too large") + var ErrTopicChanged = errors.New("narad: topic changed since it was read") + var ErrUnauthenticated = errors.New("narad: unauthenticated") + var ErrUnavailable = errors.New("narad: unavailable") + func EnvelopeSchema(schema json.RawMessage) (json.RawMessage, error) + func Retryable(err error) bool + func Uncertain(err error) bool + type Batch struct + func (b *Batch) Add(value any, opts ...ProduceOption) error + func (b *Batch) Len() int + type Client struct + func New(address string, opts ...Option) (*Client, error) + func (c *Client) Close() error + func (c *Client) Consume(ctx context.Context, topic string, h Handler, opts ...ConsumeOption) error + func (c *Client) CreateTopic(ctx context.Context, name string, opts ...TopicOption) (Topic, error) + func (c *Client) DeleteTopic(ctx context.Context, name string) error + func (c *Client) EnsureTopic(ctx context.Context, name string, opts ...TopicOption) (Topic, error) + func (c *Client) Health() []NodeHealth + func (c *Client) Nodes() []string + func (c *Client) Ping(ctx context.Context, address string) error + func (c *Client) Produce(ctx context.Context, topic string, value any, opts ...ProduceOption) error + func (c *Client) ProduceBatch(ctx context.Context, topic string, batch *Batch) error + func (c *Client) ReadAt(ctx context.Context, topic string, partition int, offset int64) (*Message, error) + func (c *Client) ReadFrom(ctx context.Context, topic string, partition int, offset int64, h Handler) error + func (c *Client) Receive(ctx context.Context, topic string, opts ...ConsumeOption) (*Message, error) + func (c *Client) Replay(ctx context.Context, topic string, h Handler) error + func (c *Client) Retry(ctx context.Context, msg *Message, cause error, topic string) error + func (c *Client) SetSchema(ctx context.Context, name string, opts ...TopicOption) (Topic, error) + func (c *Client) Topic(ctx context.Context, name string) (Topic, error) + func (c *Client) Topics(ctx context.Context) ([]Topic, error) + type ConnError struct + Err error + Node string + Op string + Topic string + func (e *ConnError) Error() string + func (e *ConnError) Unwrap() error + type ConsumeOption func(*consumeConfig) + func FromPartition(partition int) ConsumeOption + func WithBatch(n int) ConsumeOption + func WithErrorHandler(fn func(msg *Message, err error)) ConsumeOption + func WithShutdownGrace(d time.Duration) ConsumeOption + func WithWait(d time.Duration) ConsumeOption + func WithWorkers(n int) ConsumeOption + func WithoutAutoExtend() ConsumeOption + func WithoutRequeue() ConsumeOption + type Envelope struct + Attempts int + Body json.RawMessage + Headers map[string]string + ID string + LastError string + ProducedAt int64 + Version int + func (e *Envelope) Into(v any) error + func (e *Envelope) Time() time.Time + type Error struct + Message string + Node string + Op string + RetryAfter time.Duration + Status int + Topic string + func (e *Error) Error() string + func (e *Error) Unwrap() error + type Event struct + Attempt int + Err error + Kind EventKind + Node string + Op string + State string + Status int + Took time.Duration + Topic string + Uncertain bool + Wait time.Duration + type EventKind string + const EventNode + const EventRequest + const EventRetry + type Handler interface + Handle func(ctx context.Context, msg *Message) error + type HandlerFunc func(ctx context.Context, msg *Message) error + func (f HandlerFunc) Handle(ctx context.Context, msg *Message) error + type Logger interface + Debug func(msg string, args ...any) + Error func(msg string, args ...any) + Info func(msg string, args ...any) + Warn func(msg string, args ...any) + type Message struct + Encoding string + Key string + Offset int64 + Partition int + Payload json.RawMessage + Receipt string + Timestamp int64 + Topic string + func (m *Message) Ack(ctx context.Context) error + func (m *Message) Bytes() ([]byte, error) + func (m *Message) Envelope() (*Envelope, error) + func (m *Message) Extend(ctx context.Context) error + func (m *Message) ID() string + func (m *Message) Into(v any) error + func (m *Message) Leased() bool + func (m *Message) Nack(ctx context.Context) error + func (m *Message) String() string + func (m *Message) Text() string + func (m *Message) Time() time.Time + func (m *Message) UnmarshalJSON(data []byte) error + func (m Message) MarshalJSON() ([]byte, error) + type NodeHealth struct + Address string + Healthy bool + LastError error + State string + type Option func(*config) + func WithAuth(username, password string) Option + func WithBackoff(first, max time.Duration) Option + func WithBreaker(failures int, cooldown time.Duration) Option + func WithCautiousRetries() Option + func WithEvents(fn func(Event)) Option + func WithHTTPClient(hc *http.Client) Option + func WithIdleConnections(n int) Option + func WithLogger(l Logger) Option + func WithRetries(attempts int) Option + func WithTimeout(d time.Duration) Option + func WithUserAgent(name string) Option + func WithoutBreaker() Option + type PartitionStats struct + Bytes int64 + Committed int64 + Index int + Next int64 + Oldest int64 + Owner string + OwnerLiveness string + Segments int + Status string + func (p PartitionStats) Available() bool + func (p PartitionStats) Depth() int64 + type ProduceOption func(*produceConfig) + func WithEnvelope() ProduceOption + func WithHeaders(headers map[string]string) ProduceOption + func WithID(id string) ProduceOption + func WithKey(key string) ProduceOption + func WithPartition(partition int) ProduceOption + type Topic struct + Children []string + Created time.Time + Delay time.Duration + Name string + Owner string + Parent string + Partial bool + PartitionStats []PartitionStats + Partitions int + Retention time.Duration + Schema json.RawMessage + SchemaVersion int + VisibilityTimeout time.Duration + type TopicOption func(*topicConfig) + func WithDelay(d time.Duration) TopicOption + func WithEnvelopeSchema(schema json.RawMessage) TopicOption + func WithMaxInFlight(n int64) TopicOption + func WithParent(parent string) TopicOption + func WithPartitionCount(n int) TopicOption + func WithRetention(d time.Duration) TopicOption + func WithRetentionForever() TopicOption + func WithSchema(schema json.RawMessage) TopicOption + func WithSchemaBaseVersion(version int) TopicOption + func WithVisibilityTimeout(d time.Duration) TopicOption