snapshot

package
v0.0.0-...-16dfdc2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogFile

type LogFile struct {

	//the segment raft log name
	FileName string

	//the segment raft log size, use for NOT finish segment log (last writing segment)
	//when recover, need create a file with FileSize, and write the entries to this file
	FileSize uint64

	//raft log file : 0
	//index file : 1
	Type int

	//whether the segments is finish, should only have one writing file at a time
	// true: finish
	// false: writing
	IsFinish bool

	// checksum for finish file
	// for writing file, should check entry one by one
	Checksum string
}

type Message

type Message struct {
	raftpb.Message
	ReadCloser io.ReadCloser
	TotalSize  int64
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(rs raftpb.Message, rc io.ReadCloser, rcSize int64) *Message

func (Message) CloseNotify

func (m Message) CloseNotify() <-chan bool

CloseNotify returns a channel that receives a single value when the message sent is finished. true indicates the sent is successful.

func (Message) CloseWithError

func (m Message) CloseWithError(err error)

type SnapshotMetadata

type SnapshotMetadata struct {

	// version for snapshot, 0 was use currently
	Version SnapshotVersion

	RaftGroupName string

	// Index and Term store when the snapshot was taken.
	// NOTE: Index should be last apply index when take snapshot
	Index uint64
	Term  uint64

	// latest members information , include own server
	// map[server name : string] URLs, URLs is the server listener address(es)
	MembersMap types.URLsMap

	//log files for index log and raft log
	LogFiles []LogFile
}

SnapshotMetadata for the raft group snapshot include all raft relative information

type SnapshotVersion

type SnapshotVersion int

0 for VDL 1.0 currently

type Snapshotter

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

/////////////////////////// temp for usage

func (*Snapshotter) Load

func (s *Snapshotter) Load() (*raftpb.Snapshot, error)

func (*Snapshotter) SaveDBFrom

func (s *Snapshotter) SaveDBFrom(r io.Reader, id uint64) (int64, error)

func (*Snapshotter) SaveSnap

func (s *Snapshotter) SaveSnap(snapshot raftpb.Snapshot) error

Jump to

Keyboard shortcuts

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