btp

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NSFilterCap = 256 / 8
)

Variables

View Source
var ZeroBTPSection = newBTPSection(nil, nil)
View Source
var ZeroDigest = &digest{
	core: zeroDigestCore{},
}
View Source
var ZeroProofContextMap = &proofContextMap{
	pcMap: make(map[int64]module.BTPProofContext),
}

Functions

func NewBTPBlockHeader added in v1.3.2

func NewBTPBlockHeader(
	height int64,
	round int32,
	nts module.NetworkTypeSection,
	nid int64,
	flag uint,
) (module.BTPBlockHeader, error)

NewBTPBlockHeader returns a new BTPBlockHeader for the height and nid. If flag's IncludeNextProofContext bit is on, the header includes NextProofContext.

func NewDigestFromBytes

func NewDigestFromBytes(bytes []byte) (module.BTPDigest, error)

func NewDigestFromHashAndBytes

func NewDigestFromHashAndBytes(
	hash []byte,
	bytes []byte,
) (module.BTPDigest, error)

func NewDigestWithBuilder

func NewDigestWithBuilder(builder merkle.Builder, hash []byte) (module.BTPDigest, error)

func NewProofContextMap

func NewProofContextMap(view StateView) (module.BTPProofContextMap, error)

func NewSection

func NewSection(
	digest module.BTPDigest,
	view StateView,
	dbase db.Database,
) (module.BTPSection, error)

NewSection returns a new Section. view shall have the final value for a transition.

Types

type NetworkTypeView

type NetworkTypeView interface {
	UID() string
	NextProofContextHash() []byte
	NextProofContext() []byte
	OpenNetworkIDs() []int64
}

type NetworkView

type NetworkView interface {
	Name() string
	Owner() module.Address
	NetworkTypeID() int64
	Open() bool
	NextMessageSN() int64
	NextProofContextChanged() bool
	PrevNetworkSectionHash() []byte
	LastNetworkSectionHash() []byte
}

type SectionBuilder

type SectionBuilder interface {
	SendMessage(nid int64, msg []byte)
	EnsureSection(nid int64)
	NotifyInactivated(ntid int64)
	Build() (module.BTPSection, error)
}

func NewSectionBuilder

func NewSectionBuilder(view StateView) SectionBuilder

NewSectionBuilder returns new SectionBuilder. view shall have the final value for a transition except Network's PrevNetworkSectionHash and LastNetworkSectionHash fields. The two fields shall have initial value for the transition.

type StateView

type StateView interface {
	GetNetworkTypeIDs() ([]int64, error)
	GetNetworkView(nid int64) (NetworkView, error)
	GetNetworkTypeView(ntid int64) (NetworkTypeView, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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