Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChannelSupportRegistrar 只是某个chanel的 #20

Open
yfhk opened this issue Nov 23, 2018 · 6 comments
Open

ChannelSupportRegistrar 只是某个chanel的 #20

yfhk opened this issue Nov 23, 2018 · 6 comments

Comments

@yfhk
Copy link
Owner

yfhk commented Nov 23, 2018

// ChannelSupportRegistrar provides a way for the Handler to look up the Support for a channel
type ChannelSupportRegistrar interface {
// BroadcastChannelSupport returns the message channel header, whether the message is a config update
// and the channel resources for a message or an error if the message is not a message which can
// be processed directly (like CONFIG and ORDERER_TRANSACTION messages)
BroadcastChannelSupport(msg *cb.Envelope) (*cb.ChannelHeader, bool, ChannelSupport, error)
}

type handlerImpl struct {
sm ChannelSupportRegistrar
}

// Handle starts a service thread for a given gRPC connection and services the broadcast connection
func (bh *handlerImpl) Handle(srv ab.AtomicBroadcast_BroadcastServer) error {
addr := util.ExtractRemoteAddress(srv.Context())
logger.Debugf("Starting new broadcast loop for %s", addr)
for {
msg, err := srv.Recv()
if err == io.EOF {
logger.Debugf("Received EOF from %s, hangup", addr)
return nil
}
if err != nil {
logger.Warningf("Error reading from %s: %s", addr, err)
return err
}

@yfhk
Copy link
Owner Author

yfhk commented Nov 23, 2018

其他的channel上面也会有一个systemchannel

@yfhk
Copy link
Owner Author

yfhk commented Nov 23, 2018

创建channel的命令只发给一个orderer还是所有的orderer都要执行?

@yfhk
Copy link
Owner Author

yfhk commented Nov 23, 2018

orderer之间广播?还是由sdk来广播给所有的orderer?

@yfhk
Copy link
Owner Author

yfhk commented Nov 23, 2018

// Channel gives read only access to the channel configuration
type Channel interface {
// HashingAlgorithm returns the default algorithm to be used when hashing
// such as computing block hashes, and CreationPolicy digests
HashingAlgorithm() func(input []byte) []byte

// BlockDataHashingStructureWidth returns the width to use when constructing the
// Merkle tree to compute the BlockData hash
BlockDataHashingStructureWidth() uint32

// OrdererAddresses returns the list of valid orderer addresses to connect to to invoke Broadcast/Deliver
OrdererAddresses() []string

// Capabilities defines the capabilities for a channel
Capabilities() ChannelCapabilities

}

@yfhk
Copy link
Owner Author

yfhk commented Nov 23, 2018

if isOrdererRequired {
	if len(common.OrderingEndpoint) == 0 {
		orderingEndpoints, err := common.GetOrdererEndpointOfChainFnc(channelID, signer, endorserClient)
		if err != nil {
			return nil, fmt.Errorf("Error getting (%s) orderer endpoint: %s", channelID, err)
		}
		if len(orderingEndpoints) == 0 {
			return nil, fmt.Errorf("Error no orderer endpoint got for %s", channelID)
		}
		logger.Infof("Get chain(%s) orderer endpoint: %s", channelID, orderingEndpoints[0])
		// override viper env
		viper.Set("orderer.address", orderingEndpoints[0])
	}

	broadcastClient, err = common.GetBroadcastClientFnc(channelID)

@yfhk
Copy link
Owner Author

yfhk commented Nov 23, 2018

从上面看出,只需要一个ip就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant