StreamExtSnapshot handles the stream of key-value pairs sent from proxy alpha. It receives a Forward flag from the stream to determine if the current node is the leader. If the node is the leader (Forward is true), it streams the data to its followers. Otherwise, it simply writes the data to BadgerD
(stream pb.Worker_StreamExtSnapshotServer)
| 474 | // If the node is the leader (Forward is true), it streams the data to its followers. |
| 475 | // Otherwise, it simply writes the data to BadgerDB and flushes it. |
| 476 | func (w *grpcWorker) StreamExtSnapshot(stream pb.Worker_StreamExtSnapshotServer) error { |
| 477 | glog.Info("[import] trying to update the import mode to false") |
| 478 | defer x.ExtSnapshotStreamingState(false) |
| 479 | |
| 480 | // Receive the first message to check the Forward flag. |
| 481 | // If Forward is true, this node is the leader and should forward the stream to its followers. |
| 482 | // If Forward is false, the node just writes and flushes the data. |
| 483 | forwardReq, err := stream.Recv() |
| 484 | if err != nil { |
| 485 | return err |
| 486 | } |
| 487 | |
| 488 | glog.Infof("[import] received forward flag: %v", forwardReq.Forward) |
| 489 | return streamInGroup(stream, forwardReq.Forward) |
| 490 | } |
| 491 | |
| 492 | // postStreamProcessing handles the post-stream processing of data received from the buffer into the local BadgerDB. |
| 493 | // It loads the schema, updates the membership state, informs zero about tablets, resets caches, applies initial schema, |
nothing calls this directly
no test coverage detected