(zero *grpc.ClientConn, dg *dgo.Dgraph)
| 221 | } |
| 222 | |
| 223 | func getWriteTimestamp(zero *grpc.ClientConn, dg *dgo.Dgraph) uint64 { |
| 224 | if zero != nil { |
| 225 | client := pb.NewZeroClient(zero) |
| 226 | for { |
| 227 | ctx, cancel := context.WithTimeout(context.Background(), time.Second) |
| 228 | ts, err := client.Timestamps(ctx, &pb.Num{Val: 1}) |
| 229 | cancel() |
| 230 | if err == nil { |
| 231 | return ts.GetStartId() |
| 232 | } |
| 233 | fmt.Printf("Error communicating with dgraph zero, retrying: %v", err) |
| 234 | time.Sleep(time.Second) |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | for { |
| 239 | ctx, cancel := context.WithTimeout(context.Background(), time.Second) |
| 240 | _, ts, err := dg.AllocateTimestamps(ctx, 1) |
| 241 | cancel() |
| 242 | if err == nil { |
| 243 | return ts |
| 244 | } |
| 245 | fmt.Printf("Error communicating with dgraph alpha, retrying: %v", err) |
| 246 | time.Sleep(time.Second) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | // leaseNamespace is called at the end of map phase. It leases the namespace ids till the maximum |
| 251 | // seen namespace id. |
no test coverage detected
searching dependent graphs…