packager

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedPlatforms = []Platform{
	&golang.Platform{},
	&external.Platform{},
}

SupportedPlatforms is the canonical list of platforms Fabric supports

Functions

This section is empty.

Types

type NormalizePather

type NormalizePather interface {
	NormalizePath(path string) (string, error)
}

NormalizerPather is an optional interface that can be implemented by platforms to modify the path stored in the chaincde ID.

type PackageInput

type PackageInput struct {
	OutputFile string
	Path       string
	Type       string
	Label      string
}

PackageInput holds the input parameters for packaging a ChaincodeInstallPackage

func (*PackageInput) Validate

func (p *PackageInput) Validate() error

Validate checks for the required inputs

type PackageMetadata

type PackageMetadata struct {
	Path  string `json:"path"`
	Type  string `json:"type"`
	Label string `json:"label"`
}

PackageMetadata holds the path and type for a chaincode package

type Packager

type Packager struct {
	Input            *PackageInput
	PlatformRegistry PlatformRegistry
	Writer           Writer
}

Packager holds the dependencies needed to package a chaincode and write it

func New

func New() *Packager

func (*Packager) Package

func (p *Packager) Package(replacer replacer.Func) error

Package packages chaincodes into the package type, (.tar.gz) used by _lifecycle and writes it to disk

func (*Packager) PackageChaincode

func (p *Packager) PackageChaincode(path, typ, label, outputFile string, replacer replacer.Func) error

PackageChaincode packages a chaincode.

type Platform

type Platform interface {
	Name() string
	ValidatePath(path string) error
	ValidateCodePackage(code []byte) error
	GetDeploymentPayload(path string, replacer replacer.Func) ([]byte, error)
}

Interface for validating the specification and writing the package for the given platform

type PlatformRegistry

type PlatformRegistry interface {
	GetDeploymentPayload(ccType, path string, replacer replacer.Func) ([]byte, error)
	NormalizePath(ccType, path string) (string, error)
}

PlatformRegistry defines the interface to get the code bytes for a chaincode given the type and path

type Registry

type Registry struct {
	Platforms map[string]Platform
}

func NewRegistry

func NewRegistry(platformTypes ...Platform) *Registry

func (*Registry) GetDeploymentPayload

func (r *Registry) GetDeploymentPayload(ccType, path string, replacer replacer.Func) ([]byte, error)

func (*Registry) NormalizePath

func (r *Registry) NormalizePath(ccType, path string) (string, error)

func (*Registry) ValidateDeploymentSpec

func (r *Registry) ValidateDeploymentSpec(ccType string, codePackage []byte) error

func (*Registry) ValidateSpec

func (r *Registry) ValidateSpec(ccType, path string) error

type Writer

type Writer interface {
	WriteFile(string, string, []byte) error
}

Writer defines the interface needed for writing a file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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