node

package
v0.0.0-...-667e438 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServiceTLSCred

func GetServiceTLSCred() (credentials.TransportCredentials, error)

we still reserved the global APIs for node-wide services

func NewCCSpecValidator

func NewCCSpecValidator(parent *ccSpecValidator) *ccSpecValidator

func NewTxNetworkHandler

func NewTxNetworkHandler(engine *PeerEngine) *txNetworkHandlerImpl

func StartService

func StartService(listenAddr string, enableTLS bool, regserv ...func(*grpc.Server)) error

func StopServices

func StopServices()

Types

type CCNameTransformer

type CCNameTransformer func(string) string

type NodeEngine

type NodeEngine struct {
	Name string

	Ledgers map[string]*ledger.Ledger
	Peers   map[string]*PeerEngine
	Cred    struct {
		Endorsers map[string]cred.TxEndorserFactory
		// contains filtered or unexported fields
	}
	CustomFilters []pb.TxPreHandler

	//all the received transactions can be read out from different topic by its chaincode name,
	//according to the configuration in transation filter
	TxTopic            map[string]litekfk.Topic
	TxTopicNameHandler CCNameTransformer

	Options struct {
		EnforceSec           bool
		MakeGenesisForLedger bool
	}
	// contains filtered or unexported fields
}

node engine intregated mutiple PeerEngine, ledgers and credentials, system should access ledger here

func (*NodeEngine) AddServicePoint

func (ne *NodeEngine) AddServicePoint(s ServicePoint)

func (*NodeEngine) AddTxTopic

func (ne *NodeEngine) AddTxTopic(name string, topic ...litekfk.Topic)

func (*NodeEngine) DefaultLedger

func (ne *NodeEngine) DefaultLedger() *ledger.Ledger

func (*NodeEngine) DefaultPeer

func (ne *NodeEngine) DefaultPeer() *PeerEngine

func (*NodeEngine) ExecInit

func (ne *NodeEngine) ExecInit() error

ne will fully respect an old-fashion (fabric 0.6) config file

func (*NodeEngine) FinalRelease

func (ne *NodeEngine) FinalRelease()

func (*NodeEngine) Init

func (ne *NodeEngine) Init() error

wrap two step in one

func (*NodeEngine) LedgersList

func (ne *NodeEngine) LedgersList() (ret []*ledger.Ledger)

func (*NodeEngine) PeersList

func (ne *NodeEngine) PeersList() (ret []*PeerEngine)

func (*NodeEngine) PreInit

func (ne *NodeEngine) PreInit()

preinit phase simply read all peer's name in the config and create them, user can make settings on node and peer which will be respected in the Init process

func (*NodeEngine) RunAll

func (ne *NodeEngine) RunAll() (chan ServicePoint, error)

run both peers and service

func (*NodeEngine) RunPeers

func (ne *NodeEngine) RunPeers() error

func (*NodeEngine) RunServices

func (ne *NodeEngine) RunServices() (chan ServicePoint, error)

return a manage channel for all running services, for any value s receive from the channel, it MUST call Start of the s, passing this channel to s again, to respawn the rpc service thread, BEFORE StopServices is called. Or user should just never touch the channel

func (*NodeEngine) SelectEndorser

func (ne *NodeEngine) SelectEndorser(name string) (cred.TxEndorserFactory, error)

func (*NodeEngine) SelectLedger

func (ne *NodeEngine) SelectLedger(name string) (*ledger.Ledger, error)

func (*NodeEngine) StopServices

func (ne *NodeEngine) StopServices(notify <-chan ServicePoint)

type PeerEngine

type PeerEngine struct {
	TxHandlerOpts struct {
		//validator is applied BEFORE pooling and custom filter applied
		//AFTER that, if nopooling is set, CustomValidators will be also
		//omitted
		Customs          []pb.TxPreHandler
		CustomValidators []pb.TxPreHandler
		NoPooling        bool
		// contains filtered or unexported fields
	}

	peer.Peer
	// contains filtered or unexported fields
}

func (*PeerEngine) GenTxEndorser

func (pe *PeerEngine) GenTxEndorser() cred.TxEndorser

func (*PeerEngine) GetServerPoint

func (pe *PeerEngine) GetServerPoint() ServicePoint

func (*PeerEngine) Init

func (pe *PeerEngine) Init(vp *viper.Viper, node *NodeEngine, tag string) error

func (*PeerEngine) IsRunning

func (pe *PeerEngine) IsRunning() (bool, error)

func (*PeerEngine) PreInit

func (pe *PeerEngine) PreInit(node *NodeEngine)

func (*PeerEngine) Run

func (pe *PeerEngine) Run() error

func (*PeerEngine) Stop

func (pe *PeerEngine) Stop()

func (*PeerEngine) Syncer

func (pe *PeerEngine) Syncer() *syncstrategy.SyncEntry

func (*PeerEngine) TxNetwork

func (pe *PeerEngine) TxNetwork() *txnetwork.TxNetworkEntry

type ServicePoint

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

func CreateServerPoint

func CreateServerPoint(conf *viper.Viper) (ServicePoint, error)

func (ServicePoint) CleanStatus

func (ep ServicePoint) CleanStatus()

func (ServicePoint) Init

func (ep ServicePoint) Init(conf *viper.Viper) error

standard init read all configurations from viper, inwhich we use a subtree of *peer* in the 0.6's configurations

func (ServicePoint) InitWithConfig

func (ep ServicePoint) InitWithConfig(conf *config.ServerSpec) error

func (ServicePoint) Release

func (ep ServicePoint) Release() error

func (ServicePoint) SetPort

func (ep ServicePoint) SetPort(listenAddr string) error

some routines for create a simple grpc server (currently only port, no tls and other options enable)

func (ServicePoint) Spec

func (ep ServicePoint) Spec() *config.ServerSpec

func (ServicePoint) Start

func (ep ServicePoint) Start(notify chan<- ServicePoint) error

func (ServicePoint) Status

func (ep ServicePoint) Status() error

func (ServicePoint) Stop

func (ep ServicePoint) Stop() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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