kvNode

package
v0.0.0-...-c9155d5 Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeState

type NodeState struct {
	IsMaster      bool
	ShardKey      int
	LastWALSeq    int64
	LeaderID      int
	MasterAddress string
	MasterPort    int
	NodeID        int
}

NodeState contains configs, and metadata fetched from controller

type Service

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

func NewKvNodeService

func NewKvNodeService(cfg *config.KvNodeConfig) *Service

func (*Service) ApplyWALRecord

func (k *Service) ApplyWALRecord(record WALRecord) error

func (*Service) Del

func (k *Service) Del(key string) error

func (*Service) Get

func (k *Service) Get(key string) (string, error)

func (*Service) GetLastSeq

func (k *Service) GetLastSeq() int64

func (*Service) GetWALSince

func (k *Service) GetWALSince(seq int64) []WALRecord

func (*Service) RegisterWithController

func (k *Service) RegisterWithController() error

func (*Service) Set

func (k *Service) Set(key, value string) error

func (*Service) Start

func (k *Service) Start() error

func (*Service) UpdateFollowerProgress

func (k *Service) UpdateFollowerProgress(followerID int, seq int64)

func (*Service) UpdateNodeState

func (k *Service) UpdateNodeState(state cluster.StoreNodeType, leaderID int) error

type Storage

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

func NewNodeStore

func NewNodeStore() *Storage

func (*Storage) Delete

func (s *Storage) Delete(key string)

func (*Storage) Get

func (s *Storage) Get(key string) (string, bool)

func (*Storage) Set

func (s *Storage) Set(key, value string)

type WAL

type WAL struct {
	ShardKey int
	Records  []WALRecord
	// contains filtered or unexported fields
}

func NewWAL

func NewWAL(shardKey int) *WAL

func (*WAL) Append

func (w *WAL) Append(op, key, value string)

func (*WAL) ClearUntil

func (w *WAL) ClearUntil(seq int64)

func (*WAL) GetLastSeq

func (w *WAL) GetLastSeq() int64

func (*WAL) GetMinFollowerSeq

func (w *WAL) GetMinFollowerSeq() int64

func (*WAL) GetSince

func (w *WAL) GetSince(seq int64) []WALRecord

func (*WAL) RemoveFollower

func (w *WAL) RemoveFollower(followerID int)

func (*WAL) UpdateFollowerProgress

func (w *WAL) UpdateFollowerProgress(followerID int, seq int64)

type WALRecord

type WALRecord struct {
	Operation string
	Key       string
	Value     string
	Seq       int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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