rafthttp

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package rafthttp implements HTTP transportation layer for raft.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHttpHandlerFunc added in v1.0.3

func GetHttpHandlerFunc(pattern string, h transport.Handler) http.HandlerFunc

GetHttpHandlerFunc 将内部的handler暴露出去

func Handler

func Handler(h transport.Handler) http.Handler

Handler return's http.Handler for http transport server.

func Register

func Register(opts ...Option)

Register registers the http for use with all clients and servers communication.

NOTE: this function must only be called during initialization time (i.e. in an init() function), and is not thread-safe.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures http using the functional options paradigm popularized by Rob Pike and Dave Cheney. If you're unfamiliar with this style, see https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html and https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis.

func WithBasePath

func WithBasePath(tr http.RoundTripper) Option

WithBasePath specifies the HTTP path that will serve raft requests. Default: "/_raft/".

func WithRoundTripper

func WithRoundTripper(tr http.RoundTripper) Option

WithRoundTripper optionally specifies an http.RoundTripper for the client to use when it makes a request. Default: http.DefaultTransport.

Jump to

Keyboard shortcuts

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