backend

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FILES_         = "files_"
	BLOCKS_        = "blocks_"
	ID_            = "id_"
	VERSION_       = "version_"
	TORRENT_       = "torrent_"
	CUR_BLOCK_NUM_ = "currentBlockNumber_"
)

Variables

View Source
var (
	ErrReadDataFromBoltDB = errors.New("bolt DB Read Error")
)

Functions

This section is empty.

Types

type ChainDB

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

func NewChainDB

func NewChainDB(config *params.Config) (*ChainDB, error)

func (*ChainDB) AddBlock

func (fs *ChainDB) AddBlock(b *types.Block) error

func (fs *ChainDB) addBlock(b *Block, record bool) error {

func (*ChainDB) AddFile

func (fs *ChainDB) AddFile(x *types.FileInfo) (uint64, bool, error)

func (*ChainDB) Anchor

func (fs *ChainDB) Anchor(n uint64)

func (*ChainDB) Blocks

func (fs *ChainDB) Blocks() []*types.Block

func (*ChainDB) CheckPoint

func (fs *ChainDB) CheckPoint() uint64

func (*ChainDB) Close

func (fs *ChainDB) Close() error

func (*ChainDB) Files

func (fs *ChainDB) Files() []*types.FileInfo

func (*ChainDB) Flush

func (fs *ChainDB) Flush() error

func (*ChainDB) GetBlockByNumber

func (fs *ChainDB) GetBlockByNumber(blockNum uint64) *types.Block

func (*ChainDB) GetFileByAddr

func (fs *ChainDB) GetFileByAddr(addr common.Address) *types.FileInfo

func (*ChainDB) GetRoot

func (fs *ChainDB) GetRoot(number uint64) (root []byte)

func (*ChainDB) GetTorrentProgress

func (fs *ChainDB) GetTorrentProgress(ih string) (progress uint64, err error)

GetTorrent return the torrent status by uint64, if return 0 for torrent not exist

func (*ChainDB) ID

func (fs *ChainDB) ID() uint64

func (*ChainDB) Init

func (fs *ChainDB) Init() (err error)

func (*ChainDB) InitBlockNumber added in v1.0.2

func (fs *ChainDB) InitBlockNumber() error

func (*ChainDB) InitTorrents

func (fs *ChainDB) InitTorrents() (map[string]uint64, error)

func (*ChainDB) LastListenBlockNumber

func (fs *ChainDB) LastListenBlockNumber() uint64

func (*ChainDB) Leaves

func (fs *ChainDB) Leaves() []merkletree.Content

func (*ChainDB) Metrics

func (fs *ChainDB) Metrics() time.Duration

func (*ChainDB) NewFileInfo

func (fs *ChainDB) NewFileInfo(fileMeta *types.FileMeta) *types.FileInfo

func (*ChainDB) Reset

func (fs *ChainDB) Reset() error

func (*ChainDB) Root

func (fs *ChainDB) Root() common.Hash

func (*ChainDB) SetTorrentProgress

func (fs *ChainDB) SetTorrentProgress(ih string, size uint64) (bool, uint64, error)

SetTorrent is for recording torrent latest status

func (*ChainDB) SkipPrint

func (fs *ChainDB) SkipPrint()

func (*ChainDB) Torrents

func (fs *ChainDB) Torrents() map[string]uint64

func (*ChainDB) Txs

func (fs *ChainDB) Txs() uint64

func (*ChainDB) Version

func (fs *ChainDB) Version() string

Jump to

Keyboard shortcuts

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