common

package
v0.0.0-...-cfcde66 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlockMetadataIndex_name = map[int32]string{
	0: "SIGNATURES",
	1: "LAST_CONFIG",
	2: "TRANSACTIONS_FILTER",
	3: "ORDERER",
}
View Source
var BlockMetadataIndex_value = map[string]int32{
	"SIGNATURES":          0,
	"LAST_CONFIG":         1,
	"TRANSACTIONS_FILTER": 2,
	"ORDERER":             3,
}
View Source
var HeaderType_name = map[int32]string{
	0: "MESSAGE",
	1: "CONFIG",
	2: "CONFIG_UPDATE",
	3: "ENDORSER_TRANSACTION",
	4: "ORDERER_TRANSACTION",
	5: "DELIVER_SEEK_INFO",
	6: "CHAINCODE_PACKAGE",
	7: "PEER_RESOURCE_UPDATE",
}
View Source
var HeaderType_value = map[string]int32{
	"MESSAGE":              0,
	"CONFIG":               1,
	"CONFIG_UPDATE":        2,
	"ENDORSER_TRANSACTION": 3,
	"ORDERER_TRANSACTION":  4,
	"DELIVER_SEEK_INFO":    5,
	"CHAINCODE_PACKAGE":    6,
	"PEER_RESOURCE_UPDATE": 7,
}
View Source
var Status_name = map[int32]string{
	0:   "UNKNOWN",
	200: "SUCCESS",
	400: "BAD_REQUEST",
	403: "FORBIDDEN",
	404: "NOT_FOUND",
	413: "REQUEST_ENTITY_TOO_LARGE",
	500: "INTERNAL_SERVER_ERROR",
	501: "NOT_IMPLEMENTED",
	503: "SERVICE_UNAVAILABLE",
}
View Source
var Status_value = map[string]int32{
	"UNKNOWN":                  0,
	"SUCCESS":                  200,
	"BAD_REQUEST":              400,
	"FORBIDDEN":                403,
	"NOT_FOUND":                404,
	"REQUEST_ENTITY_TOO_LARGE": 413,
	"INTERNAL_SERVER_ERROR":    500,
	"NOT_IMPLEMENTED":          501,
	"SERVICE_UNAVAILABLE":      503,
}

Functions

This section is empty.

Types

type Block

type Block struct {
	Header   *BlockHeader   `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
	Data     *BlockData     `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
	Metadata *BlockMetadata `protobuf:"bytes,3,opt,name=metadata" json:"metadata,omitempty"`
}

This is finalized block structure to be shared among the orderer and peer Note that the BlockHeader chains to the previous BlockHeader, and the BlockData hash is embedded in the BlockHeader. This makes it natural and obvious that the Data is included in the hash, but the Metadata is not.

func (*Block) Descriptor

func (*Block) Descriptor() ([]byte, []int)

func (*Block) GetData

func (m *Block) GetData() *BlockData

func (*Block) GetHeader

func (m *Block) GetHeader() *BlockHeader

func (*Block) GetMetadata

func (m *Block) GetMetadata() *BlockMetadata

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) Reset

func (m *Block) Reset()

func (*Block) String

func (m *Block) String() string

type BlockData

