ppos_storage

package
v1.8.17-0...-7deff2d Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package ppos_storage is a generated protocol buffer package.

It is generated from these files:

ppos_storage.proto

It has these top-level messages:

CandidateInfo
Refund
RefundArr
CandidateTemp
Field
TicketDependency
TicketTemp
PB_PPosTemp
SortTemp

Index

Constants

View Source
const (
	PREVIOUS = iota
	CURRENT
	NEXT
	IMMEDIATE
	RESERVE
)

Variables

View Source
var (
	ParamsIllegalErr = errors.New("Params illegal")
	TicketNotFindErr = errors.New("The Ticket not find")
)
View Source
var (
	WRITE_PPOS_ERR = errors.New("Failed to Write ppos storage into disk")

	// The key of ppos storage in disk (leveldb)
	PPOS_STORAGE_KEY = []byte("PPOS_STORAGE_KEY")
)

Functions

func GetTicket

func GetTicket(txHash common.Hash) *types.Ticket

func PrintObject

func PrintObject(s string, obj interface{})

func PutTicket

func PutTicket(txHash common.Hash, ticket *types.Ticket)

func RemoveTicket

func RemoveTicket(txHash common.Hash)

Types

type CandidateInfo

type CandidateInfo struct {
	Deposit     string `protobuf:"bytes,1,opt,name=Deposit" json:"Deposit,omitempty"`
	BlockNumber string `protobuf:"bytes,2,opt,name=BlockNumber" json:"BlockNumber,omitempty"`
	TxIndex     uint32 `protobuf:"varint,3,opt,name=TxIndex" json:"TxIndex,omitempty"`
	CandidateId string `protobuf:"bytes,4,opt,name=CandidateId" json:"CandidateId,omitempty"`
	Host        string `protobuf:"bytes,5,opt,name=Host" json:"Host,omitempty"`
	Port        string `protobuf:"bytes,6,opt,name=Port" json:"Port,omitempty"`
	Owner       string `protobuf:"bytes,7,opt,name=Owner" json:"Owner,omitempty"`
	//  string    From          = 8;
	Extra  string `protobuf:"bytes,8,opt,name=Extra" json:"Extra,omitempty"`
	Fee    uint32 `protobuf:"varint,9,opt,name=Fee" json:"Fee,omitempty"`
	TxHash string `protobuf:"bytes,10,opt,name=TxHash" json:"TxHash,omitempty"`
	TOwner string `protobuf:"bytes,11,opt,name=TOwner" json:"TOwner,omitempty"`
}

func (*CandidateInfo) Descriptor

func (*CandidateInfo) Descriptor() ([]byte, []int)

func (*CandidateInfo) GetBlockNumber

func (m *CandidateInfo) GetBlockNumber() string

func (*CandidateInfo) GetCandidateId

func (m *CandidateInfo) GetCandidateId() string

func (*CandidateInfo) GetDeposit

func (m *CandidateInfo) GetDeposit() string

func (*CandidateInfo) GetExtra

func (m *CandidateInfo) GetExtra() string

func (*CandidateInfo) GetFee

func (m *CandidateInfo) GetFee() uint32

func (*CandidateInfo) GetHost

func (m *CandidateInfo) GetHost() string

func (*CandidateInfo) GetOwner

func (m *CandidateInfo) GetOwner() string

func (*CandidateInfo) GetPort

func (m *CandidateInfo) GetPort() string

func (*CandidateInfo) GetTOwner

func (m *CandidateInfo) GetTOwner() string

func (*CandidateInfo) GetTxHash

func (m *CandidateInfo) GetTxHash() string

func (*CandidateInfo) GetTxIndex

func (m *CandidateInfo) GetTxIndex() uint32

func (*CandidateInfo) ProtoMessage

func (*CandidateInfo) ProtoMessage()

func (*CandidateInfo) Reset

func (m *CandidateInfo) Reset()

func (*CandidateInfo) String

func (m *CandidateInfo) String() string

type CandidateTemp

type CandidateTemp struct {
	//  three round witness
	Pres  []*CandidateInfo `protobuf:"bytes,1,rep,name=pres" json:"pres,omitempty"`
	Currs []*CandidateInfo `protobuf:"bytes,2,rep,name=currs" json:"currs,omitempty"`
	Nexts []*CandidateInfo `protobuf:"bytes,3,rep,name=nexts" json:"nexts,omitempty"`
	// can pool
	Imms []*CandidateInfo `protobuf:"bytes,4,rep,name=imms" json:"imms,omitempty"`
	Res  []*CandidateInfo `protobuf:"bytes,5,rep,name=res" json:"res,omitempty"`
	// refunds
	Refunds map[string]*RefundArr `` /* 134-byte string literal not displayed */
}

