ticketcache

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//error def
	ErrNotfindFromNodeId = errors.New("Not find tickets from node id")
	ErrProbufMarshal     = errors.New("protocol buffer Marshal faile")
	ErrLeveldbPut        = errors.New("level db put faile")
)

Functions

func Hash

func Hash(cache TicketCache) (common.Hash, error)

Types

type BlockNodes

type BlockNodes struct {
	BNodes               map[string]*NodeTicketIds `` /* 153-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                  `json:"-"`
	XXX_unrecognized     []byte                    `json:"-"`
	XXX_sizecache        int32                     `json:"-"`
}

func (*BlockNodes) Descriptor

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

func (*BlockNodes) GetBNodes

func (m *BlockNodes) GetBNodes() map[string]*NodeTicketIds

func (*BlockNodes) ProtoMessage

func (*BlockNodes) ProtoMessage()

func (*BlockNodes) Reset

func (m *BlockNodes) Reset()

func (*BlockNodes) String

func (m *BlockNodes) String() string

func (*BlockNodes) XXX_DiscardUnknown

func (m *BlockNodes) XXX_DiscardUnknown()

func (*BlockNodes) XXX_Marshal

func (m *BlockNodes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BlockNodes) XXX_Merge

func (m *BlockNodes) XXX_Merge(src proto.Message)

func (*BlockNodes) XXX_Size

func (m *BlockNodes) XXX_Size() int

func (*BlockNodes) XXX_Unmarshal

func (m *BlockNodes) XXX_Unmarshal(b []byte) error

type NodeTicketIds

type NodeTicketIds struct {
	NTickets             map[string]*TicketIds `` /* 157-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}              `json:"-"`
	XXX_unrecognized     []byte                `json:"-"`
	XXX_sizecache        int32                 `json:"-"`
}

func (*NodeTicketIds) Descriptor

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

func (*NodeTicketIds) GetNTickets

func (m *NodeTicketIds) GetNTickets() map[string]*TicketIds

func (*NodeTicketIds) ProtoMessage

func (*NodeTicketIds) ProtoMessage()

func (*NodeTicketIds) Reset

func (m *NodeTicketIds) Reset()

func (*NodeTicketIds) String

func (m *NodeTicketIds) String() string

func (*NodeTicketIds) XXX_DiscardUnknown

func (m *NodeTicketIds) XXX_DiscardUnknown()

func (*NodeTicketIds) XXX_Marshal

func (m *NodeTicketIds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NodeTicketIds) XXX_Merge

func (m *NodeTicketIds) XXX_Merge(src proto.Message)

func (*NodeTicketIds) XXX_Size

func (m *NodeTicketIds) XXX_Size() int

func (*NodeTicketIds) XXX_Unmarshal

func (m *NodeTicketIds) XXX_Unmarshal(b []byte) error

type NumBlocks

type NumBlocks struct {
	NBlocks              map[string]*BlockNodes `` /* 155-byte string literal not displayed */
	BlockCount           uint32                 `protobuf:"varint,2,opt,name=BlockCount,proto3" json:"BlockCount,omitempty"`
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

func (*NumBlocks) Descriptor

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

func (*NumBlocks) GetBlockCount

func (m *NumBlocks) GetBlockCount() uint32

func (*NumBlocks) GetNBlocks

func (m *NumBlocks) GetNBlocks() map[string]*BlockNodes

func (*NumBlocks) ProtoMessage

func (*NumBlocks) ProtoMessage()

func (*NumBlocks) Reset

func (m *NumBlocks) Reset()

func (*NumBlocks) String

func (m *NumBlocks) String() string

func (*NumBlocks) XXX_DiscardUnknown

func (m *NumBlocks) XXX_DiscardUnknown()

func (*NumBlocks) XXX_Marshal

func (m *NumBlocks) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NumBlocks) XXX_Merge

func (m *NumBlocks) XXX_Merge(src proto.Message)

func (*NumBlocks) XXX_Size

func (m *NumBlocks) XXX_Size() int

func (*NumBlocks) XXX_Unmarshal

func (m *NumBlocks) XXX_Unmarshal(b []byte) error

type SortCalcHash