type BlockData struct {
	Data [][]byte `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
}

func (*BlockData) Descriptor

func (*BlockData) Descriptor() ([]byte, []int)

func (*BlockData) GetData

func (m *BlockData) GetData() [][]byte

func (*BlockData) ProtoMessage

func (*BlockData) ProtoMessage()

func (*BlockData) Reset

func (m *BlockData) Reset()

func (*BlockData) String

func (m *BlockData) String() string

type BlockHeader

type BlockHeader struct {
	Number       uint64 `protobuf:"varint,1,opt,name=number" json:"number,omitempty"`
	PreviousHash []byte `protobuf:"bytes,2,opt,name=previous_hash,json=previousHash,proto3" json:"previous_hash,omitempty"`
	DataHash     []byte `protobuf:"bytes,3,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"`
}

BlockHeader is the element of the block which forms the block chain The block header is hashed using the configured chain hashing algorithm over the ASN.1 encoding of the BlockHeader

func (*BlockHeader) Descriptor

func (*BlockHeader) Descriptor() ([]byte, []int)

func (*BlockHeader) GetDataHash

func (m *BlockHeader) GetDataHash() []byte

func (*BlockHeader) GetNumber

func (m *BlockHeader) GetNumber() uint64

func (*BlockHeader) GetPreviousHash

func (m *BlockHeader) GetPreviousHash() []byte

func (*BlockHeader) ProtoMessage

func (*BlockHeader) ProtoMessage()

func (*BlockHeader) Reset

func (m *BlockHeader) Reset()

func (*BlockHeader) String

func (m *BlockHeader) String() string

type BlockMetadata

type BlockMetadata struct {
	Metadata [][]byte `protobuf:"bytes,1,rep,name=metadata,proto3" json:"metadata,omitempty"`
}

func (*BlockMetadata) Descriptor

func (*BlockMetadata) Descriptor() ([]byte, []int)

func (*BlockMetadata) GetMetadata

func (m *BlockMetadata) GetMetadata() [][]byte

func (*BlockMetadata) ProtoMessage

func (*BlockMetadata) ProtoMessage()

func (*BlockMetadata) Reset

func (m *BlockMetadata) Reset()

func (*BlockMetadata) String

func (m *BlockMetadata) String() string

type BlockMetadataIndex

type BlockMetadataIndex int32

This enum enlists indexes of the block metadata array

const (
	BlockMetadataIndex_SIGNATURES          BlockMetadataIndex = 0
	BlockMetadataIndex_LAST_CONFIG         BlockMetadataIndex = 1
	BlockMetadataIndex_TRANSACTIONS_FILTER BlockMetadataIndex = 2
	BlockMetadataIndex_ORDERER             BlockMetadataIndex = 3
)

func (BlockMetadataIndex) EnumDescriptor

func (BlockMetadataIndex) EnumDescriptor() ([]byte, []int)

func (BlockMetadataIndex) String

func (x BlockMetadataIndex) String() string

type BlockchainInfo

type BlockchainInfo struct {
	Height            uint64 `protobuf:"varint,1,opt,name=height" json:"height,omitempty"`
	CurrentBlockHash  []byte `protobuf:"bytes,2,opt,name=currentBlockHash,proto3" json:"currentBlockHash,omitempty"`
	PreviousBlockHash []byte `protobuf:"bytes,3,opt,name=previousBlockHash,proto3" json:"previousBlockHash,omitempty"`
}

Contains information about the blockchain ledger such as height, current block hash, and previous block hash.

func (*BlockchainInfo) Descriptor

func (*BlockchainInfo) Descriptor() ([]byte, []int)

func (*BlockchainInfo) GetCurrentBlockHash

func (m *BlockchainInfo) GetCurrentBlockHash() []byte

func (*BlockchainInfo) GetHeight

func (m *BlockchainInfo) GetHeight() uint64

func (*BlockchainInfo) GetPreviousBlockHash

func (m *BlockchainInfo) GetPreviousBlockHash() []byte

func (*BlockchainInfo) ProtoMessage

func (*BlockchainInfo) ProtoMessage()

func (*BlockchainInfo) Reset

func (m *BlockchainInfo) Reset()

func (*BlockchainInfo) String

func (m *BlockchainInfo) String() string

type ChannelHeader

type ChannelHeader struct {
	Type int32 `protobuf:"varint,1,opt,name=type" json:"type,omitempty"`
	// Version indicates message protocol version
	Version int32 `protobuf:"varint,2,opt,name=version" json:"version,omitempty"`
	// Timestamp is the local time when the message was created
	// by the sender
	Timestamp *google_protobuf.Timestamp `protobuf:"bytes,3,opt,name=timestamp" json:"timestamp,omitempty"`
	// Identifier of the channel this message is bound for
	ChannelId string `protobuf:"bytes,4,opt,name=channel_id,json=channelId" json:"channel_id,omitempty"`
	// An unique identifier that is used end-to-end.
	//  -  set by higher layers such as end user or SDK
	//  -  passed to the endorser (which will check for uniqueness)
	//  -  as the header is passed along unchanged, it will be
	//     be retrieved by the committer (uniqueness check here as well)
	//  -  to be stored in the ledger
	TxId string `protobuf:"bytes,5,opt,name=tx_id,json=txId" json:"tx_id,omitempty"`
	// The epoch in which this header was generated, where epoch is defined based on block height
	// Epoch in which the response has been generated. This field identifies a
	// logical window of time. A proposal response is accepted by a peer only if
	// two conditions hold:
	// 1. the epoch specified in the message is the current epoch
	// 2. this message has been only seen once during this epoch (i.e. it hasn't
	//    been replayed)
	Epoch uint64 `protobuf:"varint,6,opt,name=epoch" json:"epoch,omitempty"`
	// Extension that may be attached based on the header type
	Extension []byte `protobuf:"bytes,7,opt,name=extension,proto3" json:"extension,omitempty"`
	// If mutual TLS is employed, this represents
	// the hash of the client's TLS certificate
	TlsCertHash []byte `protobuf:"bytes,8,opt,name=tls_cert_hash,json=tlsCertHash,proto3" json:"tls_cert_hash,omitempty"`
}

Header is a generic replay prevention and identity message to include in a signed payload

func (*ChannelHeader) Descriptor

func (*ChannelHeader) Descriptor() ([]byte, []int)

func (*ChannelHeader) GetChannelId

func (m *ChannelHeader) GetChannelId() string

func (*ChannelHeader) GetEpoch

func (m *ChannelHeader) GetEpoch() uint64

func (*ChannelHeader) GetExtension

func (m *ChannelHeader) GetExtension() []byte

func (*ChannelHeader) GetTimestamp

func (m *ChannelHeader) GetTimestamp() *google_protobuf.Timestamp

func (*ChannelHeader) GetTlsCertHash

func (m *ChannelHeader) GetTlsCertHash() []byte

func (*ChannelHeader) GetTxId

func (m *ChannelHeader) GetTxId() string

func (*ChannelHeader) GetType

func (m *ChannelHeader) GetType() int32

func (*ChannelHeader) GetVersion

func (m *ChannelHeader) GetVersion() int32

func (*ChannelHeader) ProtoMessage

func (*ChannelHeader) ProtoMessage()

func (*ChannelHeader) Reset

func (m *ChannelHeader) Reset()

func (*ChannelHeader) String

func (m *ChannelHeader) String() string

type Envelope

type Envelope struct {
	// A marshaled Payload
	Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	// A signature by the creator specified in the Payload header
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
}

Envelope wraps a Payload with a signature so that the message may be authenticated

func (*Envelope) Descriptor

func (*Envelope) Descriptor() ([]byte, []int)

func (*Envelope) GetPayload

func (m *Envelope) GetPayload() []byte

func (*Envelope) GetSignature

func (m *Envelope) GetSignature() []byte

func (*Envelope) ProtoMessage

func (*Envelope) ProtoMessage()

func (*Envelope) Reset

func (m *Envelope) Reset()

func (*Envelope) String

func (m *Envelope) String() string
type Header struct {
	ChannelHeader   []byte `protobuf:"bytes,1,opt,name=channel_header,json=channelHeader,proto3" json:"channel_header,omitempty"`
	SignatureHeader []byte `protobuf:"bytes,2,opt,name=signature_header,json=signatureHeader,proto3" json:"signature_header,omitempty"`
}

func (*Header) Descriptor

func (*Header) Descriptor() ([]byte, []int)

func (*Header) GetChannelHeader

func (m *Header) GetChannelHeader() []byte

func (*Header) GetSignatureHeader

func (m *Header) GetSignatureHeader() []byte

func (*Header) ProtoMessage

func (*Header) ProtoMessage()

func (*Header) Reset

func (m *Header) Reset()

func (*Header) String

func (m *Header) String() string

type HeaderType

type HeaderType int32
const (
	HeaderType_MESSAGE              HeaderType = 0
	HeaderType_CONFIG               HeaderType = 1
	HeaderType_CONFIG_UPDATE        HeaderType = 2
	HeaderType_ENDORSER_TRANSACTION HeaderType = 3
	HeaderType_ORDERER_TRANSACTION  HeaderType = 4
	HeaderType_DELIVER_SEEK_INFO    HeaderType = 5
	HeaderType_CHAINCODE_PACKAGE    HeaderType = 6
	HeaderType_PEER_RESOURCE_UPDATE HeaderType = 7
)

func (HeaderType) EnumDescriptor

func (HeaderType) EnumDescriptor() ([]byte, []int)

func (HeaderType) String

func (x HeaderType) String() string

type LastConfig

type LastConfig struct {
	Index uint64 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"`
}

