ring

package
v1.0.1-0...-53a0807 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapRingpop

func BootstrapRingpop(rp *ringpop.Ringpop, provider discovery.DiscoverProvider) error

Bootstrap starts communication for this Ringpop instance. When Bootstrap is called, this Ringpop instance will attempt to contact other instances from the DiscoverProvider.

func NewChannel

func NewChannel() (*tchannel.Channel, error)

NewChannel returns new TChannel used for communication between nodes in ring

func NewRingpop

func NewRingpop(ch *tchannel.Channel, ringpopPeerIP, ringpopPeerPort string, logger bark.Logger) (*ringpop.Ringpop, error)

NewRingpop returns new ringpop

func RequestToKey

func RequestToKey(r *http.Request) string

RequestToKey converts request to key, that will be used for hash ring This func uses client IP as key

func ResolveDestinationNode

func ResolveDestinationNode(rp *ringpop.Ringpop, key string) (string, error)

ResolveDestinationNode finds out responsible node from hashring by given key

func SetLogger

func SetLogger(logger bark.Logger)

SetLogger sets default logger for ringpop

Types

type Forwarder

type Forwarder interface {
	Forward(node, key string, request []byte) ([]byte, error)
}

Forwarder is a request forwarder used to transfer request between nodes in hashring

type HTTPResponseWriter

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

HTTPResponseWriter is a simple http.ResponseWriter implementation

func NewResponseWriter

func NewResponseWriter() *HTTPResponseWriter

NewResponseWriter returns new HTTP ResponseWriter

func (*HTTPResponseWriter) Header

func (r *HTTPResponseWriter) Header() http.Header

func (*HTTPResponseWriter) Response

func (r *HTTPResponseWriter) Response() *http.Response

func (*HTTPResponseWriter) Write

func (r *HTTPResponseWriter) Write(body []byte) (int, error)

func (*HTTPResponseWriter) WriteHeader

func (r *HTTPResponseWriter) WriteHeader(status int)

type RequestForwarder

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

RequestForwarder is a simple request forwarder that transfers request between nodes using ringpop

func NewForwarder

func NewForwarder(rp *ringpop.Ringpop, l bark.Logger) *RequestForwarder

NewForwarder returns new request forwarder

func (*RequestForwarder) Forward

func (f *RequestForwarder) Forward(node, key string, request []byte) ([]byte, error)

type Server

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

Server serves ringpop (gossip) requests inside ring

func NewServer

func NewServer(ch *tchannel.Channel, backend http.Handler, logger bark.Logger) *Server

NewServer returns new ringpop server and registers its handlers

func (*Server) ListenAndServe

func (srv *Server) ListenAndServe(hostPort string) error

ListenAndServe starts listening on TChannel

Jump to

Keyboard shortcuts

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