raft_storage

package
v0.0.0-...-1338f1b Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 28 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RaftClient

type RaftClient struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*RaftClient) Flush

func (c *RaftClient) Flush()

func (*RaftClient) GetAddr

func (c *RaftClient) GetAddr(storeID uint64) string

func (*RaftClient) InsertAddr

func (c *RaftClient) InsertAddr(storeID uint64, addr string)

func (*RaftClient) Send

func (c *RaftClient) Send(storeID uint64, addr string, msg *raft_serverpb.RaftMessage) error

type RaftStorage

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

RaftStorage is an implementation of `Storage` (see tikv/server.go) backed by a Raft node. It is part of a Raft network. By using Raft, reads and writes are consistent with other nodes in the TinyKV instance.

func NewRaftStorage

func NewRaftStorage(conf *config.Config) *RaftStorage

NewRaftStorage creates a new storage engine backed by a raftstore.

func (*RaftStorage) Raft

func (rs *RaftStorage) Raft(stream tinykvpb.TinyKv_RaftServer) error

func (*RaftStorage) Reader

func (rs *RaftStorage) Reader(ctx *kvrpcpb.Context) (storage.StorageReader, error)

func (*RaftStorage) Snapshot

func (rs *RaftStorage) Snapshot(stream tinykvpb.TinyKv_SnapshotServer) error

func (*RaftStorage) Start

func (rs *RaftStorage) Start() error

func (*RaftStorage) Stop

func (rs *RaftStorage) Stop() error

func (*RaftStorage) Write

func (rs *RaftStorage) Write(ctx *kvrpcpb.Context, batch []storage.Modify) error

type RegionError

type RegionError struct {
	RequestErr *errorpb.Error
}

func (*RegionError) Error

func (re *RegionError) Error() string

type RegionIterator

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

RegionIterator wraps a db iterator and only allow it to iterate in the region. It behaves as if underlying db only contains one region.

func NewRegionIterator

func NewRegionIterator(iter *engine_util.BadgerIterator, region *metapb.Region) *RegionIterator

func (*RegionIterator) Close

func (it *RegionIterator) Close()

func (*RegionIterator) Item

func (it *RegionIterator) Item() engine_util.DBItem

func (*RegionIterator) Next

func (it *RegionIterator) Next()

func (*RegionIterator) Rewind

func (it *RegionIterator) Rewind()

func (*RegionIterator) Seek

func (it *RegionIterator) Seek(key []byte)

func (*RegionIterator) Valid

func (it *RegionIterator) Valid() bool

func (*RegionIterator) ValidForPrefix

func (it *RegionIterator) ValidForPrefix(prefix []byte) bool

type RegionReader

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

func NewRegionReader

func NewRegionReader(txn *badger.Txn, region metapb.Region) *RegionReader

func (*RegionReader) Close

func (r *RegionReader) Close()

func (*RegionReader) GetCF

func (r *RegionReader) GetCF(cf string, key []byte) ([]byte, error)

func (*RegionReader) IterCF

func (r *RegionReader) IterCF(cf string) engine_util.DBIterator

type ServerTransport

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

func NewServerTransport

func NewServerTransport(raftClient *RaftClient, snapScheduler chan<- worker.Task, raftRouter message.RaftRouter, resolverScheduler chan<- worker.Task) *ServerTransport

func (*ServerTransport) Flush

func (t *ServerTransport) Flush()

func (*ServerTransport) Resolve

func (t *ServerTransport) Resolve(storeID uint64, msg *raft_serverpb.RaftMessage)

func (*ServerTransport) Send

func (*ServerTransport) SendSnapshotSock

func (t *ServerTransport) SendSnapshotSock(addr string, msg *raft_serverpb.RaftMessage)

func (*ServerTransport) SendStore

func (t *ServerTransport) SendStore(storeID uint64, msg *raft_serverpb.RaftMessage)

func (*ServerTransport) WriteData

func (t *ServerTransport) WriteData(storeID uint64, addr string, msg *raft_serverpb.RaftMessage)

Jump to

Keyboard shortcuts

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