requestconsumer

package
v0.0.0-...-2a45ea8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleBlock

type SimpleBlock struct {
	Height        uint64
	PrevBlockHash []byte
	Payload       []byte
}

SimpleBlock defines a basic block structure composed of blockheight and previous block hash.

func (*SimpleBlock) Hash

func (b *SimpleBlock) Hash() []byte

Hash returns block hash

func (*SimpleBlock) MarshalBinary

func (b *SimpleBlock) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface for SimpleBlock

func (*SimpleBlock) UnmarshalBinary

func (b *SimpleBlock) UnmarshalBinary(marshaled []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface for SimpleBlock

type SimpleLedger

type SimpleLedger struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SimpleLedger implements `RequestConsumer` interface. It defines a queue of delivered messages as the `blockchain` and simply print out the new message.

func NewSimpleLedger

func NewSimpleLedger() *SimpleLedger

NewSimpleLedger initializes an object of SimpleLedger

func (*SimpleLedger) Deliver

func (l *SimpleLedger) Deliver(msg []byte) <-chan []byte

Deliver implements the RequestConsumer interface. It forwards the committed transaction message to the processing queue and returns the result

func (*SimpleLedger) GetLength

func (l *SimpleLedger) GetLength() uint64

GetLength returns the number of the blocks in the ledger

func (*SimpleLedger) StateDigest

func (l *SimpleLedger) StateDigest() []byte

StateDigest returns the hash of the latest block as the digest of the system state

Jump to

Keyboard shortcuts

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