If the current node serves the group serve the schema or forward to relevant node TODO: Janardhan - if read fails try other servers serving same group
(ctx context.Context, gid uint32, s *pb.SchemaRequest, ch chan resultErr)
| 161 | // to relevant node |
| 162 | // TODO: Janardhan - if read fails try other servers serving same group |
| 163 | func getSchemaOverNetwork(ctx context.Context, gid uint32, s *pb.SchemaRequest, ch chan resultErr) { |
| 164 | if groups().ServesGroup(gid) { |
| 165 | schema, e := getSchema(ctx, s) |
| 166 | ch <- resultErr{result: schema, err: e} |
| 167 | return |
| 168 | } |
| 169 | |
| 170 | pl := groups().Leader(gid) |
| 171 | if pl == nil { |
| 172 | ch <- resultErr{err: conn.ErrNoConnection} |
| 173 | return |
| 174 | } |
| 175 | c := pb.NewWorkerClient(pl.Get()) |
| 176 | schema, e := c.Schema(ctx, s) |
| 177 | ch <- resultErr{result: schema, err: e} |
| 178 | } |
| 179 | |
| 180 | // GetSchemaOverNetwork checks which group should be serving the schema |
| 181 | // according to fingerprint of the predicate and sends it to that instance. |
no test coverage detected