示例#1
0
func addTestRange(kv *LocalKV, start, end engine.Key) *storage.Range {
	r := storage.Range{}
	rep := proto.Replica{NodeID: 1, StoreID: 1, RangeID: int64(len(kv.ranges) + 1)}
	r.Meta = &proto.RangeMetadata{
		ClusterID:       "some-cluster",
		RangeID:         rep.RangeID,
		RangeDescriptor: proto.RangeDescriptor{StartKey: start, EndKey: end, Replicas: []proto.Replica{rep}},
	}
	kv.ranges = append(kv.ranges, &r)
	return &r
}
示例#2
0
func (db *LocalDB) addTestRange(start, end engine.Key) *storage.Range {
	r := storage.Range{}
	rep := storage.Replica{NodeID: 1, StoreID: 1, RangeID: int64(len(db.ranges) + 1)}
	r.Meta = storage.RangeMetadata{
		ClusterID:       "some-cluster",
		RangeID:         rep.RangeID,
		RangeDescriptor: storage.RangeDescriptor{StartKey: start, EndKey: end, Replicas: []storage.Replica{rep}},
	}
	db.ranges = append(db.ranges, &r)
	return &r
}