func (*CandidateTemp) Descriptor

func (*CandidateTemp) Descriptor() ([]byte, []int)

func (*CandidateTemp) GetCurrs

func (m *CandidateTemp) GetCurrs() []*CandidateInfo

func (*CandidateTemp) GetImms

func (m *CandidateTemp) GetImms() []*CandidateInfo

func (*CandidateTemp) GetNexts

func (m *CandidateTemp) GetNexts() []*CandidateInfo

func (*CandidateTemp) GetPres

func (m *CandidateTemp) GetPres() []*CandidateInfo

func (*CandidateTemp) GetRefunds

func (m *CandidateTemp) GetRefunds() map[string]*RefundArr

func (*CandidateTemp) GetRes

func (m *CandidateTemp) GetRes() []*CandidateInfo

func (*CandidateTemp) ProtoMessage

func (*CandidateTemp) ProtoMessage()

func (*CandidateTemp) Reset

func (m *CandidateTemp) Reset()

func (*CandidateTemp) String

func (m *CandidateTemp) String() string

type Field

type Field struct {
	TxHash    string `protobuf:"bytes,1,opt,name=TxHash" json:"TxHash,omitempty"`
	Remaining uint32 `protobuf:"varint,2,opt,name=Remaining" json:"Remaining,omitempty"`
	Price     string `protobuf:"bytes,3,opt,name=Price" json:"Price,omitempty"`
}

func (*Field) Descriptor

func (*Field) Descriptor() ([]byte, []int)

func (*Field) GetPrice

func (m *Field) GetPrice() string

func (*Field) GetRemaining

func (m *Field) GetRemaining() uint32

func (*Field) GetTxHash

func (m *Field) GetTxHash() string

func (*Field) ProtoMessage

func (*Field) ProtoMessage()

func (*Field) Reset

func (m *Field) Reset()

func (*Field) String

func (m *Field) String() string

type PB_PPosTemp

type PB_PPosTemp struct {
	CanTmp      *CandidateTemp `protobuf:"bytes,1,opt,name=CanTmp" json:"CanTmp,omitempty"`
	TickTmp     *TicketTemp    `protobuf:"bytes,2,opt,name=TickTmp" json:"TickTmp,omitempty"`
	BlockNumber string         `protobuf:"bytes,3,opt,name=BlockNumber" json:"BlockNumber,omitempty"`
	BlockHash   string         `protobuf:"bytes,4,opt,name=BlockHash" json:"BlockHash,omitempty"`
}

func (*PB_PPosTemp) Descriptor

func (*PB_PPosTemp) Descriptor() ([]byte, []int)

func (*PB_PPosTemp) GetBlockHash

func (m *PB_PPosTemp) GetBlockHash() string

func (*PB_PPosTemp) GetBlockNumber

func (m *PB_PPosTemp) GetBlockNumber() string

func (*PB_PPosTemp) GetCanTmp

func (m *PB_PPosTemp) GetCanTmp() *CandidateTemp

func (*PB_PPosTemp) GetTickTmp

func (m *PB_PPosTemp) GetTickTmp() *TicketTemp

func (*PB_PPosTemp) ProtoMessage

func (*PB_PPosTemp) ProtoMessage()

func (*PB_PPosTemp) Reset

func (m *PB_PPosTemp) Reset()

func (*PB_PPosTemp) String

func (m *PB_PPosTemp) String() string

type PPOS_TEMP

type PPOS_TEMP struct {
	BlockNumber *big.Int
	BlockHash   common.Hash

	// Record block total count
	BlockCount uint32

	// global data temp
	TempMap numTempMap
	// contains filtered or unexported fields
}

Global PPOS Dependency TEMP

func GetPPosTempPtr

func GetPPosTempPtr() *PPOS_TEMP

func NewPPosTemp

func NewPPosTemp(db ethdb.Database) *PPOS_TEMP

func (*PPOS_TEMP) Commit2DB

func (temp *PPOS_TEMP) Commit2DB(blockNumber *big.Int, blockHash common.Hash) error

func (*PPOS_TEMP) GetPPosStorageProto

func (temp *PPOS_TEMP) GetPPosStorageProto() (common.Hash, []byte, error)

Gets ppos_storag pb from db

func (*PPOS_TEMP) PushPPosStorageProto

func (temp *PPOS_TEMP) PushPPosStorageProto(data []byte) error

Flush data into db

func (*PPOS_TEMP) SubmitPposCache2Temp

func (temp *PPOS_TEMP) SubmitPposCache2Temp(blockNumber, blockInterval *big.Int, blockHash common.Hash, storage *Ppos_storage)

Set ppos storage cache by same block

