raftredcon

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2016 License: MIT Imports: 14 Imported by: 3

README

Raft-Redcon

Build Status GoDoc

Raft-Redcon is a raft transport layer that implements the Redis Protocol. It's intended to be used with hashicorp/raft. It utilizes Redcon under the hood, and is a central component of the Finn project.

Contact

Josh Baker @tidwall

License

Raft-Redcon source code is available under the MIT License.

Documentation

Overview

Package raftredcon provides a raft transport using the Redis protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(addr string, buf []byte, args ...[]byte) (resp []byte, nbuf []byte, err error)

Do is a helper function that makes a very simple remote request with the specified command. The addr param is the target server address. The buf param is an optional reusable buffer, this can be nil. The args are the command arguments such as "SET", "key", "value". Return response is a bulk, string, or an error. The nbuf is a reuseable buffer, this can be ignored.

func ReadRawResponse

func ReadRawResponse(rd *bufio.Reader) (raw []byte, kind byte, err error)

Types

type RedconTransport

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

func NewRedconTransport

func NewRedconTransport(
	bindAddr string,
	handle func(conn redcon.Conn, cmd redcon.Command),
	accept func(conn redcon.Conn) bool,
	closed func(conn redcon.Conn, err error),
	logOutput io.Writer,
) (*RedconTransport, error)

func (*RedconTransport) AppendEntries

func (t *RedconTransport) AppendEntries(target string, args *raft.AppendEntriesRequest, resp *raft.AppendEntriesResponse) error

AppendEntries implements the Transport interface.

func (*RedconTransport) AppendEntriesPipeline

func (t *RedconTransport) AppendEntriesPipeline(target string) (raft.AppendPipeline, error)

AppendEntriesPipeline returns an interface that can be used to pipeline AppendEntries requests.

func (*RedconTransport) Close

func (t *RedconTransport) Close() error

Close is used to permanently disable the transport

func (*RedconTransport) Consumer

func (t *RedconTransport) Consumer() <-chan raft.RPC

Consumer implmenents the Transport interface.

func (*RedconTransport) DecodePeer

func (t *RedconTransport) DecodePeer(peer []byte) string

DecodePeer implmenents the Transport interface.

func (*RedconTransport) EncodePeer

func (t *RedconTransport) EncodePeer(peer string) []byte

EncodePeer implmenents the Transport interface.

func (*RedconTransport) InstallSnapshot

func (t *RedconTransport) InstallSnapshot(
	target string, args *raft.InstallSnapshotRequest, resp *raft.InstallSnapshotResponse, data io.Reader,
) error

InstallSnapshot implmenents the Transport interface.

func (*RedconTransport) LocalAddr

func (t *RedconTransport) LocalAddr() string

LocalAddr implmenents the Transport interface.

func (*RedconTransport) RequestVote

func (t *RedconTransport) RequestVote(target string, args *raft.RequestVoteRequest, resp *raft.RequestVoteResponse) error

RequestVote implements the Transport interface.

func (*RedconTransport) SetHeartbeatHandler

func (t *RedconTransport) SetHeartbeatHandler(cb func(rpc raft.RPC))

SetHeartbeatHandler implmenents the Transport interface.

Jump to

Keyboard shortcuts

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