orderer

package
v0.0.0-...-7b2e207 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DiscoveryInterval = time.Second * 5

DiscoveryInterval is the time between each discovery checks

Functions

func SetLogLevel

func SetLogLevel(l logging.Level)

SetLogLevel sets the log level of the logger

Types

type Discovery

type Discovery struct {
	sync.Mutex

	OnUpdateFunc func(addrs []string)
	// contains filtered or unexported fields
}

Discovery defines a structure for fetching a list of addresses of orderers accessible in the cluster.

func NewDiscovery

func NewDiscovery() (*Discovery, error)

NewDiscovery creates a new discovery object. Returns error if unable to connector to the service discovery. Setting the env variable `CONSUL_ADDR` will override the default config address.

func (*Discovery) Add

func (od *Discovery) Add(addr string)

Add a new orderer address

func (*Discovery) Discover

func (od *Discovery) Discover() error

Discover starts a ticker that discovers and updates the list of orderer addresses. It will perform the discovery immediately and will return error if it fails, otherwise nil is returned and subsequent discovery will be performed periodically

func (*Discovery) GetAddrs

func (od *Discovery) GetAddrs() []string

GetAddrs returns the list of discovered addresses

func (*Discovery) GetGRPConn

func (od *Discovery) GetGRPConn() (*grpc.ClientConn, error)

GetGRPConn dials a random orderer address and returns a grpc connection. If no orderer address has been discovered, nil and are error are returned.

func (*Discovery) GetRandAddr

func (od *Discovery) GetRandAddr() string

GetRandAddr returns a randomly selected address or an empty string if no address is available

func (*Discovery) Len

func (od *Discovery) Len() int

Len returns the number of orderer addresses

func (*Discovery) Stop

func (od *Discovery) Stop()

Stop stops the discovery ticker

type Orderer

type Orderer struct {
	EventEmitter *emission.Emitter
	// contains filtered or unexported fields
}

Orderer defines a transaction ordering, block creation and inclusion module

func NewOrderer

func NewOrderer() *Orderer

NewOrderer creates a new Orderer object

func (*Orderer) CreateLedger

func (od *Orderer) CreateLedger(ctx context.Context, params *proto_orderer.CreateLedgerParams) (*proto_orderer.Ledger, error)

CreateLedger creates a new ledger

func (*Orderer) Get

Get returns a transaction with a matching key

func (*Orderer) GetBlockByID

func (od *Orderer) GetBlockByID(ctx context.Context, params *proto_orderer.GetBlockParams) (*proto_orderer.Block, error)

GetBlockByID returns a block by its id and chain/ledger name

func (*Orderer) GetLedger

GetLedger returns a ledger

func (*Orderer) GetRange

GetRange fetches transactions between a range of keys

func (*Orderer) Put

Put creates a new transaction

func (*Orderer) SetBlockchain

func (od *Orderer) SetBlockchain(b types.Blockchain)

SetBlockchain sets the blockchain implementation

func (*Orderer) SetStore

func (od *Orderer) SetStore(ch types.Store)

SetStore sets the store implementation to use.

func (*Orderer) Start

func (od *Orderer) Start(addr, storeConStr string, endedCh chan bool)

Start starts the order service

func (*Orderer) Stop

func (od *Orderer) Stop()

Stop stops the orderer

Jump to

Keyboard shortcuts

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