http

package
v0.4.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Upstream endpoint
	URL string

	// Path of database on upstream server.
	Path string

	// Underlying HTTP client
	HTTPClient *http.Client
}

Client represents an client for a streaming Litestream HTTP server.

func NewClient

func NewClient(rawurl, path string) *Client

NewClient returns an instance of Client.

func (*Client) Stream

Stream returns a snapshot and continuous stream of WAL updates.

type Server

type Server struct {
	Logger *log.Logger
	// contains filtered or unexported fields
}

Server represents an HTTP API server for Litestream.

func NewServer

func NewServer(server *litestream.Server, addr string) *Server

func (*Server) Close

func (s *Server) Close() (err error)

func (*Server) Open

func (s *Server) Open() (err error)

func (*Server) Port

func (s *Server) Port() int

Port returns the port the listener is running on.

func (*Server) URL

func (s *Server) URL() string

URL returns the full base URL for the running server.

type StreamReader

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

StreamReader represents an optional snapshot followed by a continuous stream of WAL updates. It is used to implement live read replication from a single primary Litestream server to one or more remote Litestream replicas.

func (*StreamReader) Close

func (r *StreamReader) Close() (err error)

Close closes the underlying reader.

func (*StreamReader) Next

Next returns the next available record. This call will block until a record is available. After calling Next(), read the payload from the reader using Read() until io.EOF is reached.

func (*StreamReader) PageSize

func (r *StreamReader) PageSize() int

PageSize returns the page size on the remote database.

func (*StreamReader) Read

func (r *StreamReader) Read(p []byte) (n int, err error)

Read reads bytes of the current payload into p. Only valid after a successful call to Next(). On io.EOF, call Next() again to begin reading next record.

Jump to

Keyboard shortcuts

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