()
| 1025 | } |
| 1026 | |
| 1027 | func (n *node) leaderBlocking() (*conn.Pool, error) { |
| 1028 | pool := groups().Leader(groups().groupId()) |
| 1029 | if pool == nil { |
| 1030 | // Functions like retrieveSnapshot and joinPeers are blocking at initial start and |
| 1031 | // leader election for a group might not have happened when it is called. If we can't |
| 1032 | // find a leader, get latest state from Zero. |
| 1033 | if err := UpdateMembershipState(context.Background()); err != nil { |
| 1034 | return nil, errors.Errorf("Error while trying to update membership state: %+v", err) |
| 1035 | } |
| 1036 | return nil, errors.Errorf("Unable to reach leader in group %d", n.gid) |
| 1037 | } |
| 1038 | return pool, nil |
| 1039 | } |
| 1040 | |
| 1041 | func (n *node) Snapshot() (*pb.Snapshot, error) { |
| 1042 | if n == nil || n.Store == nil { |
no test coverage detected