Commit ee7a9adf authored by harrylee's avatar harrylee Committed by vipwzw

add value field for storage

parent 28885ad0
......@@ -55,8 +55,15 @@ func (s *StorageAction) ContentStorage(payload *ety.ContentOnlyNotaryStorage) (*
if err == nil && storage.Ty != ety.TyContentStorageAction {
return nil, ety.ErrStorageType
}
content := append(storage.GetContentStorage().Content, []byte(",")...)
payload.Content = append(content, payload.Content...)
if payload.GetContent() != nil {
content := append(storage.GetContentStorage().Content, []byte(",")...)
payload.Content = append(content, payload.Content...)
}
if payload.GetValue() != "" {
value := storage.GetContentStorage().GetValue() + "," + payload.GetValue()
payload.Value = value
}
}
stg := &ety.Storage{Value: &ety.Storage_ContentStorage{ContentStorage: payload}, Ty: ety.TyContentStorageAction}
log := &types.ReceiptLog{Ty: ety.TyContentStorageLog, Log: types.Encode(stg)}
......
......@@ -30,6 +30,8 @@ message ContentOnlyNotaryStorage {
bytes content = 2;
//自定义的主键,可以为空,如果没传,则用txhash为key
string key = 3;
//字符串值
string value = 4;
}
//哈希存证模型,推荐使用sha256哈希,限制256位得摘要值
......@@ -39,6 +41,8 @@ message HashOnlyNotaryStorage {
bytes hash = 1;
//自定义的主键,可以为空,如果没传,则用txhash为key
string key = 2;
//字符串值
string value = 3;
}
// 链接存证模型
......@@ -49,6 +53,8 @@ message LinkNotaryStorage {
bytes hash = 2;
//自定义的主键,可以为空,如果没传,则用txhash为key
string key = 3;
//字符串值
string value = 4;
}
// 隐私存证模型,如果一个文件需要存证,且不公开内容,可以选择将源文件通过对称加密算法加密后上链
......@@ -61,6 +67,8 @@ message EncryptNotaryStorage {
bytes nonce = 3;
//自定义的主键,可以为空,如果没传,则用txhash为key
string key = 4;
//字符串值
string value = 5;
}
// 分享隐私存证模型,需要完备的sdk或者相应的密钥库支持
......@@ -73,6 +81,8 @@ message EncryptShareNotaryStorage {
bytes pubKey = 3;
//自定义的主键,可以为空,如果没传,则用txhash为key
string key = 4;
//字符串值
string value = 5;
}
service storage {}
......
......@@ -297,7 +297,9 @@ type ContentOnlyNotaryStorage struct {
//长度需要小于512k
Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
//自定义的主键,可以为空,如果没传,则用txhash为key
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
//字符串值
Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -349,12 +351,21 @@ func (m *ContentOnlyNotaryStorage) GetKey() string {
return ""
}
func (m *ContentOnlyNotaryStorage) GetValue() string {
if m != nil {
return m.Value
}
return ""
}
//哈希存证模型,推荐使用sha256哈希,限制256位得摘要值
type HashOnlyNotaryStorage struct {
//长度固定为32字节
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
//自定义的主键,可以为空,如果没传,则用txhash为key
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
//字符串值
Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -399,6 +410,13 @@ func (m *HashOnlyNotaryStorage) GetKey() string {
return ""
}
func (m *HashOnlyNotaryStorage) GetValue() string {
if m != nil {
return m.Value
}
return ""
}
// 链接存证模型
type LinkNotaryStorage struct {
//存证内容的链接,可以写入URL,或者其他可用于定位源文件得线索.
......@@ -406,7 +424,9 @@ type LinkNotaryStorage struct {
//源文件得hash值,推荐使用sha256哈希,限制256位得摘要值
Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
//自定义的主键,可以为空,如果没传,则用txhash为key
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
//字符串值
Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -458,6 +478,13 @@ func (m *LinkNotaryStorage) GetKey() string {
return ""
}
func (m *LinkNotaryStorage) GetValue() string {
if m != nil {
return m.Value
}
return ""
}
// 隐私存证模型,如果一个文件需要存证,且不公开内容,可以选择将源文件通过对称加密算法加密后上链
type EncryptNotaryStorage struct {
//存证明文内容的hash值,推荐使用sha256哈希,限制256位得摘要值
......@@ -467,7 +494,9 @@ type EncryptNotaryStorage struct {
//加密iv,通过AES进行加密时制定随机生成的iv,解密时需要使用该值
Nonce []byte `protobuf:"bytes,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
//自定义的主键,可以为空,如果没传,则用txhash为key
Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"`
Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"`
//字符串值
Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -526,6 +555,13 @@ func (m *EncryptNotaryStorage) GetKey() string {
return ""
}
func (m *EncryptNotaryStorage) GetValue() string {
if m != nil {
return m.Value
}
return ""
}
// 分享隐私存证模型,需要完备的sdk或者相应的密钥库支持
type EncryptShareNotaryStorage struct {
//存证明文内容的hash值,推荐使用sha256哈希,限制256位得摘要值
......@@ -535,7 +571,9 @@ type EncryptShareNotaryStorage struct {
//公钥
PubKey []byte `protobuf:"bytes,3,opt,name=pubKey,proto3" json:"pubKey,omitempty"`
//自定义的主键,可以为空,如果没传,则用txhash为key
Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"`
Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"`
//字符串值
Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -594,6 +632,13 @@ func (m *EncryptShareNotaryStorage) GetKey() string {
return ""
}
func (m *EncryptShareNotaryStorage) GetValue() string {
if m != nil {
return m.Value
}
return ""
}
//根据txhash去状态数据库中查询存储内容
type QueryStorage struct {
TxHash string `protobuf:"bytes,1,opt,name=txHash,proto3" json:"txHash,omitempty"`
......@@ -763,37 +808,38 @@ func init() {
}
var fileDescriptor_0d2c4ccf1453ffdb = []byte{
// 470 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x54, 0x4d, 0x8b, 0xd4, 0x40,
0x10, 0x35, 0xc9, 0x64, 0xe2, 0x54, 0xb2, 0x61, 0xb7, 0x5d, 0x97, 0x88, 0x82, 0x21, 0x87, 0x65,
0x10, 0x9c, 0xc3, 0x78, 0x55, 0xd4, 0x5d, 0x16, 0x46, 0xfc, 0xc2, 0x56, 0xbc, 0x67, 0x43, 0x63,
0x86, 0x09, 0xdd, 0x21, 0xe9, 0x11, 0xf3, 0x0f, 0xc4, 0x8b, 0xfe, 0x64, 0x49, 0xa7, 0x3a, 0x1f,
0x93, 0xec, 0x4d, 0xf0, 0xb2, 0xb7, 0xae, 0xaa, 0xf7, 0x5e, 0xaa, 0x5e, 0x75, 0x1a, 0x8e, 0x4a,
0x29, 0x8a, 0xf8, 0x1b, 0x5b, 0xe5, 0x85, 0x90, 0x82, 0xd8, 0xb2, 0xca, 0x59, 0x19, 0xfd, 0xb2,
0xc0, 0xf9, 0xdc, 0x14, 0xc8, 0x1b, 0xf0, 0x13, 0xc1, 0x25, 0xe3, 0x12, 0x33, 0x81, 0x11, 0x1a,
0x4b, 0x77, 0xfd, 0x78, 0xa5, 0x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e8, 0xef, 0xe1, 0x64, 0x64,
0x78, 0x4d, 0xad, 0x0d, 0xd7, 0xd4, 0xfa, 0xdc, 0xca, 0x99, 0x63, 0xb9, 0x5e, 0x37, 0x3f, 0x0d,
0x38, 0x9d, 0xf2, 0x9f, 0x84, 0xe0, 0xe2, 0x0c, 0x9b, 0xae, 0xa9, 0x7e, 0x8a, 0x9c, 0xb7, 0x6b,
0xbd, 0x1c, 0xcc, 0x7e, 0x90, 0x25, 0xa7, 0x60, 0x73, 0xc1, 0x93, 0xe6, 0xda, 0x78, 0xb4, 0x09,
0x74, 0x2b, 0xb3, 0xae, 0x95, 0xdf, 0x06, 0x3c, 0xb8, 0x71, 0x7d, 0xff, 0xb0, 0x9f, 0x33, 0x98,
0xe7, 0xfb, 0xeb, 0xb7, 0xe8, 0x83, 0x47, 0x31, 0x9a, 0xe8, 0xe8, 0x1c, 0xbc, 0x4f, 0x7b, 0xd6,
0xf5, 0x70, 0x06, 0x73, 0xf9, 0xa3, 0xfd, 0xfc, 0x82, 0x62, 0x14, 0x3d, 0x85, 0x93, 0x8b, 0x58,
0x26, 0xe9, 0x00, 0x1c, 0x80, 0xd3, 0x94, 0xcb, 0xc0, 0x08, 0xad, 0xe5, 0x82, 0xea, 0x30, 0x7a,
0x89, 0x70, 0xca, 0xf2, 0xac, 0x85, 0x3f, 0x81, 0xbb, 0xf8, 0x4c, 0x37, 0x78, 0x77, 0xed, 0xe3,
0x95, 0x46, 0x04, 0x6d, 0xeb, 0xd1, 0x31, 0xf8, 0x94, 0x25, 0x6c, 0xdb, 0xfe, 0x1b, 0xeb, 0x05,
0x38, 0x58, 0xbd, 0x9e, 0xab, 0x57, 0xfe, 0xd9, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2c, 0xe3,
0xe3, 0x53, 0xf6, 0x05, 0x00, 0x00,
// 487 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec,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19,
0xcc, 0x8b, 0xdd, 0xcd, 0x3b, 0x9c, 0x99, 0x4f, 0xd1, 0xfa, 0xeb, 0x3a, 0xcf, 0xc1, 0xff, 0xb4,
0x63, 0xb7, 0x95, 0x9d, 0xc1, 0x5c, 0x7e, 0xeb, 0x8a, 0x72, 0x29, 0x5a, 0xf1, 0x73, 0x38, 0xb9,
0x48, 0x64, 0x9a, 0x0d, 0xc4, 0x21, 0x38, 0xad, 0xbb, 0x0a, 0x8d, 0xc8, 0x5a, 0xb8, 0x54, 0x9b,
0xf1, 0x2b, 0x94, 0x53, 0x56, 0xe4, 0x9d, 0xfc, 0x19, 0xdc, 0xc7, 0x47, 0xa1, 0xd5, 0x7b, 0xab,
0x00, 0x7f, 0x20, 0x54, 0xd0, 0xce, 0x1f, 0x1f, 0x43, 0x40, 0x59, 0xca, 0x36, 0xdd, 0x9f, 0xb8,
0x72, 0xc1, 0x41, 0xef, 0xcd, 0x5c, 0xbd, 0x29, 0x2f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x4a,
0xd4, 0x84, 0x62, 0x64, 0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment