Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package client provides a bounded, authenticated HTTP client for Questlock. Publish never automatically retries. To retry after an uncertain response, reuse the exact same request and operation ID so the server can replay it.

Index

Constants

View Source
const (
	DefaultTimeout   = 15 * time.Second
	MaxResponseBytes = 16 << 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client may be shared by concurrent goroutines. Its credentials are sent only to the configured server; redirects are rejected.

func New

func New(baseURL, token string) (*Client, error)

New creates a client with a 15-second request timeout and 16MiB response limit. Plain HTTP is accepted only for literal loopback IP addresses. All other hosts require HTTPS. Environment proxy settings are deliberately ignored.

func NewWithTLSRoots added in v0.9.0

func NewWithTLSRoots(baseURL, token string, rootPEM []byte) (*Client, error)

NewWithTLSRoots adds explicit PEM roots to the system trust store. It never disables hostname/certificate verification or changes the OS trust settings.

func (*Client) Audit

func (c *Client) Audit(ctx context.Context, limit int) ([]protocol.AuditEvent, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, key string) (protocol.Artifact, error)

func (*Client) Identity added in v0.8.0

func (c *Client) Identity(ctx context.Context) (protocol.Identity, error)

func (*Client) List

func (c *Client) List(ctx context.Context) ([]protocol.Artifact, error)

func (*Client) Publish

func (*Client) PublishPinned added in v0.8.0

func (c *Client) PublishPinned(ctx context.Context, expected protocol.Identity, r protocol.PublishRequest) (protocol.PublishResult, error)

PublishPinned preserves Publish's exact request/receipt semantics and adds an identity precondition checked in the authoritative SQLite transaction. Its dedicated route makes older brokers reject it before any publication.

func (*Client) Sync added in v0.8.0

func (c *Client) Sync(ctx context.Context, request protocol.SyncRequest) (protocol.SyncPage, error)

Sync reads one bounded snapshot/change page. It never retries, applies writes or changes local authority. The normal client TLS, proxy and redirect rules apply. Persist a page's cursor only after durably consuming all its entries.

type Error

type Error struct {
	Code           string
	Message        string
	CurrentVersion int64
	Status         int
}

Error is an error returned by the service, with its HTTP status preserved.

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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