types

package
Version: v1.65.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TyUnknowAction = iota
	TyContentStorageAction
	TyHashStorageAction
	TyLinkStorageAction
	TyEncryptStorageAction
	TyEncryptShareStorageAction
	TyEncryptAddAction

	NameContentStorageAction      = "ContentStorage"
	NameHashStorageAction         = "HashStorage"
	NameLinkStorageAction         = "LinkStorage"
	NameEncryptStorageAction      = "EncryptStorage"
	NameEncryptShareStorageAction = "EncryptShareStorage"
	NameEncryptAddAction          = "EncryptAdd"

	FuncNameQueryStorage      = "QueryStorage"
	FuncNameBatchQueryStorage = "BatchQueryStorage"
)

action类型id和name,这些常量可以自定义修改

View Source
const (
	TyUnknownLog = iota
	TyContentStorageLog
	TyHashStorageLog
	TyLinkStorageLog
	TyEncryptStorageLog
	TyEncryptShareStorageLog
	TyEncryptAddLog
)

log类型id值

View Source
const (
	OpCreate = int32(iota)
	OpAdd
)

storage op

Variables

View Source
var (
	ErrKeyExisted  = fmt.Errorf("%s", "The key has already existed!")
	ErrStorageType = fmt.Errorf("%s", "The key has used storage another type!")
)

some errors definition

View Source
var File_storage_proto protoreflect.FileDescriptor
View Source
var (
	ForkStorageLocalDB = "ForkStorageLocalDB"
)

fork

View Source
var (
	//StorageX 执行器名称定义
	StorageX = "storage"
)

Functions

func InitExecutor

func InitExecutor(cfg *types.Chain33Config)

InitExecutor defines register executor

func InitFork

func InitFork(cfg *types.Chain33Config)

InitFork defines register fork

func RegisterStorageServer

func RegisterStorageServer(s *grpc.Server, srv StorageServer)

Types

type BatchQueryStorage

type BatchQueryStorage struct {
	TxHashs []string `protobuf:"bytes,1,rep,name=txHashs,proto3" json:"txHashs,omitempty"`
	// contains filtered or unexported fields
}

批量查询有可能导致数据库崩溃

func (*BatchQueryStorage) Descriptor deprecated

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

Deprecated: Use BatchQueryStorage.ProtoReflect.Descriptor instead.

func (*BatchQueryStorage) GetTxHashs

func (x *BatchQueryStorage) GetTxHashs() []string

func (*BatchQueryStorage) ProtoMessage

func (*BatchQueryStorage) ProtoMessage()

func (*BatchQueryStorage) ProtoReflect added in v1.65.3

func (x *BatchQueryStorage) ProtoReflect() protoreflect.Message

func (*BatchQueryStorage) Reset

func (x *BatchQueryStorage) Reset()

func (*BatchQueryStorage) String

func (x *BatchQueryStorage) String() string

type BatchReplyStorage

type BatchReplyStorage struct {
	Storages []*Storage `protobuf:"bytes,1,rep,name=storages,proto3" json:"storages,omitempty"`
	// contains filtered or unexported fields
}

func (*BatchReplyStorage) Descriptor deprecated

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

Deprecated: Use BatchReplyStorage.ProtoReflect.Descriptor instead.

func (*BatchReplyStorage) GetStorages

func (x *BatchReplyStorage) GetStorages() []*Storage

func (*BatchReplyStorage) ProtoMessage

func (*BatchReplyStorage) ProtoMessage()

func (*BatchReplyStorage) ProtoReflect added in v1.65.3

func (x *BatchReplyStorage) ProtoReflect() protoreflect.Message

func (*BatchReplyStorage) Reset

func (x *BatchReplyStorage) Reset()

func (*BatchReplyStorage) String

func (x *BatchReplyStorage) String() string

type ContentOnlyNotaryStorage