type Ppos_storage

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

func BuildPposCache

func BuildPposCache(blockNumber *big.Int, blockHash common.Hash) *Ppos_storage

func NewPPOS_storage

func NewPPOS_storage() *Ppos_storage

func (*Ppos_storage) AppendRefunds

func (p *Ppos_storage) AppendRefunds(nodeId discover.NodeID, refundArr types.RefundQueue)

func (*Ppos_storage) AppendTicket

func (p *Ppos_storage) AppendTicket(nodeId discover.NodeID, txHash common.Hash, count uint32, price *big.Int) error

func (*Ppos_storage) CalculateHash

func (p *Ppos_storage) CalculateHash(blockNumber *big.Int, blockHash common.Hash) (common.Hash, error)

func (*Ppos_storage) Copy

func (ps *Ppos_storage) Copy() *Ppos_storage

func (*Ppos_storage) CopyCandidateStorage

func (p *Ppos_storage) CopyCandidateStorage() *candidate_temp

func (*Ppos_storage) CopyTicketStorage

func (p *Ppos_storage) CopyTicketStorage() *ticket_temp

func (*Ppos_storage) DelCandidateQueue

func (p *Ppos_storage) DelCandidateQueue(flag int)

Delete CandidateQueue

func (*Ppos_storage) DelRefunds

func (p *Ppos_storage) DelRefunds(nodeId discover.NodeID)

Delete RefundArr

func (*Ppos_storage) GetCandidateQueue

func (p *Ppos_storage) GetCandidateQueue(flag int) types.CandidateQueue

Get CandidateQueue flag: 0: previous witness 1: current witness 2: next witness 3: immediate 4: reserve

func (*Ppos_storage) GetCandidateTicketAge

func (p *Ppos_storage) GetCandidateTicketAge(nodeId discover.NodeID) uint64

func (*Ppos_storage) GetCandidateTicketCount

func (p *Ppos_storage) GetCandidateTicketCount(nodeId discover.NodeID) uint32

func (*Ppos_storage) GetCandidateTxHashs

func (p *Ppos_storage) GetCandidateTxHashs(nodeId discover.NodeID) []common.Hash

func (*Ppos_storage) GetRefunds

func (p *Ppos_storage) GetRefunds(nodeId discover.NodeID) types.RefundQueue

Get Refund

func (*Ppos_storage) GetTicketDependency

func (p *Ppos_storage) GetTicketDependency(nodeId discover.NodeID) *ticketDependency

Get ticket dependency

func (*Ppos_storage) GetTicketInfo

func (p *Ppos_storage) GetTicketInfo(txHash common.Hash) *ticketInfo

func (*Ppos_storage) GetTicketRemainByTxHash

func (p *Ppos_storage) GetTicketRemainByTxHash(txHash common.Hash) uint32

func (*Ppos_storage) GetTotalRemian

func (p *Ppos_storage) GetTotalRemian() int32

Get total remian

func (*Ppos_storage) RemoveTicket

func (p *Ppos_storage) RemoveTicket(nodeId discover.NodeID, txHash common.Hash) (*ticketInfo, error)

func (*Ppos_storage) RemoveTicketDependency

func (p *Ppos_storage) RemoveTicketDependency(nodeId discover.NodeID)

func (*Ppos_storage) SetCandidateQueue

func (p *Ppos_storage) SetCandidateQueue(queue types.CandidateQueue, flag int)

Set CandidateQueue

func (*Ppos_storage) SetCandidateTicketAge

func (p *Ppos_storage) SetCandidateTicketAge(nodeId discover.NodeID, age uint64)

func (*Ppos_storage) SetRefund

func (p *Ppos_storage) SetRefund(nodeId discover.NodeID, refund *types.CandidateRefund)

Set Refund

func (*Ppos_storage) SetRefunds

func (p *Ppos_storage) SetRefunds(nodeId discover.NodeID, refundArr types.RefundQueue)

func (*Ppos_storage) SetTicketDependency

func (p *Ppos_storage) SetTicketDependency(nodeId discover.NodeID, ependency *ticketDependency)

Set ticket dependency

func (*Ppos_storage) SetTotalRemain

func (p *Ppos_storage) SetTotalRemain(count int32)

Set total remain

func (*Ppos_storage) SubTicket

func (p *Ppos_storage) SubTicket(nodeId discover.NodeID, txHash common.Hash) (*ticketInfo, error)

type Refund

type Refund struct {
	Deposit     string `protobuf:"bytes,1,opt,name=Deposit" json:"Deposit,omitempty"`
	BlockNumber string `protobuf:"bytes,2,opt,name=BlockNumber" json:"BlockNumber,omitempty"`
	Owner       string `protobuf:"bytes,3,opt,name=Owner" json:"Owner,omitempty"`
}

