core

package
v0.0.0-...-979cceb Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FMsgTag uint8 = iota

	BMsgTag
	LMsgTag
	TMsgTag
)
View Source
const Batchsize = 1000

Variables

View Source
var ReflectedTypesMap = map[uint8]reflect.Type{
	FMsgTag: reflect.TypeOf(fmsg),
	LMsgTag: reflect.TypeOf(lmsg),
	BMsgTag: reflect.TypeOf(bmsg),
	TMsgTag: reflect.TypeOf(tmsg),
}

Functions

This section is empty.

Types

type BasicMsg

type BasicMsg struct {
	Rn         int      `json:"rn"`
	References [][]byte `json:"references"`
	Source     []byte   `json:"source"`
	Hash       []byte   `json:hash`
	// contains filtered or unexported fields
}

func NewBasicMsg

func NewBasicMsg(rn int, refs [][]byte, source []byte) (*BasicMsg, error)

func (*BasicMsg) AfterAttach

func (m *BasicMsg) AfterAttach(n *Node) error

func (*BasicMsg) DisplayinJson

func (m *BasicMsg) DisplayinJson() error

func (*BasicMsg) Encode

func (m *BasicMsg) Encode() ([]byte, error)

func (*BasicMsg) GetHash

func (m *BasicMsg) GetHash() []byte

func (*BasicMsg) GetRN

func (m *BasicMsg) GetRN() int

func (*BasicMsg) GetRefs

func (m *BasicMsg) GetRefs() [][]byte

func (*BasicMsg) GetSource

func (m *BasicMsg) GetSource() []byte

func (*BasicMsg) HavePath

func (m *BasicMsg) HavePath(msg Message, rounds []*Round, targetround *Round) (bool, error)

func (*BasicMsg) VerifyFields

func (m *BasicMsg) VerifyFields(n *Node) error

type Blockchain

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

func NewBlockchain

func NewBlockchain() (*Blockchain, error)

func (*Blockchain) AddRound

func (bc *Blockchain) AddRound(round *Round)

func (*Blockchain) GetRound

func (bc *Blockchain) GetRound(round int) *Round

type FRoundMsg

type FRoundMsg struct {
	*BasicMsg
}

type LRoundMsg

type LRoundMsg struct {
	*BasicMsg
	ARefs [][]byte `json:arefs`
}

func NewLroundMsg

func NewLroundMsg(arefs [][]byte, b *BasicMsg) (*LRoundMsg, error)

func (*LRoundMsg) AfterAttach

func (lm *LRoundMsg) AfterAttach(n *Node) error

func (*LRoundMsg) GetARefs

func (lm *LRoundMsg) GetARefs() [][]byte

type LeaderSelector

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

func NewLeaderSelector

func NewLeaderSelector(n *Node) *LeaderSelector

func (*LeaderSelector) ChooseLeader

func (ls *LeaderSelector) ChooseLeader(sigs *SigsPerWave) (int, error)

type Message

type Message interface {
	Encode() ([]byte, error)
	DisplayinJson() error
	//MarshalJSON() ([]byte, error)
	GetRefs() [][]byte
	HavePath(msg Message, msgbyrounds []*Round, targetmsground *Round) (bool, error)

	GetRN() int
	GetHash() []byte
	GetSource() []byte

	VerifyFields(*Node) error

	AfterAttach(*Node) error
}

type Messagehandler

type Messagehandler interface {
	// contains filtered or unexported methods
}

type Node

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

func NewNode

func NewNode(filepath string) (*Node, error)

func StartandConnect

func StartandConnect() (*Node, error)

func (*Node) HandleMsgForever

func (n *Node) HandleMsgForever()

func (*Node) SendForever

func (n *Node) SendForever()

func (*Node) SendMsg

func (n *Node) SendMsg(messagetype uint8, msg interface{}, sig []byte, dest string) error

func (*Node) SendMsgToAll

func (n *Node) SendMsgToAll(messagetype uint8, msg interface{}, sig []byte) error

type PlainMsg

type PlainMsg struct {
	Msg []byte
}

type Round

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

type SigsPerWave

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

type StaticCommitter

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

func NewStaticCommitter

func NewStaticCommitter(n *Node) *StaticCommitter

type Statichandler

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

func NewStatichandler

func NewStatichandler(n *Node) *Statichandler

func (*Statichandler) VerifyandCheckMsg

func (sh *Statichandler) VerifyandCheckMsg(msg Message, sig []byte, msgbytes []byte) error

type ThresSigMsg

type ThresSigMsg struct {
	Sig []byte `json:sig`
	//wave number
	Wn     int    `json:wn`
	Source []byte `json:source`
}

Jump to

Keyboard shortcuts

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