Documentation ¶
Index ¶
- Variables
- func SetLogLevel(l logging.Level)
- type Discovery
- type Orderer
- func (od *Orderer) CreateLedger(ctx context.Context, params *proto_orderer.CreateLedgerParams) (*proto_orderer.Ledger, error)
- func (od *Orderer) Get(ctx context.Context, params *proto_orderer.GetParams) (*proto_orderer.Transaction, error)
- func (od *Orderer) GetBlockByID(ctx context.Context, params *proto_orderer.GetBlockParams) (*proto_orderer.Block, error)
- func (od *Orderer) GetLedger(ctx context.Context, params *proto_orderer.GetLedgerParams) (*proto_orderer.Ledger, error)
- func (od *Orderer) GetRange(ctx context.Context, params *proto_orderer.GetRangeParams) (*proto_orderer.Transactions, error)
- func (od *Orderer) Put(ctx context.Context, params *proto_orderer.PutTransactionParams) (*proto_orderer.PutResult, error)
- func (od *Orderer) SetBlockchain(b types.Blockchain)
- func (od *Orderer) SetStore(ch types.Store)
- func (od *Orderer) Start(addr, storeConStr string, endedCh chan bool)
- func (od *Orderer) Stop()
Constants ¶
This section is empty.
Variables ¶
var DiscoveryInterval = time.Second * 5
DiscoveryInterval is the time between each discovery checks
Functions ¶
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 ¶
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) Discover ¶
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) 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 ¶
GetRandAddr returns a randomly selected address or an empty string if no address is available
type Orderer ¶
Orderer defines a transaction ordering, block creation and inclusion module
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 ¶
func (od *Orderer) Get(ctx context.Context, params *proto_orderer.GetParams) (*proto_orderer.Transaction, error)
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 ¶
func (od *Orderer) GetLedger(ctx context.Context, params *proto_orderer.GetLedgerParams) (*proto_orderer.Ledger, error)
GetLedger returns a ledger
func (*Orderer) GetRange ¶
func (od *Orderer) GetRange(ctx context.Context, params *proto_orderer.GetRangeParams) (*proto_orderer.Transactions, error)
GetRange fetches transactions between a range of keys
func (*Orderer) Put ¶
func (od *Orderer) Put(ctx context.Context, params *proto_orderer.PutTransactionParams) (*proto_orderer.PutResult, error)
Put creates a new transaction
func (*Orderer) SetBlockchain ¶
func (od *Orderer) SetBlockchain(b types.Blockchain)
SetBlockchain sets the blockchain implementation