func (*Refund) Descriptor

func (*Refund) Descriptor() ([]byte, []int)

func (*Refund) GetBlockNumber

func (m *Refund) GetBlockNumber() string

func (*Refund) GetDeposit

func (m *Refund) GetDeposit() string

func (*Refund) GetOwner

func (m *Refund) GetOwner() string

func (*Refund) ProtoMessage

func (*Refund) ProtoMessage()

func (*Refund) Reset

func (m *Refund) Reset()

func (*Refund) String

func (m *Refund) String() string

type RefundArr

type RefundArr struct {
	Defeats []*Refund `protobuf:"bytes,1,rep,name=Defeats" json:"Defeats,omitempty"`
}

func (*RefundArr) Descriptor

func (*RefundArr) Descriptor() ([]byte, []int)

func (*RefundArr) GetDefeats

func (m *RefundArr) GetDefeats() []*Refund

func (*RefundArr) ProtoMessage

func (*RefundArr) ProtoMessage()

func (*RefundArr) Reset

func (m *RefundArr) Reset()

func (*RefundArr) String

func (m *RefundArr) String() string

type SortTemp

type SortTemp struct {
	// can dependency
	Cans    []*CandidateInfo `protobuf:"bytes,1,rep,name=cans" json:"cans,omitempty"`
	ReIds   []string         `protobuf:"bytes,2,rep,name=reIds" json:"reIds,omitempty"`
	Refunds []*RefundArr     `protobuf:"bytes,3,rep,name=refunds" json:"refunds,omitempty"`
	// tick dependency
	Sq      int32               `protobuf:"varint,4,opt,name=sq" json:"sq,omitempty"`
	NodeIds []string            `protobuf:"bytes,5,rep,name=nodeIds" json:"nodeIds,omitempty"`
	Deps    []*TicketDependency `protobuf:"bytes,6,rep,name=deps" json:"deps,omitempty"`
}

func (*SortTemp) Descriptor

func (*SortTemp) Descriptor() ([]byte, []int)

func (*SortTemp) GetCans

func (m *SortTemp) GetCans() []*CandidateInfo

func (*SortTemp) GetDeps

func (m *SortTemp) GetDeps() []*TicketDependency

func (*SortTemp) GetNodeIds

func (m *SortTemp) GetNodeIds() []string

func (*SortTemp) GetReIds

func (m *SortTemp) GetReIds() []string

func (*SortTemp) GetRefunds

func (m *SortTemp) GetRefunds() []*RefundArr

func (*SortTemp) GetSq

func (m *SortTemp) GetSq() int32

func (*SortTemp) ProtoMessage

func (*SortTemp) ProtoMessage()

func (*SortTemp) Reset

func (m *SortTemp) Reset()

func (*SortTemp) String

func (m *SortTemp) String() string

type TicketDependency

type TicketDependency struct {
	//    uint64  Age = 1;
	Num uint32 `protobuf:"varint,2,opt,name=Num" json:"Num,omitempty"`
	//    repeated bytes  Tids = 3;
	Tinfo []*Field `protobuf:"bytes,3,rep,name=Tinfo" json:"Tinfo,omitempty"`
}

func (*TicketDependency) Descriptor

func (*TicketDependency) Descriptor() ([]byte, []int)

func (*TicketDependency) GetNum

func (m *TicketDependency) GetNum() uint32

func (*TicketDependency) GetTinfo

func (m *TicketDependency) GetTinfo() []*Field

func (*TicketDependency) ProtoMessage

func (*TicketDependency) ProtoMessage()

func (*TicketDependency) Reset

func (m *TicketDependency) Reset()

func (*TicketDependency) String

func (m *TicketDependency) String() string

type TicketTemp

type TicketTemp struct {
	Sq int32 `protobuf:"varint,1,opt,name=Sq" json:"Sq,omitempty"`
	//    map<string, TicketInfo> Infos = 2;
	//    map<string, TxHashArr> Ets  = 3;
	Dependencys map[string]*TicketDependency `` /* 142-byte string literal not displayed */
}

func (*TicketTemp) Descriptor

func (*TicketTemp) Descriptor() ([]byte, []int)

func (*TicketTemp) GetDependencys

func (m *TicketTemp) GetDependencys() map[string]*TicketDependency

func (*TicketTemp) GetSq

func (m *TicketTemp) GetSq() int32

func (*TicketTemp) ProtoMessage

func (*TicketTemp) ProtoMessage()

func (*TicketTemp) Reset

func (m *TicketTemp) Reset()

func (*TicketTemp) String

func (m *TicketTemp) String() string

Jump to

Keyboard shortcuts

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