transportv1connect

package
v0.0.0-...-5aa5535 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RaftTransportAppendEntriesPipelineProcedure is the fully-qualified name of the RaftTransport's
	// AppendEntriesPipeline RPC.
	RaftTransportAppendEntriesPipelineProcedure = "/transport.v1.RaftTransport/AppendEntriesPipeline"
	// RaftTransportAppendEntriesProcedure is the fully-qualified name of the RaftTransport's
	// AppendEntries RPC.
	RaftTransportAppendEntriesProcedure = "/transport.v1.RaftTransport/AppendEntries"
	// RaftTransportRequestVoteProcedure is the fully-qualified name of the RaftTransport's RequestVote
	// RPC.
	RaftTransportRequestVoteProcedure = "/transport.v1.RaftTransport/RequestVote"
	// RaftTransportTimeoutNowProcedure is the fully-qualified name of the RaftTransport's TimeoutNow
	// RPC.
	RaftTransportTimeoutNowProcedure = "/transport.v1.RaftTransport/TimeoutNow"
	// RaftTransportInstallSnapshotProcedure is the fully-qualified name of the RaftTransport's
	// InstallSnapshot RPC.
	RaftTransportInstallSnapshotProcedure = "/transport.v1.RaftTransport/InstallSnapshot"
)

These constants are the fully-qualified names of the RPCs defined in this package. They're exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.

Note that these are different from the fully-qualified method names used by google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to reflection-formatted method names, remove the leading slash and convert the remaining slash to a period.

View Source
const (
	// RaftTransportName is the fully-qualified name of the RaftTransport service.
	RaftTransportName = "transport.v1.RaftTransport"
)

Variables

This section is empty.

Functions

func NewRaftTransportHandler

func NewRaftTransportHandler(svc RaftTransportHandler, opts ...connect.HandlerOption) (string, http.Handler)

NewRaftTransportHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.

By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.

Types

type RaftTransportClient

type RaftTransportClient interface {
	// AppendEntriesPipeline opens an AppendEntries message stream.
	AppendEntriesPipeline(context.Context) *connect.BidiStreamForClient[v1.AppendEntriesRequest, v1.AppendEntriesResponse]
	// AppendEntries performs a single append entries request / response.
	AppendEntries(context.Context, *connect.Request[v1.AppendEntriesRequest]) (*connect.Response[v1.AppendEntriesResponse], error)
	// RequestVote is the command used by a candidate to ask a Raft peer for a vote in an election.
	RequestVote(context.Context, *connect.Request[v1.RequestVoteRequest]) (*connect.Response[v1.RequestVoteResponse], error)
	// TimeoutNow is used to start a leadership transfer to the target node.
	TimeoutNow(context.Context, *connect.Request[v1.TimeoutNowRequest]) (*connect.Response[v1.TimeoutNowResponse], error)
	// InstallSnapshot is the command sent to a Raft peer to bootstrap its log (and state machine) from a snapshot on another peer.
	InstallSnapshot(context.Context) *connect.ClientStreamForClient[v1.InstallSnapshotRequest, v1.InstallSnapshotResponse]
}

RaftTransportClient is a client for the transport.v1.RaftTransport service.

func NewRaftTransportClient

func NewRaftTransportClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) RaftTransportClient

NewRaftTransportClient constructs a client for the transport.v1.RaftTransport service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.

The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).

type RaftTransportHandler

type RaftTransportHandler interface {
	// AppendEntriesPipeline opens an AppendEntries message stream.
	AppendEntriesPipeline(context.Context, *connect.BidiStream[v1.AppendEntriesRequest, v1.AppendEntriesResponse]) error
	// AppendEntries performs a single append entries request / response.
	AppendEntries(context.Context, *connect.Request[v1.AppendEntriesRequest]) (*connect.Response[v1.AppendEntriesResponse], error)
	// RequestVote is the command used by a candidate to ask a Raft peer for a vote in an election.
	RequestVote(context.Context, *connect.Request[v1.RequestVoteRequest]) (*connect.Response[v1.RequestVoteResponse], error)
	// TimeoutNow is used to start a leadership transfer to the target node.
	TimeoutNow(context.Context, *connect.Request[v1.TimeoutNowRequest]) (*connect.Response[v1.TimeoutNowResponse], error)
	// InstallSnapshot is the command sent to a Raft peer to bootstrap its log (and state machine) from a snapshot on another peer.
	InstallSnapshot(context.Context, *connect.ClientStream[v1.InstallSnapshotRequest]) (*connect.Response[v1.InstallSnapshotResponse], error)
}

RaftTransportHandler is an implementation of the transport.v1.RaftTransport service.

type UnimplementedRaftTransportHandler

type UnimplementedRaftTransportHandler struct{}

UnimplementedRaftTransportHandler returns CodeUnimplemented from all methods.

Jump to

Keyboard shortcuts

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