Exemple #1
0
func checkRequestRange(kv dstorage.KV, reqs []*pb.RequestUnion) error {
	for _, requ := range reqs {
		greq := requ.RequestRange
		if greq == nil || greq.Revision == 0 {
			continue
		}

		if greq.Revision > kv.Rev() {
			return dstorage.ErrFutureRev
		}
		if greq.Revision < kv.FirstRev() {
			return dstorage.ErrCompacted
		}
	}
	return nil
}