code: func NewNode(opts NodeOptions) *Node {
  	cfg := opts.Config
  	if cfg == nil {
  		cfg = DefaultNodeConfig()
  	}
  	if opts.TickInterval == 0 {
  		opts.TickInterval = time.Second
  	}
  	if opts.SendTimeout == 0 {
  		opts.SendTimeout = 2 * time.Second
  	}
  
  	raftStore := raft.NewMemoryStorage()
  
  	n := &Node{
  		cluster:   membership.NewCluster(),
  		raftStore: raftStore,
  		opts:      opts,
  		Config: &raft.Config{
  			ElectionTick:    cfg.ElectionTick,
  			HeartbeatTick:   cfg.HeartbeatTick,
  			Storage:         raftStore,
  			MaxSizePerMsg:   cfg.MaxSizePerMsg,
  			MaxInflightMsgs: cfg.MaxInflightMsgs,
  			Logger:          cfg.Logger,
  			CheckQuorum:     cfg.CheckQuorum,
  		},
  		doneCh:              make(chan struct{}),
  		RemovedFromRaft:     make(chan struct{}),
  		stopped:             make(chan struct{}),
  		leadershipBroadcast: watch.NewQueue(),
  		keyRotator:          opts.KeyRotator,
  	}
  	n.memoryStore = store.NewMemoryStore(n)
  
  	if opts.ClockSource == nil {
  		n.ticker = clock.NewClock().NewTicker(opts.TickInterval)
  	} else {
  		n.ticker = opts.ClockSource.NewTicker(opts.TickInterval)
  	}
  
  	n.reqIDGen = idutil.NewGenerator(uint16(n.Config.ID), time.Now())
  	n.wait = newWait()
  
  	n.cancelFunc = func(n *Node) func() {
  		var cancelOnce sync.Once
  		return func() {
  			cancelOnce.Do(func() {
  				close(n.stopped)
  			})
  		}
  	}(n)
  
  	return n
  }
docs: // NewNode generates a new Raft node