archive

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package archive implement

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = &Options{
	NoSync:           false,
	SegmentSize:      67108864,
	SegmentCacheSize: 25,
}

DefaultOptions for OpenRestore().

Functions

This section is empty.

Types

type ArchiveMgr

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

ArchiveMgr provide handle to archive instances

@Description:

func NewArchiveMgr

func NewArchiveMgr(chainId, bfdbPath string, blockDB blockdb.BlockDB, resultDB resultdb.ResultDB,
	fileStore binlog.BinLogger, storeConfig *conf.StorageConfig,
	logger protocol.Logger) (*ArchiveMgr, error)

NewArchiveMgr construct a new `archiveMgr` with given chainId

@Description:
@param chainId
@param blockDB
@param resultDB
@param storeConfig
@param logger
@return *archiveMgr
@return error

func (*ArchiveMgr) ArchiveBlock

func (mgr *ArchiveMgr) ArchiveBlock(archiveHeight uint64) error

ArchiveBlock archive block to target height

@Description:
@receiver mgr
@param archiveHeight
@return error

func (*ArchiveMgr) Close added in v2.3.4

func (mgr *ArchiveMgr) Close() error

Close archive mgr @Description: @receiver mgr @return error

func (*ArchiveMgr) GetArchiveStatus added in v2.3.4

func (mgr *ArchiveMgr) GetArchiveStatus() (*storePb.ArchiveStatus, error)

GetArchiveStatus return archive status

@Description:
@receiver mgr
@return uint64
@return error

func (*ArchiveMgr) GetArchivedPivot

func (mgr *ArchiveMgr) GetArchivedPivot() (uint64, error)

GetArchivedPivot return restore block pivot

@Description:
@receiver mgr
@return uint64
@return error

func (*ArchiveMgr) RestoreBlocks added in v2.3.4

func (mgr *ArchiveMgr) RestoreBlocks(serializedBlocks [][]byte) error

RestoreBlocks restore block from outside block data

@Description:
@receiver mgr
@param blockInfos
@return error

func (*ArchiveMgr) RestoreFileDB added in v2.3.4

func (mgr *ArchiveMgr) RestoreFileDB(blkBytes [][]byte, blockInfos []*serialization.BlockWithSerializedInfo) error

RestoreFileDB add next time @Description: @receiver mgr @param blkBytes @param blockInfos @return error

func (*ArchiveMgr) RestoreKvDB added in v2.3.4

func (mgr *ArchiveMgr) RestoreKvDB(blockInfos []*serialization.BlockWithSerializedInfo) error

RestoreKvDB add next time @Description: @receiver mgr @param blockInfos @return error

func (*ArchiveMgr) ResumeFlushKV added in v2.3.4

func (mgr *ArchiveMgr) ResumeFlushKV(uIndexSN []string, sPool *sync.Pool) error

ResumeFlushKV resume flush kv to db Deprecated @Description: @receiver mgr @param uIndexSN @param sPool @return error

type Batch added in v2.3.4

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

Batch of entries. Used to write multiple entries at once using WriteBatch().

@Description:

func (*Batch) Write added in v2.3.4

func (b *Batch) Write(index uint64, data []byte, indexMeta *serialization.BlockIndexMeta)

Write @Description: Write an entry to the batch @receiver b @param index @param data

type FileRestore added in v2.3.4

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

FileRestore manage xxx.fdb under bfdb/restoring dir

func OpenRestore added in v2.3.4

func OpenRestore(path string, opts *Options, logger protocol.Logger) (*FileRestore, error)

OpenRestore open a restore FileRestore

@Description:
@param path
@param opts
@param logger
@return *FileRestore
@return error

func (*FileRestore) Close added in v2.3.4

func (l *FileRestore) Close() error

Close the log.

@Description:
@receiver l
@return error

func (*FileRestore) GetSegsInfo added in v2.3.4

func (l *FileRestore) GetSegsInfo() []*storePb.FileRange

GetSegsInfo get l.segments info @Description: @receiver l @return []string

func (*FileRestore) LastSegment added in v2.3.4

func (l *FileRestore) LastSegment() *Segment

LastSegment return last Segment in l.segments @Description: @receiver l @return *Segment

func (*FileRestore) Sync added in v2.3.4

func (l *FileRestore) Sync() error

Sync performs a fsync on the log. This is not necessary when the NoSync option is set to false. @Description: @receiver l @return error

func (*FileRestore) ToString added in v2.3.4

func (l *FileRestore) ToString(seg *Segment) string

ToString Segment to string @Description: @receiver l @param seg @return string

func (*FileRestore) Write added in v2.3.4

func (l *FileRestore) Write(index uint64, data []byte,
	indexMeta *serialization.BlockIndexMeta) (*serialization.BlockIndexMeta, error)

Write @Description: Write an entry to the block rfile db. @receiver l @param index @param data @return fileName @return offset @return blkLen @return err

type Options added in v2.3.4

type Options struct {
	// NoSync disables fsync after writes. This is less durable and puts the
	// log at risk of data loss when there's a server crash.
	NoSync bool
	// SegmentSize of each Segment. This is just a target value, actual size
	// may differ. Default is 20 MB.
	SegmentSize int
	// SegmentCacheSize is the maximum number of segments that will be held in
	// memory for caching. Increasing this value may enhance performance for
	// concurrent read operations. Default is 1
	SegmentCacheSize int
}

Options for FileRestore

type Segment added in v2.3.4

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

Segment represents a single Segment rfile.

Jump to

Keyboard shortcuts

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