persistence

package
v0.0.0-...-fbe82ab Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChaincodePackageMetadataFile = "Chaincode-Package-Metadata.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChaincodeMetadata

type ChaincodeMetadata struct {
	Name    string `json:"Name"`
	Version string `json:"Version"`
}

chaincodemetadata保存chaincode的名称和版本

type ChaincodePackage

type ChaincodePackage struct {
	Metadata    *ChaincodePackageMetadata
	CodePackage []byte
}

chaincode package表示chaincode包的非tar ed格式。

type ChaincodePackageMetadata

type ChaincodePackageMetadata struct {
	Type string `json:"Type"`
	Path string `json:"Path"`
}

chaincodepackagemetata包含理解所需的信息 嵌入的代码包。

type ChaincodePackageParser

type ChaincodePackageParser struct{}

func (ChaincodePackageParser) Parse

func (ccpp ChaincodePackageParser) Parse(source []byte) (*ChaincodePackage, error)

解析将一组字节解析为链码包 并将解析后的包作为结构返回

type CodePackageNotFoundErr

type CodePackageNotFoundErr struct {
	Name    string
	Version string
}

codePackageNotFounderr是当代码包无法 在持久性存储中找到

func (*CodePackageNotFoundErr) Error

func (e *CodePackageNotFoundErr) Error() string

type FilesystemIO

type FilesystemIO struct {
}

filesystemio是iowriter接口的生产实现

func (*FilesystemIO) ReadDir

func (f *FilesystemIO) ReadDir(dirname string) ([]os.FileInfo, error)

readdir从文件系统读取目录

func (*FilesystemIO) ReadFile

func (f *FilesystemIO) ReadFile(filename string) ([]byte, error)

readfile从文件系统读取文件

func (*FilesystemIO) Remove

func (f *FilesystemIO) Remove(name string) error

删除从文件系统中删除一个文件-用于回滚正在运行的文件 失败时保存操作

func (*FilesystemIO) Stat

func (f *FilesystemIO) Stat(name string) (os.FileInfo, error)

stat检查文件系统上是否存在该文件

func (*FilesystemIO) WriteFile

func (f *FilesystemIO) WriteFile(filename string, data []byte, perm os.FileMode) error

writefile将文件写入文件系统

type IOReadWriter

type IOReadWriter interface {
	ReadDir(string) ([]os.FileInfo, error)
	ReadFile(string) ([]byte, error)
	Remove(name string) error
	Stat(string) (os.FileInfo, error)
	WriteFile(string, []byte, os.FileMode) error
}

ioreadwriter定义读取、写入、删除和 检查是否存在指定的文件

type LegacyPackageProvider

type LegacyPackageProvider interface {
	GetChaincodeCodePackage(name, version string) (codePackage []byte, err error)
	ListInstalledChaincodes(dir string, de ccprovider.DirEnumerator, ce ccprovider.ChaincodeExtractor) ([]chaincode.InstalledChaincode, error)
}

来自chaincodedeploymentspec的代码包

type PackageParser

type PackageParser interface {
	Parse(data []byte) (*ChaincodePackage, error)
}

type PackageProvider

type PackageProvider struct {
	Store    StorePackageProvider
	Parser   PackageParser
	LegacyPP LegacyPackageProvider
}

PackageProvider保留获取代码所需的依赖项 链码的包字节

func (*PackageProvider) GetChaincodeCodePackage

func (p *PackageProvider) GetChaincodeCodePackage(name, version string) ([]byte, error)

名称和版本。它首先搜索 chaincodeinstallpackages,然后返回搜索 链码部署规范

func (*PackageProvider) ListInstalledChaincodes

func (p *PackageProvider) ListInstalledChaincodes() ([]chaincode.InstalledChaincode, error)

在对等机上安装的每个链码

type Store

type Store struct {
	Path       string
	ReadWriter IOReadWriter
}

存储区保存保持chaincode安装包所需的信息

func (*Store) GetChaincodeInstallPath

func (s *Store) GetChaincodeInstallPath() string

getchaincodeinstallpath返回链码所在的路径 安装

func (*Store) ListInstalledChaincodes

func (s *Store) ListInstalledChaincodes() ([]chaincode.InstalledChaincode, error)

持久性存储中安装的链代码

func (*Store) Load

func (s *Store) Load(hash []byte) (ccInstallPkg []byte, name, version string, err error)

加载使用给定哈希加载持久化的链码安装包字节 并返回名称和版本

func (*Store) LoadMetadata

func (s *Store) LoadMetadata(path string) (name, version string, err error)

loadMetadata加载存储在指定路径上的链码元数据

func (*Store) RetrieveHash

func (s *Store) RetrieveHash(name string, version string) ([]byte, error)

retrievehash检索给定 链码的名称和版本

func (*Store) Save

func (s *Store) Save(name, version string, ccInstallPkg []byte) ([]byte, error)

版本

type StorePackageProvider

type StorePackageProvider interface {
	GetChaincodeInstallPath() string
	ListInstalledChaincodes() ([]chaincode.InstalledChaincode, error)
	Load(hash []byte) (codePackage []byte, name, version string, err error)
	RetrieveHash(name, version string) (hash []byte, err error)
}

StorePackageProvider是检索 来自chaincodeinstallpackage的代码包

Directories

Path Synopsis
伪造者生成的代码。
伪造者生成的代码。

Jump to

Keyboard shortcuts

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