raft_app

package
v0.0.0-...-4557a6c Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenHss

func OpenHss(path string) raft.Hss

func OpenLog

func OpenLog(path string) raft.Log

Types

type App

type App interface {
	ListenAndServe() error
	Propose(ctx context.Context, command raft.Command) error
	WithTransportAuth(tag string, auth Auth) App
	OnCommit(func(...raft.Entry)) App
	gin.IRoutes
}

func NewApp

func NewApp(raftCfg raft.RaftConfig, loopCfg raft.LoopConfig, addr map[raft.NodeId]string) App

type Auth

type Auth interface {
	Generate(tokenTime time.Time) (token string)
	Verify(token string, now time.Time) (ok bool)
	Save(path string) error
}

func CreateAuth

func CreateAuth(key string) (Auth, error)

func OpenAuth

func OpenAuth(path string) (Auth, error)

Jump to

Keyboard shortcuts

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