coufalja / tugboat-transport

Default Transport implementation of a Tugboat library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tugboat-transport

This is the default transport implementation for the Tugboat library.

How to use

package main

import (
	"github.com/coufalja/tugboat"
	"github.com/coufalja/tugboat/config"
	"github.com/coufalja/tugboat-transport/tcp" // Import the tcp package
	"github.com/coufalja/tugboat-logdb/pebble"
)

func main() {
	nhc := config.NodeHostConfig{
		NodeHostDir:    "/tmp",
		RTTMillisecond: 50,
		RaftAddress:    "localhost:8079",
	}

	// Configure the transport
	cfg := tcp.Config{
		MaxSnapshotSendBytesPerSecond: 5 * 1024 * 1024,
		MaxSnapshotRecvBytesPerSecond: 5 * 1024 * 1024,
		MutualTLS:                     false,
		RaftAddress:                   "localhost:8079", // The same RaftAddress must be passed both to transport and the NodeHost
	}
	_, _ = tugboat.NewNodeHost(nhc, tcp.Factory(cfg), pebble.Factory(pebble.GetDefaultLogDBConfig()))
}

About

Default Transport implementation of a Tugboat library.

License:MIT License


Languages

Language:Go 100.0%