LastConfig is the encoded value for the Metadata message which is encoded in the LAST_CONFIGURATION block metadata index

func (*LastConfig) Descriptor

func (*LastConfig) Descriptor() ([]byte, []int)

func (*LastConfig) GetIndex

func (m *LastConfig) GetIndex() uint64

func (*LastConfig) ProtoMessage

func (*LastConfig) ProtoMessage()

func (*LastConfig) Reset

func (m *LastConfig) Reset()

func (*LastConfig) String

func (m *LastConfig) String() string

type Metadata

type Metadata struct {
	Value      []byte               `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	Signatures []*MetadataSignature `protobuf:"bytes,2,rep,name=signatures" json:"signatures,omitempty"`
}

Metadata is a common structure to be used to encode block metadata

func (*Metadata) Descriptor

func (*Metadata) Descriptor() ([]byte, []int)

func (*Metadata) GetSignatures

func (m *Metadata) GetSignatures() []*MetadataSignature

func (*Metadata) GetValue

func (m *Metadata) GetValue() []byte

func (*Metadata) ProtoMessage

func (*Metadata) ProtoMessage()

func (*Metadata) Reset

func (m *Metadata) Reset()

func (*Metadata) String

func (m *Metadata) String() string

type MetadataSignature

type MetadataSignature struct {
	SignatureHeader []byte `protobuf:"bytes,1,opt,name=signature_header,json=signatureHeader,proto3" json:"signature_header,omitempty"`
	Signature       []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
}

func (*MetadataSignature) Descriptor

func (*MetadataSignature) Descriptor() ([]byte, []int)

func (*MetadataSignature) GetSignature

func (m *MetadataSignature) GetSignature() []byte

func (*MetadataSignature) GetSignatureHeader

func (m *MetadataSignature) GetSignatureHeader() []byte

func (*MetadataSignature) ProtoMessage

func (*MetadataSignature) ProtoMessage()

func (*MetadataSignature) Reset

func (m *MetadataSignature) Reset()

func (*MetadataSignature) String

func (m *MetadataSignature) String() string

type Payload

type Payload struct {
	// Header is included to provide identity and prevent replay
	Header *Header `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
	// Data, the encoding of which is defined by the type in the header
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}

