Skip to content

coufalja/tugboat-transport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages