types

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package types provides generalized types that are used across the transport interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	Header          BatchHeader   `json:"header"`
	HeaderSignature string        `json:"header_signature"`
	Trace           bool          `json:"trace"`
	Transactions    []Transaction `json:"transactions"`
}

Batch represents a Sawtooth batch.

func BatchFromProto

func BatchFromProto(batchProto *batch_pb2.Batch) (*Batch, error)

BatchFromProto converts a Batch protobuf into our own Batch object.

type BatchHeader

type BatchHeader struct {
	SignerPublicKey string   `json:"signer_public_key"`
	TransactionIds  []string `json:"transaction_ids"`
}

BatchHeader represents a Sawtooth batch header.

type BatchIterator

type BatchIterator interface {
	CommonIterator
	Current() (*Batch, error)
}

BatchIterator is an interface that represents an iterator over batches.

type BatchStatus

type BatchStatus string

BatchStatus represents a Sawtooth batch status.

const (
	BATCH_STATUS_PENDING   BatchStatus = "PENDING"
	BATCH_STATUS_COMMITTED BatchStatus = "COMMITTED"
	BATCH_STATUS_INVALID   BatchStatus = "INVALID"
	BATCH_STATUS_UNKNOWN   BatchStatus = "UNKNOWN"
)

type Block

type Block struct {
	Batches         []Batch     `json:"batches"`
	Header          BlockHeader `json:"header"`
	HeaderSignature string      `json:"header_signature"`
}

Block represents a Sawtooth block.

func BlockFromProto

func BlockFromProto(blockProto *block_pb2.Block) (*Block, error)

BlockFromProto converts a Block protobuf into our own Block object.

type BlockHeader

type BlockHeader struct {
	BatchIds        []string `json:"batch_ids"`
	BlockNum        string   `json:"block_num"`
	Consensus       []byte   `json:"consensus"`
	PreviousBlockId string   `json:"previous_block_id"`
	SignerPublicKey string   `json:"signer_public_key"`
	StateRootHash   string   `json:"state_root_hash"`
}

BlockHeader represents a Sawtooth block header.

type BlockIterator

type BlockIterator interface {
	CommonIterator
	Current() (*Block, error)
}

BlockIterator is an interface that represents an iterator over blocks.

type CommonIterator

type CommonIterator interface {
	Next() bool
	Error() error
}

CommonIterator is an interface that provides methods common to all iterators.

type State

type State struct {
	Data    []byte
	Address string
	Head    string
}

State represents a Sawtooth state item.

type StateIterator

type StateIterator interface {
	CommonIterator
	Current() (*State, error)
}

StateIterator is an interface that represents an iterator over state.

type Transaction

type Transaction struct {
	Header          TransactionHeader `json:"header"`
	HeaderSignature string            `json:"header_signature"`
	Payload         []byte            `json:"payload"`
}

Transaction represents a Sawtooth transaction.

func TransactionFromProto

func TransactionFromProto(transactionProto *transaction_pb2.Transaction) (*Transaction, error)

TransactionFromProto converts a Transaction protobuf into our own Transaction object.

type TransactionHeader

type TransactionHeader struct {
	BatcherPublicKey string   `json:"batcher_public_key"`
	Dependencies     []string `json:"dependencies"`
	FamilyName       string   `json:"family_name"`
	FamilyVersion    string   `json:"family_version"`
	Inputs           []string `json:"inputs"`
	Nonce            string   `json:"nonce"`
	Outputs          []string `json:"outputs"`
	PayloadSHA256    string   `json:"payload_sha256"`
	SignerPublicKey  string   `json:"signer_public_key"`
}

TransactionHeader represents a Sawtooth transaction header.

type TransactionIterator

type TransactionIterator interface {
	CommonIterator
	Current() (*Transaction, error)
}

TransactionIterator is an interface that represents an iterator over transactions.

Jump to

Keyboard shortcuts

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