replicationhttp

package
v0.1.0-alpha.11 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package replicationhttp transports a verified bootstrap over HTTPS.

It is intentionally only the bootstrap half of replication. After an import, callers attach the returned tokens to the WebSocket change-feed receiver. The authenticated durable-consumer name is server controlled; clients never select it in an HTTP header or URL.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidBootstrapResponse = errors.New("meldbase replication bootstrap: invalid response")
	ErrBootstrapHTTPSRequired   = errors.New("meldbase replication bootstrap: HTTPS is required")
)

Functions

This section is empty.

Types

type Authorize

type Authorize = replicationauth.Authorize

Authorize authenticates an HTTPS request and returns a stable, server-controlled durable consumer name. Typical deployments map a verified mTLS client certificate fingerprint to that name. It must not derive the name from a user-controlled request value.

func NewMTLSAuthorizer

func NewMTLSAuthorizer(config MTLSConfig) (Authorize, error)

NewMTLSAuthorizer returns the strict verified-leaf-fingerprint authorizer used by the WebSocket adapter too. The enclosing http.Server must still require and verify client certificates in its tls.Config.

type Bootstrap

type Bootstrap struct {
	Backup          meldbase.BackupResult
	CheckpointToken uint64
	SnapshotToken   uint64
}

Bootstrap is the verified artifact receipt and the durable-feed bridge tokens that must be supplied to replicationws.ReceiverConfig.

func Fetch

func Fetch(ctx context.Context, config FetchConfig) (Bootstrap, error)

Fetch downloads one bootstrap over a non-redirected HTTPS connection and imports it atomically. It requires an actual TLS response even when callers provide a custom HTTP transport, preventing a transport shim from silently downgrading the security contract.

type FetchConfig

type FetchConfig struct {
	URL         string
	HTTPClient  *http.Client
	Destination string
	MaxBytes    uint64
}

FetchConfig configures a receiving bootstrap. HTTPClient must be configured with the deployment's mTLS client certificate and trusted server roots.

type MTLSConfig

type MTLSConfig = replicationauth.MTLSConfig

MTLSConfig is shared with the WebSocket replication adapter, so bootstrap and tail transport cannot accidentally use different peer-name mappings.

type Source

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

Source serves one exact, verified artifact and establishes the source durable checkpoint before it is made available to the receiver.

func NewSource

func NewSource(config SourceConfig) (*Source, error)

NewSource validates configuration and returns an HTTP handler source.

func (*Source) ServeHTTP

func (source *Source) ServeHTTP(writer http.ResponseWriter, request *http.Request)

ServeHTTP accepts only an authenticated GET with no browser Origin. The source lease covers both bootstrap and a subsequent replicationws source session, preventing two transports from racing one durable checkpoint.

type SourceConfig

type SourceConfig struct {
	DB               *meldbase.DB
	Authorize        Authorize
	ArchiveDirectory string
	Buffer           int
}

SourceConfig configures an HTTPS handler. TLS and client-certificate verification belong to the enclosing http.Server; Authorize enforces its application-level identity mapping.

Jump to

Keyboard shortcuts

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