Payload is the message contents (and header to allow for signing)

func (*Payload) Descriptor

func (*Payload) Descriptor() ([]byte, []int)

func (*Payload) GetData

func (m *Payload) GetData() []byte

func (*Payload) GetHeader

func (m *Payload) GetHeader() *Header

func (*Payload) ProtoMessage

func (*Payload) ProtoMessage()

func (*Payload) Reset

func (m *Payload) Reset()

func (*Payload) String

func (m *Payload) String() string

type SignatureHeader

type SignatureHeader struct {
	// Creator of the message, a marshaled msp.SerializedIdentity
	Creator []byte `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
	// Arbitrary number that may only be used once. Can be used to detect replay attacks.
	Nonce []byte `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
	// TxID generator
	TxIDGenerator []byte `protobuf:"bytes,3,opt,name=txIDGenerator,proto3" json:"txIDGenerator,omitempty`
}

func (*SignatureHeader) Descriptor

func (*SignatureHeader) Descriptor() ([]byte, []int)

func (*SignatureHeader) GetCreator

func (m *SignatureHeader) GetCreator() []byte

func (*SignatureHeader) GetNonce

func (m *SignatureHeader) GetNonce() []byte

func (*SignatureHeader) GetTxIDGenerator

func (m *SignatureHeader) GetTxIDGenerator() []byte

func (*SignatureHeader) ProtoMessage

func (*SignatureHeader) ProtoMessage()

func (*SignatureHeader) Reset

func (m *SignatureHeader) Reset()

func (*SignatureHeader) String

func (m *SignatureHeader) String() string

type Status

type Status int32

These status codes are intended to resemble selected HTTP status codes

const (
	Status_UNKNOWN                  Status = 0
	Status_SUCCESS                  Status = 200
	Status_BAD_REQUEST              Status = 400
	Status_FORBIDDEN                Status = 403
	Status_NOT_FOUND                Status = 404
	Status_REQUEST_ENTITY_TOO_LARGE Status = 413
	Status_INTERNAL_SERVER_ERROR    Status = 500
	Status_NOT_IMPLEMENTED          Status = 501
	Status_SERVICE_UNAVAILABLE      Status = 503
)

func (Status) EnumDescriptor

func (Status) EnumDescriptor() ([]byte, []int)

func (Status) String

func (x Status) String() string

Jump to

Keyboard shortcuts

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