func (s *etcdStore) Txn(ctx context.Context, req *etcdserverpb.TxnRequest) (*etcdserverpb.TxnResponse, error) {
	ireq := etcdserverpb.InternalRaftRequest{ID: <-s.idgen, Txn: req}
	msgc, errc, err := s.proposeInternalRaftRequest(ireq)
	if err != nil {
		return nil, err
	}
	select {
	case <-ctx.Done():
		s.cancelInternalRaftRequest(ireq)
		return nil, ctx.Err()
	case msg := <-msgc:
		return msg.(*etcdserverpb.TxnResponse), nil
	case err := <-errc:
		return nil, err
	case <-s.quitc:
		return nil, errStopped
	}
}
func (s *etcdStore) Txn(ctx context.Context, req *etcdserverpb.TxnRequest) (*etcdserverpb.TxnResponse, error) {
	ireq := etcdserverpb.InternalRaftRequest{ID: <-s.idgen, Txn: req}
	msgc, errc, err := s.proposeInternalRaftRequest(ireq)
	if err != nil {
		return nil, err
	}
	select {
	case <-ctx.Done():
		s.cancelInternalRaftRequest(ireq)
		return nil, ctx.Err()
	case msg := <-msgc:
		return msg.(*etcdserverpb.TxnResponse), nil
	case err := <-errc:
		return nil, err
	case <-s.quitc:
		return nil, errStopped
	}
}
// Txn implements gRPC KVServer.
// Txn processes all the requests in one transaction.
// A txn request increases the revision of the store,
// and generates events with the same revision in the event history.
// It is not allowed to modify the same key several times within one txn.