type ContentOnlyNotaryStorage struct {

	//长度需要小于512k
	Content []byte `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
	//自定义的主键,可以为空,如果没传,则用txhash为key
	Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	// Op 0表示创建 1表示追加add
	Op int32 `protobuf:"varint,3,opt,name=op,proto3" json:"op,omitempty"`
	//字符串值
	Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

内容存证模型

func (*ContentOnlyNotaryStorage) Descriptor deprecated

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

Deprecated: Use ContentOnlyNotaryStorage.ProtoReflect.Descriptor instead.

func (*ContentOnlyNotaryStorage) GetContent

func (x *ContentOnlyNotaryStorage) GetContent() []byte

func (*ContentOnlyNotaryStorage) GetKey

func (x *ContentOnlyNotaryStorage) GetKey() string

func (*ContentOnlyNotaryStorage) GetOp

func (x *ContentOnlyNotaryStorage) GetOp() int32

func (*ContentOnlyNotaryStorage) GetValue

func (x *ContentOnlyNotaryStorage) GetValue() string

func (*ContentOnlyNotaryStorage) ProtoMessage

func (*ContentOnlyNotaryStorage) ProtoMessage()

func (*ContentOnlyNotaryStorage) ProtoReflect added in v1.65.3

func (x *ContentOnlyNotaryStorage) ProtoReflect() protoreflect.Message

func (*ContentOnlyNotaryStorage) Reset

func (x *ContentOnlyNotaryStorage) Reset()

func (*ContentOnlyNotaryStorage) String

func (x *ContentOnlyNotaryStorage) String() string

type EncryptNotaryAdd added in v1.65.2

type EncryptNotaryAdd struct {

	//源操作数存证索引
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	//待操作数据
	EncryptAdd []byte `protobuf:"bytes,2,opt,name=encryptAdd,proto3" json:"encryptAdd,omitempty"`
	// contains filtered or unexported fields
}

加密存证数据运算

func (*EncryptNotaryAdd) Descriptor deprecated added in v1.65.2

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

Deprecated: Use EncryptNotaryAdd.ProtoReflect.Descriptor instead.

func (*EncryptNotaryAdd) GetEncryptAdd added in v1.65.2

func (x *EncryptNotaryAdd) GetEncryptAdd() []byte

func (*EncryptNotaryAdd) GetKey added in v1.65.2

func (x *EncryptNotaryAdd) GetKey() string

func (*EncryptNotaryAdd) ProtoMessage added in v1.65.2

func (*EncryptNotaryAdd) ProtoMessage()

func (*EncryptNotaryAdd) ProtoReflect added in v1.65.3

func (x *EncryptNotaryAdd) ProtoReflect() protoreflect.Message

func (*EncryptNotaryAdd) Reset added in v1.65.2

func (x *EncryptNotaryAdd) Reset()

func (*EncryptNotaryAdd) String added in v1.65.2

func (x *EncryptNotaryAdd) String() string

type EncryptNotaryStorage

type EncryptNotaryStorage struct {

	//存证明文内容的hash值,推荐使用sha256哈希,限制256位得摘要值
	ContentHash []byte `protobuf:"bytes,1,opt,name=contentHash,proto3" json:"contentHash,omitempty"`
	//源文件得密文,由加密key及nonce对明文加密得到该值。
	EncryptContent []byte `protobuf:"bytes,2,opt,name=encryptContent,proto3" json:"encryptContent,omitempty"`
	//加密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"`
	//字符串值
	Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

隐私存证模型,如果一个文件需要存证,且不公开内容,可以选择将源文件通过对称加密算法加密后上链

func (*EncryptNotaryStorage) Descriptor deprecated

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

Deprecated: Use EncryptNotaryStorage.ProtoReflect.Descriptor instead.

func (*EncryptNotaryStorage) GetContentHash

func (x *EncryptNotaryStorage) GetContentHash() []byte

func (*EncryptNotaryStorage) GetEncryptContent

func (x *EncryptNotaryStorage) GetEncryptContent() []byte

func (*EncryptNotaryStorage) GetKey

func (x *EncryptNotaryStorage) GetKey() string

func (*EncryptNotaryStorage) GetNonce

func (x *EncryptNotaryStorage) GetNonce() []byte

func (*EncryptNotaryStorage) GetValue

func (x *EncryptNotaryStorage) GetValue() string

func (*EncryptNotaryStorage) ProtoMessage

func (*EncryptNotaryStorage) ProtoMessage()

func (*EncryptNotaryStorage) ProtoReflect added in v1.65.3

func (x *EncryptNotaryStorage) ProtoReflect() protoreflect.Message

func (*EncryptNotaryStorage) Reset

func (x *EncryptNotaryStorage) Reset()

func (*EncryptNotaryStorage) String

func (x *EncryptNotaryStorage) String() string

type EncryptShareNotaryStorage

type EncryptShareNotaryStorage struct {

	//存证明文内容的hash值,推荐使用sha256哈希,限制256位得摘要值
	ContentHash []byte `protobuf:"bytes,1,opt,name=contentHash,proto3" json:"contentHash,omitempty"`
	//源文件得密文。,用公钥地址加密
	EncryptContent []byte `protobuf:"bytes,2,opt,name=encryptContent,proto3" json:"encryptContent,omitempty"`
	//公钥
	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"`
	//字符串值
	Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

分享隐私存证模型,需要完备的sdk或者相应的密钥库支持

func (*EncryptShareNotaryStorage) Descriptor deprecated

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

Deprecated: Use EncryptShareNotaryStorage.ProtoReflect.Descriptor instead.

func (*EncryptShareNotaryStorage) GetContentHash

func (x *EncryptShareNotaryStorage) GetContentHash() []byte

func (*EncryptShareNotaryStorage) GetEncryptContent

func (x *EncryptShareNotaryStorage) GetEncryptContent() []byte

func (*EncryptShareNotaryStorage) GetKey

func (x *EncryptShareNotaryStorage) GetKey() string

func (*EncryptShareNotaryStorage) GetPubKey

func (x *EncryptShareNotaryStorage) GetPubKey() []byte

func (*EncryptShareNotaryStorage) GetValue

func (x *EncryptShareNotaryStorage) GetValue() string

func (*EncryptShareNotaryStorage) ProtoMessage

func (*EncryptShareNotaryStorage) ProtoMessage()

func (*EncryptShareNotaryStorage) ProtoReflect added in v1.65.3

func (*EncryptShareNotaryStorage) Reset

func (x *EncryptShareNotaryStorage) Reset()

func (*EncryptShareNotaryStorage) String

func (x *EncryptShareNotaryStorage) String() string

type HashOnlyNotaryStorage

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"`
	//字符串值
	Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

哈希存证模型,推荐使用sha256哈希,限制256位得摘要值

func (*HashOnlyNotaryStorage) Descriptor deprecated

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

Deprecated: Use HashOnlyNotaryStorage.ProtoReflect.Descriptor instead.

func (*HashOnlyNotaryStorage) GetHash

func (x *HashOnlyNotaryStorage) GetHash() []byte

func (*HashOnlyNotaryStorage) GetKey

func (x *HashOnlyNotaryStorage) GetKey() string

func (*HashOnlyNotaryStorage) GetValue

func (x *HashOnlyNotaryStorage) GetValue() string

func (*HashOnlyNotaryStorage) ProtoMessage

func (*HashOnlyNotaryStorage) ProtoMessage()

func (*HashOnlyNotaryStorage) ProtoReflect added in v1.65.3

func (x *HashOnlyNotaryStorage) ProtoReflect() protoreflect.Message

func (*HashOnlyNotaryStorage) Reset

func (x *HashOnlyNotaryStorage) Reset()

func (*HashOnlyNotaryStorage) String

func (x *HashOnlyNotaryStorage) String() string

type LinkNotaryStorage

type LinkNotaryStorage struct {

	//存证内容的链接,可以写入URL,或者其他可用于定位源文件得线索.
	Link []byte `protobuf:"bytes,1,opt,name=link,proto3" json:"link,omitempty"`
	//源文件得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"`
	//字符串值
	Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

链接存证模型

func (*LinkNotaryStorage) Descriptor deprecated

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

Deprecated: Use LinkNotaryStorage.ProtoReflect.Descriptor instead.

func (*LinkNotaryStorage) GetHash

func (x *LinkNotaryStorage) GetHash() []byte

func (*LinkNotaryStorage) GetKey

func (x *LinkNotaryStorage) GetKey() string
func (x *LinkNotaryStorage) GetLink() []byte

func (*LinkNotaryStorage) GetValue

func (x *LinkNotaryStorage) GetValue() string

func (*LinkNotaryStorage) ProtoMessage

func (*LinkNotaryStorage) ProtoMessage()

func (*LinkNotaryStorage) ProtoReflect added in v1.65.3

func (x *LinkNotaryStorage) ProtoReflect() protoreflect.Message

func (*LinkNotaryStorage) Reset

func (x *LinkNotaryStorage) Reset()

func (*LinkNotaryStorage) String

func (x *LinkNotaryStorage) String() string

type QueryStorage

type QueryStorage struct {
	TxHash string `protobuf:"bytes,1,opt,name=txHash,proto3" json:"txHash,omitempty"`
	// contains filtered or unexported fields
}

根据txhash去状态数据库中查询存储内容

func (*QueryStorage) Descriptor deprecated

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

Deprecated: Use QueryStorage.ProtoReflect.Descriptor instead.

func (*QueryStorage) GetTxHash

func (x *QueryStorage) GetTxHash() string

func (*QueryStorage) ProtoMessage

func (*QueryStorage) ProtoMessage()

func (*QueryStorage) ProtoReflect added in v1.65.3

func (x *QueryStorage) ProtoReflect() protoreflect.Message

func (*QueryStorage) Reset

func (x *QueryStorage) Reset()

func (*QueryStorage) String

func (x *QueryStorage) String() string

type ReceiptStorage

type ReceiptStorage struct {
	// contains filtered or unexported fields
}

func (*ReceiptStorage) Descriptor deprecated

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

Deprecated: Use ReceiptStorage.ProtoReflect.Descriptor instead.

func (*ReceiptStorage) ProtoMessage

func (*ReceiptStorage) ProtoMessage()

func (*ReceiptStorage) ProtoReflect added in v1.65.3

func (x *ReceiptStorage) ProtoReflect() protoreflect.Message

func (*ReceiptStorage) Reset

func (x *ReceiptStorage) Reset()

func (*ReceiptStorage) String

func (x *ReceiptStorage) String() string

type Storage

type Storage struct {

	// Types that are assignable to Value:
	//	*Storage_ContentStorage
	//	*Storage_HashStorage
	//	*Storage_LinkStorage
	//	*Storage_EncryptStorage
	//	*Storage_EncryptShareStorage
	//	*Storage_EncryptAdd
	Value isStorage_Value `protobuf_oneof:"value"`
	Ty    int32           `protobuf:"varint,7,opt,name=ty,proto3" json:"ty,omitempty"`
	// contains filtered or unexported fields
}

后面如果有其他数据模型可继续往上面添加

func (*Storage) Descriptor deprecated

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

Deprecated: Use Storage.ProtoReflect.Descriptor instead.

func (*Storage) GetContentStorage

func (x *Storage) GetContentStorage() *ContentOnlyNotaryStorage

func (*Storage) GetEncryptAdd added in v1.65.2

func (x *Storage) GetEncryptAdd() *EncryptNotaryAdd

func (*Storage) GetEncryptShareStorage

func (x *Storage) GetEncryptShareStorage() *EncryptShareNotaryStorage

func (*Storage) GetEncryptStorage

func (x *Storage) GetEncryptStorage() *EncryptNotaryStorage

func (*Storage) GetHashStorage

func (x *Storage) GetHashStorage() *HashOnlyNotaryStorage

func (*Storage) GetLinkStorage

func (x *Storage) GetLinkStorage() *LinkNotaryStorage

func (*Storage) GetTy

func (x *Storage) GetTy() int32

func (*Storage) GetValue

func (m *Storage) GetValue() isStorage_Value

func (*Storage) ProtoMessage

func (*Storage) ProtoMessage()

func (*Storage) ProtoReflect added in v1.65.3

func (x *Storage) ProtoReflect() protoreflect.Message

func (*Storage) Reset

func (x *Storage) Reset()

func (*Storage) String

func (x *Storage) String() string

type StorageAction

type StorageAction struct {

	// Types that are assignable to Value:
	//	*StorageAction_ContentStorage
	//	*StorageAction_HashStorage
	//	*StorageAction_LinkStorage
	//	*StorageAction_EncryptStorage
	//	*StorageAction_EncryptShareStorage
	//	*StorageAction_EncryptAdd
	Value isStorageAction_Value `protobuf_oneof:"value"`
	Ty    int32                 `protobuf:"varint,7,opt,name=ty,proto3" json:"ty,omitempty"`
	// contains filtered or unexported fields
}

func (*StorageAction) Descriptor deprecated

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

Deprecated: Use StorageAction.ProtoReflect.Descriptor instead.

func (*StorageAction) GetContentStorage

func (x *StorageAction) GetContentStorage() *ContentOnlyNotaryStorage

func (*StorageAction) GetEncryptAdd added in v1.65.2

func (x *StorageAction) GetEncryptAdd() *EncryptNotaryAdd

func (*StorageAction) GetEncryptShareStorage

func (x *StorageAction) GetEncryptShareStorage() *EncryptShareNotaryStorage

func (*StorageAction) GetEncryptStorage

func (x *StorageAction) GetEncryptStorage() *EncryptNotaryStorage

func (*StorageAction) GetHashStorage

func (x *StorageAction) GetHashStorage() *HashOnlyNotaryStorage

func (*StorageAction) GetLinkStorage

func (x *StorageAction) GetLinkStorage() *LinkNotaryStorage

func (*StorageAction) GetTy

func (x *StorageAction) GetTy() int32

func (*StorageAction) GetValue

func (m *StorageAction) GetValue() isStorageAction_Value

func (*StorageAction) ProtoMessage

func (*StorageAction) ProtoMessage()

func (*StorageAction) ProtoReflect added in v1.65.3

func (x *StorageAction) ProtoReflect() protoreflect.Message

func (*StorageAction) Reset

func (x *StorageAction) Reset()

func (*StorageAction) String

func (x *StorageAction) String() string

type StorageAction_ContentStorage

type StorageAction_ContentStorage struct {
	ContentStorage *ContentOnlyNotaryStorage `protobuf:"bytes,1,opt,name=contentStorage,proto3,oneof"`
}

type StorageAction_EncryptAdd added in v1.65.2

type StorageAction_EncryptAdd struct {
	EncryptAdd *EncryptNotaryAdd `protobuf:"bytes,6,opt,name=encryptAdd,proto3,oneof"`
}

type StorageAction_EncryptShareStorage

type StorageAction_EncryptShareStorage struct {
	EncryptShareStorage *EncryptShareNotaryStorage `protobuf:"bytes,5,opt,name=encryptShareStorage,proto3,oneof"`
}

type StorageAction_EncryptStorage

type StorageAction_EncryptStorage struct {
	EncryptStorage *EncryptNotaryStorage `protobuf:"bytes,4,opt,name=encryptStorage,proto3,oneof"`
}

type StorageAction_HashStorage

type StorageAction_HashStorage struct {
	HashStorage *HashOnlyNotaryStorage `protobuf:"bytes,2,opt,name=hashStorage,proto3,oneof"`
}

type StorageAction_LinkStorage

type StorageAction_LinkStorage struct {
	LinkStorage *LinkNotaryStorage `protobuf:"bytes,3,opt,name=linkStorage,proto3,oneof"`
}

type StorageClient

type StorageClient interface {
}

StorageClient is the client API for Storage service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewStorageClient

func NewStorageClient(cc grpc.ClientConnInterface) StorageClient

type StorageServer

type StorageServer interface {
}

StorageServer is the server API for Storage service.

type StorageType

type StorageType struct {
	types.ExecTypeBase
}

StorageType ...

func NewType

func NewType(cfg *types.Chain33Config) *StorageType

NewType ...

func (*StorageType) GetLogMap

func (s *StorageType) GetLogMap() map[int64]*types.LogInfo

GetLogMap 获取合约log相关信息

func (*StorageType) GetPayload

func (s *StorageType) GetPayload() types.Message

GetPayload 获取合约action结构

func (*StorageType) GetTypeMap

func (s *StorageType) GetTypeMap() map[string]int32

GetTypeMap 获取合约action的id和name信息

type Storage_ContentStorage

type Storage_ContentStorage struct {
	ContentStorage *ContentOnlyNotaryStorage `protobuf:"bytes,1,opt,name=contentStorage,proto3,oneof"`
}

type Storage_EncryptAdd added in v1.65.2

type Storage_EncryptAdd struct {
	EncryptAdd *EncryptNotaryAdd `protobuf:"bytes,6,opt,name=encryptAdd,proto3,oneof"`
}

type Storage_EncryptShareStorage

type Storage_EncryptShareStorage struct {
	EncryptShareStorage *EncryptShareNotaryStorage `protobuf:"bytes,5,opt,name=encryptShareStorage,proto3,oneof"`
}

type Storage_EncryptStorage

type Storage_EncryptStorage struct {
	EncryptStorage *EncryptNotaryStorage `protobuf:"bytes,4,opt,name=encryptStorage,proto3,oneof"`
}

type Storage_HashStorage

type Storage_HashStorage struct {
	HashStorage *HashOnlyNotaryStorage `protobuf:"bytes,2,opt,name=hashStorage,proto3,oneof"`
}

type Storage_LinkStorage

type Storage_LinkStorage struct {
	LinkStorage *LinkNotaryStorage `protobuf:"bytes,3,opt,name=linkStorage,proto3,oneof"`
}

type UnimplementedStorageServer

type UnimplementedStorageServer struct {
}

UnimplementedStorageServer can be embedded to have forward compatible implementations.

Jump to

Keyboard shortcuts

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