persistence

package
v0.0.0-...-95b87ed Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MetadataFile = "metadata.json"

	CodePackageFile = "code.tar.gz"
)

Variables

View Source
var (
	LabelRegexp = regexp.MustCompile("^[a-zA-Z0-9]+([.+-_][a-zA-Z0-9]+)*$")
)

Functions

func CCFileName

func CCFileName(packageID string) string

Types

type ChaincodePackage

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

type ChaincodePackageLocator

type ChaincodePackageLocator struct {
	ChaincodeDir string
}

func (*ChaincodePackageLocator) ChaincodePackageStreamer

func (cpl *ChaincodePackageLocator) ChaincodePackageStreamer(packageID string) *ChaincodePackageStreamer

type ChaincodePackageMetadata

type ChaincodePackageMetadata struct {
	Type  string
	Path  string
	Label string
}

type ChaincodePackageParser

type ChaincodePackageParser struct {
	MetadataProvider MetadataProvider
}

func (ChaincodePackageParser) Parse

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

type ChaincodePackageStreamer

type ChaincodePackageStreamer struct {
	PackagePath string
}

func (*ChaincodePackageStreamer) Code

func (*ChaincodePackageStreamer) Exists

func (cps *ChaincodePackageStreamer) Exists() bool

func (*ChaincodePackageStreamer) File

func (cps *ChaincodePackageStreamer) File(name string) (tarFileStream *TarFileStream, err error)

func (*ChaincodePackageStreamer) Metadata

type CodePackageNotFoundErr

type CodePackageNotFoundErr struct {
	PackageID string
}

func (CodePackageNotFoundErr) Error

func (e CodePackageNotFoundErr) Error() string

type FallbackPackageLocator

type FallbackPackageLocator struct {
	ChaincodePackageLocator *ChaincodePackageLocator
	LegacyCCPackageLocator  LegacyCCPackageLocator
}

func (*FallbackPackageLocator) GetChaincodePackage

func (fpl *FallbackPackageLocator) GetChaincodePackage(packageID string) (*ChaincodePackageMetadata, io.ReadCloser, error)

type FilesystemIO

type FilesystemIO struct {
}

func (*FilesystemIO) Exists

func (*FilesystemIO) Exists(path string) (bool, error)

func (*FilesystemIO) MakeDir

func (f *FilesystemIO) MakeDir(dirname string, mode os.FileMode) error

func (*FilesystemIO) ReadDir

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

func (*FilesystemIO) ReadFile

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

func (*FilesystemIO) Remove

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

func (*FilesystemIO) WriteFile

func (f *FilesystemIO) WriteFile(path, name string, data []byte) error

type IOReadWriter

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

type LegacyCCPackageLocator

type LegacyCCPackageLocator interface {
	GetChaincodeDepSpec(nameVersion string) (*pb.ChaincodeDeploymentSpec, error)
}

type LegacyPackageProvider

type LegacyPackageProvider interface {
	GetChaincodeInstallPath() string
	ListInstalledChaincodes(dir string, de ccprovider.DirEnumerator, ce ccprovider.ChaincodeExtractor) ([]chaincode.InstalledChaincode, error)
}

type MetadataProvider

type MetadataProvider interface {
	GetDBArtifacts(codePackage []byte) ([]byte, error)
}

type PackageProvider

type PackageProvider struct {
	LegacyPP LegacyPackageProvider
}

func (*PackageProvider) ListInstalledChaincodesLegacy

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

type Store

type Store struct {
	Path       string
	ReadWriter IOReadWriter
}

func NewStore

func NewStore(path string) *Store

func (*Store) GetChaincodeInstallPath

func (s *Store) GetChaincodeInstallPath() string

func (*Store) Initialize

func (s *Store) Initialize()

func (*Store) ListInstalledChaincodes

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

func (*Store) Load

func (s *Store) Load(packageID string) ([]byte, error)

func (*Store) Save

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

type TarFileStream

type TarFileStream struct {
	TarFile    io.Reader
	FileStream io.Closer
}

func (*TarFileStream) Close

func (tfs *TarFileStream) Close() error

func (*TarFileStream) Read

func (tfs *TarFileStream) Read(p []byte) (int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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