nr

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: LGPL-3.0 Imports: 8 Imported by: 0

README

ranking

Src of Nebulas Rank.

Documentation

Index

Constants

View Source
const (
	CacheSize = 128
)

Variables

View Source
var (
	ErrInvalidStartHeight    = errors.New("invalid nr start height")
	ErrInvalidEndHeight      = errors.New("invalid nr end height")
	ErrInvalidHeightInterval = errors.New("invalid nr height interval")
	ErrNRNotFound            = errors.New("nr not found")
	ErrNRSummaryNotFound     = errors.New("nr summary not found")
)

Error types

Functions

This section is empty.

Types

type NR

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

func NewNR

func NewNR(neb Neblet) (*NR, error)

NewNR create nr

func (*NR) GetNRListByHeight

func (n *NR) GetNRListByHeight(height uint64) (core.Data, error)

GetNRListByHeight return nr list, which subtract the deplay height, ensure all node is equal.

func (*NR) GetNRSummary

func (n *NR) GetNRSummary(height uint64) (core.Data, error)

GetNRSummary return nr summary info, which subtract the deplay height, ensure all node is equal.

type NRData

type NRData struct {
	StartHeight uint64    `json:"start_height,string"`
	EndHeight   uint64    `json:"end_height,string"`
	Version     uint64    `json:"version,string"`
	Nrs         []*NRItem `json:"nrs"`
	Err         string    `json:"err"`
}

NRData nr data

func (*NRData) FromBytes

func (n *NRData) FromBytes(data []byte) error

FromBytes

func (*NRData) ToBytes

func (n *NRData) ToBytes() ([]byte, error)

ToBytes serialize data

type NRItem

type NRItem struct {
	Address string `json:"address"`
	Median  string `json:"median"`
	Weight  string `json:"weight"`
	Score   string `json:"score"`
}

NRItem nr item

func (*NRItem) FromBytes

func (n *NRItem) FromBytes(data []byte) error

FromBytes

func (*NRItem) ToBytes

func (n *NRItem) ToBytes() ([]byte, error)

ToBytes serialize data

type NRResults

type NRResults struct {
	NrResults []string `json:"nr_results"`
}

type NRSummary

type NRSummary struct {
	StartHeight uint64         `json:"start_height,string"`
	EndHeight   uint64         `json:"end_height,string"`
	Version     uint64         `json:"version,string"`
	Sum         *NRSummaryData `json:"sum"`
	Err         string         `json:"err"`
}

func (*NRSummary) FromBytes

func (n *NRSummary) FromBytes(data []byte) error

FromBytes

func (*NRSummary) ToBytes

func (n *NRSummary) ToBytes() ([]byte, error)

ToBytes serialize data

type NRSummaryData

type NRSummaryData struct {
	InOuts string `json:"in_outs"`
	Score  string `json:"score"`
}

func (*NRSummaryData) FromBytes

func (n *NRSummaryData) FromBytes(data []byte) error

FromBytes

func (*NRSummaryData) ToBytes

func (n *NRSummaryData) ToBytes() ([]byte, error)

ToBytes serialize data

type NRSums

type NRSums struct {
	NrSums []string `json:"nr_sums"`
}

type Neblet

type Neblet interface {
	Config() *nebletpb.Config
	BlockChain() *core.BlockChain
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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