From 18a82093ecf0f0270e88b137cb4e70d15f91eb6e Mon Sep 17 00:00:00 2001 From: Artem Barger Date: Thu, 8 Dec 2016 11:52:13 +0200 Subject: [PATCH] Define semantics for block metadata array positions Created an enum to define human readable semantic for block metadata array content. Change-Id: I0b55340c3aa720d563d87d3e2ebc7cdb1b26c8f9 Signed-off-by: Artem Barger --- protos/common/block.go | 4 +- protos/common/common.pb.go | 121 +++++++++++++++++++++++-------------- protos/common/common.proto | 7 +++ 3 files changed, 85 insertions(+), 47 deletions(-) diff --git a/protos/common/block.go b/protos/common/block.go index 313df877c02..5155ca85b9f 100644 --- a/protos/common/block.go +++ b/protos/common/block.go @@ -28,7 +28,9 @@ func NewBlock(seqNum uint64, previousHash []byte) *Block { block.Header.Number = seqNum block.Header.PreviousHash = previousHash block.Data = &BlockData{} - block.Metadata = &BlockMetadata{} + block.Metadata = &BlockMetadata{ + Metadata: [][]byte{[]byte{}, []byte{}, []byte{}}, + } return block } diff --git a/protos/common/common.pb.go b/protos/common/common.pb.go index ff8bb378aad..72806e613c2 100644 --- a/protos/common/common.pb.go +++ b/protos/common/common.pb.go @@ -112,6 +112,31 @@ func (x HeaderType) String() string { } func (HeaderType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +// This enum enlist indexes of the block metadata array +type BlockMetadataIndex int32 + +const ( + BlockMetadataIndex_SIGNATURES BlockMetadataIndex = 0 + BlockMetadataIndex_LAST_CONFIGURATION BlockMetadataIndex = 1 + BlockMetadataIndex_TRANSACTIONS_FILTER BlockMetadataIndex = 2 +) + +var BlockMetadataIndex_name = map[int32]string{ + 0: "SIGNATURES", + 1: "LAST_CONFIGURATION", + 2: "TRANSACTIONS_FILTER", +} +var BlockMetadataIndex_value = map[string]int32{ + "SIGNATURES": 0, + "LAST_CONFIGURATION": 1, + "TRANSACTIONS_FILTER": 2, +} + +func (x BlockMetadataIndex) String() string { + return proto.EnumName(BlockMetadataIndex_name, int32(x)) +} +func (BlockMetadataIndex) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + type Header struct { ChainHeader *ChainHeader `protobuf:"bytes,1,opt,name=chainHeader" json:"chainHeader,omitempty"` SignatureHeader *SignatureHeader `protobuf:"bytes,2,opt,name=signatureHeader" json:"signatureHeader,omitempty"` @@ -299,55 +324,59 @@ func init() { proto.RegisterType((*BlockMetadata)(nil), "common.BlockMetadata") proto.RegisterEnum("common.Status", Status_name, Status_value) proto.RegisterEnum("common.HeaderType", HeaderType_name, HeaderType_value) + proto.RegisterEnum("common.BlockMetadataIndex", BlockMetadataIndex_name, BlockMetadataIndex_value) } func init() { proto.RegisterFile("common/common.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 719 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x5c, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0xad, 0xeb, 0xfc, 0x34, 0xd7, 0xf9, 0x5a, 0x7f, 0xd3, 0x1f, 0x4c, 0x44, 0xd5, 0xc8, 0x12, - 0x28, 0x6a, 0x45, 0x22, 0x8a, 0x90, 0xd8, 0x3a, 0xf1, 0xb4, 0xb5, 0x48, 0xc7, 0x65, 0xec, 0x14, - 0xc1, 0xc6, 0x72, 0x92, 0x69, 0x12, 0x48, 0xec, 0xc8, 0x71, 0xaa, 0x76, 0xcb, 0x03, 0x20, 0x24, - 0xd8, 0xf2, 0x02, 0x3c, 0x09, 0x6f, 0xc0, 0x8b, 0x20, 0xb1, 0x45, 0x9e, 0xb1, 0xf3, 0xd3, 0x55, - 0xe6, 0xdc, 0x73, 0xe6, 0xce, 0x39, 0x77, 0x9c, 0x81, 0xdd, 0x5e, 0x38, 0x99, 0x84, 0x41, 0x43, - 0xfc, 0xd4, 0xa7, 0x51, 0x18, 0x87, 0xa8, 0x20, 0x50, 0xe5, 0x68, 0x10, 0x86, 0x83, 0x31, 0x6b, - 0xf0, 0x6a, 0x77, 0x7e,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a6, 0x0e, 0xa6, 0x6b, 0x3b, 0xe4, 0xe6, 0xf3, 0x0f, 0x27, - 0x83, 0x51, 0x3c, 0x9c, 0x77, 0x93, 0x6b, 0x6f, 0x0c, 0xef, 0xa7, 0x2c, 0x1a, 0xb3, 0xfe, 0x80, - 0x45, 0x8d, 0x1b, 0xbf, 0x1b, 0x8d, 0x7a, 0xe2, 0x15, 0x9b, 0xa5, 0x2f, 0x5d, 0xb7, 0xc0, 0xe1, - 0xcb, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x46, 0xc5, 0x71, 0x75, 0x01, 0x05, 0x00, 0x00, + // 765 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x5c, 0x54, 0xdd, 0x6e, 0xe2, 0x46, + 0x18, 0x8d, 0x63, 0x7e, 0xc2, 0x67, 0x9a, 0xb8, 0x43, 0x7e, 0x5c, 0xd4, 0x28, 0xc8, 0x52, 0x2b, + 0x94, 0xa8, 0xa0, 0xa6, 0xaa, 0xd4, 0x5b, 0x83, 0x07, 0x62, 0x95, 0x8c, 0xd3, 0xb1, 0x9d, 0xaa, + 0xbd, 0xb1, 0x0c, 0x4c, 0x80, 0x5d, 0xb0, 0x91, 0x31, 0x51, 0x72, 0xbb, 0x0f, 0xb0, 0x5a, 0x69, + 0xf7, 0x76, 0x5f, 0x60, 0x9f, 0x64, 0xdf, 0x60, 0x5f, 0x64, 0xa5, 0xbd, 0x5d, 0x79, 0x6c, 0x03, + 0xce, 0x15, 0x73, 0xbe, 0xef, 0xcc, 0x99, 0x73, 0xbe, 0x19, 0x0c, 0xb5, 0x51, 0xb0, 0x58, 0x04, + 0x7e, 0x3b, 0xf9, 0x69, 0x2d, 0xc3, 0x20, 0x0a, 0x50, 0x29, 0x41, 0xf5, 0x8b, 0x49, 0x10, 0x4c, + 0xe6, 0xac, 0xcd, 0xab, 0xc3, 0xf5, 0x43, 0x3b, 0x9a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0x9a, 0xdb, 0x21, 0x5e, 0x3a, + 0x80, 0x72, 0x53, 0x34, 0xfc, 0x31, 0x7b, 0x42, 0x87, 0x00, 0x96, 0xd1, 0x27, 0x9a, 0xed, 0x50, + 0x6c, 0xc9, 0x7b, 0xb1, 0xee, 0x40, 0xb3, 0x6c, 0x37, 0x27, 0x2e, 0x0b, 0xe8, 0x0c, 0x6a, 0x3b, + 0x72, 0x96, 0xdb, 0x33, 0x06, 0x36, 0xa6, 0xf2, 0x7e, 0xe7, 0xb7, 0xff, 0xaf, 0x26, 0xb3, 0x68, + 0xba, 0x1e, 0xc6, 0xaf, 0xa9, 0x3d, 0x7d, 0x5e, 0xb2, 0x70, 0xce, 0xc6, 0x13, 0x16, 0xb6, 0x1f, + 0xbc, 0x61, 0x38, 0x1b, 0x25, 0x1f, 0xc7, 0x55, 0xfa, 0x01, 0x1d, 0x96, 0x38, 0xfc, 0xe3, 0x7b, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x92, 0x53, 0x0b, 0x44, 0x58, 0x05, 0x00, 0x00, } diff --git a/protos/common/common.proto b/protos/common/common.proto index 7a5839553a2..975c9ecd6bb 100644 --- a/protos/common/common.proto +++ b/protos/common/common.proto @@ -41,6 +41,13 @@ enum HeaderType { ENDORSER_TRANSACTION = 3; // Used by the SDK to submit endorser based transactions } +// This enum enlist indexes of the block metadata array +enum BlockMetadataIndex { + SIGNATURES = 0; // Block metadata array position for block signatures + LAST_CONFIGURATION = 1; // Block metadata array poistion to store last configuration block sequence number + TRANSACTIONS_FILTER = 2; // Block metadata array poistion to store serialized bit array filter of invalid transactions +} + message Header { ChainHeader chainHeader = 1; SignatureHeader signatureHeader = 2;