http

package
v0.3.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAddr = ":20202"
)

Default settings

Variables

This section is empty.

Functions

func Error

func Error(w http.ResponseWriter, r *http.Request, err error, code int)

func ReadPosMapFrom

func ReadPosMapFrom(r io.Reader) (map[string]litefs.Pos, error)

func WritePosMapTo

func WritePosMapTo(w io.Writer, m map[string]litefs.Pos) error

Types

type Client

type Client struct {
	// Underlying HTTP client
	HTTPClient *http.Client
}

Client represents an client for a streaming LiteFS HTTP server.

func NewClient

func NewClient() *Client

NewClient returns an instance of Client.

func (*Client) Stream

func (c *Client) Stream(ctx context.Context, rawurl string, nodeID string, posMap map[string]litefs.Pos) (io.ReadCloser, error)

Stream returns a snapshot and continuous stream of WAL updates.

type Server

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

Server represents an HTTP API server for LiteFS.

func NewServer

func NewServer(store *litefs.Store, addr string) *Server

func (*Server) Close

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

func (*Server) Listen

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

func (*Server) Port

func (s *Server) Port() int

Port returns the port the listener is running on.

func (*Server) Serve

func (s *Server) Serve()

func (*Server) URL

func (s *Server) URL() string

URL returns the full base URL for the running server.

Jump to

Keyboard shortcuts

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