type SortCalcHash struct {
	Nodeids              []string     `protobuf:"bytes,1,rep,name=Nodeids,proto3" json:"Nodeids,omitempty"`
	Tids                 []*TicketIds `protobuf:"bytes,2,rep,name=Tids,proto3" json:"Tids,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func (*SortCalcHash) Descriptor

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

func (*SortCalcHash) GetNodeids

func (m *SortCalcHash) GetNodeids() []string

func (*SortCalcHash) GetTids

func (m *SortCalcHash) GetTids() []*TicketIds

func (*SortCalcHash) ProtoMessage

func (*SortCalcHash) ProtoMessage()

func (*SortCalcHash) Reset

func (m *SortCalcHash) Reset()

func (*SortCalcHash) String

func (m *SortCalcHash) String() string

func (*SortCalcHash) XXX_DiscardUnknown

func (m *SortCalcHash) XXX_DiscardUnknown()

func (*SortCalcHash) XXX_Marshal

func (m *SortCalcHash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SortCalcHash) XXX_Merge

func (m *SortCalcHash) XXX_Merge(src proto.Message)

func (*SortCalcHash) XXX_Size

func (m *SortCalcHash) XXX_Size() int

func (*SortCalcHash) XXX_Unmarshal

func (m *SortCalcHash) XXX_Unmarshal(b []byte) error

type TicketCache

type TicketCache map[discover.NodeID][]common.Hash

func GetNodeTicketsCacheMap

func GetNodeTicketsCacheMap(blocknumber *big.Int, blockhash common.Hash) (ret TicketCache)

Create a ticket cache by blocknumber and blockHash from global temp

func NewTicketCache

func NewTicketCache() TicketCache

func (TicketCache) AppendTicketCache

func (tc TicketCache) AppendTicketCache(nodeid discover.NodeID, tids []common.Hash)

func (TicketCache) GetSortStruct

func (tc TicketCache) GetSortStruct() *SortCalcHash

func (TicketCache) GetTicketCache

func (tc TicketCache) GetTicketCache(nodeid discover.NodeID) ([]common.Hash, error)

func (TicketCache) RemoveTicketCache

func (tc TicketCache) RemoveTicketCache(nodeid discover.NodeID, tids []common.Hash) error

func (TicketCache) TCount

func (tc TicketCache) TCount(nodeid discover.NodeID) uint64

func (TicketCache) TicketCaceheSnapshot

func (tc TicketCache) TicketCaceheSnapshot() TicketCache

copy a cache as (nodeId => []ticketId)

type TicketIds

type TicketIds struct {
	TicketId             [][]byte `protobuf:"bytes,1,rep,name=TicketId,proto3" json:"TicketId,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*TicketIds) Descriptor

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

func (*TicketIds) GetTicketId

func (m *TicketIds) GetTicketId() [][]byte

func (*TicketIds) ProtoMessage

func (*TicketIds) ProtoMessage()

func (*TicketIds) Reset

func (m *TicketIds) Reset()

func (*TicketIds) String

func (m *TicketIds) String() string

func (*TicketIds) XXX_DiscardUnknown

func (m *TicketIds) XXX_DiscardUnknown()

func (*TicketIds) XXX_Marshal

func (m *TicketIds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TicketIds) XXX_Merge

func (m *TicketIds) XXX_Merge(src proto.Message)

func (*TicketIds) XXX_Size

func (m *TicketIds) XXX_Size() int

func (*TicketIds) XXX_Unmarshal

func (m *TicketIds) XXX_Unmarshal(b []byte) error

type TicketTempCache

type TicketTempCache struct {
	Cache *NumBlocks
	// contains filtered or unexported fields
}

func GetTicketidsCachePtr

func GetTicketidsCachePtr() *TicketTempCache

func NewTicketIdsCache

func NewTicketIdsCache(db ethdb.Database) *TicketTempCache

func NewTicketIdsCache(db ethdb.Database) *NumBlocks {

func (*TicketTempCache) Commit

func (t *TicketTempCache) Commit(db ethdb.Database, currentBlockNumber *big.Int, currentBlockHash common.Hash) error

func (*TicketTempCache) GetNodeTicketsMap

func (t *TicketTempCache) GetNodeTicketsMap(blocknumber *big.Int, blockhash common.Hash) TicketCache

func (*TicketTempCache) Submit2Cache

func (t *TicketTempCache) Submit2Cache(blocknumber, blockInterval *big.Int, blockhash common.Hash, in TicketCache)

type Timer

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

func (*Timer) Begin

func (t *Timer) Begin()

func (*Timer) End

func (t *Timer) End() float64

Jump to

Keyboard shortcuts

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