raft

package module
v0.0.0-...-a2979ac Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

litefs-raft

RAFT based leaser for using LiteFS as a library.

Check out an usage example: https://github.com/walterwanderley/sqlc-grpc/tree/main/_examples/authors/sqlite

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSM

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

func NewFSM

func NewFSM() *FSM

func (*FSM) Apply

func (fsm *FSM) Apply(log *raft.Log) interface{}

func (*FSM) Persist

func (fsm *FSM) Persist(sink raft.SnapshotSink) error

func (*FSM) PrimaryInfo

func (fsm *FSM) PrimaryInfo() litefs.PrimaryInfo

func (*FSM) RedirectURL

func (fsm *FSM) RedirectURL() string

func (*FSM) Release

func (fsm *FSM) Release()

func (*FSM) Restore

func (fsm *FSM) Restore(snapshot io.ReadCloser) error

func (*FSM) Snapshot

func (fsm *FSM) Snapshot() (raft.FSMSnapshot, error)

type PrimaryRedirectInfo

type PrimaryRedirectInfo struct {
	PrimaryInfo litefs.PrimaryInfo
	RedirectURL string
}

type RaftLeaser

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

func New

func New(r *raft.Raft, localInfo PrimaryRedirectInfo, fsm *FSM, ttl time.Duration) *RaftLeaser

func (*RaftLeaser) Acquire

func (l *RaftLeaser) Acquire(ctx context.Context) (litefs.Lease, error)

func (*RaftLeaser) AcquireExisting

func (l *RaftLeaser) AcquireExisting(ctx context.Context, leaseID string) (litefs.Lease, error)

func (*RaftLeaser) AdvertiseURL

func (l *RaftLeaser) AdvertiseURL() string

func (*RaftLeaser) Close

func (l *RaftLeaser) Close() error

func (*RaftLeaser) ClusterID

func (l *RaftLeaser) ClusterID(ctx context.Context) (string, error)

func (*RaftLeaser) Hostname

func (l *RaftLeaser) Hostname() string

func (*RaftLeaser) PrimaryInfo

func (l *RaftLeaser) PrimaryInfo(ctx context.Context) (litefs.PrimaryInfo, error)

func (*RaftLeaser) RedirectURL

func (l *RaftLeaser) RedirectURL() string

func (*RaftLeaser) SetClusterID

func (l *RaftLeaser) SetClusterID(ctx context.Context, clusterID string) error

func (*RaftLeaser) Type

func (l *RaftLeaser) Type() string

Jump to

Keyboard shortcuts

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