Example #1
0
func NewPopulatedMVCCMetadata(r randyMvcc, easy bool) *MVCCMetadata {
	this := &MVCCMetadata{}
	if r.Intn(10) != 0 {
		this.Txn = NewPopulatedTxnMeta(r, easy)
	}
	v3 := cockroach_util_hlc.NewPopulatedTimestamp(r, easy)
	this.Timestamp = *v3
	this.Deleted = bool(bool(r.Intn(2) == 0))
	this.KeyBytes = int64(r.Int63())
	if r.Intn(2) == 0 {
		this.KeyBytes *= -1
	}
	this.ValBytes = int64(r.Int63())
	if r.Intn(2) == 0 {
		this.ValBytes *= -1
	}
	if r.Intn(10) != 0 {
		v4 := r.Intn(100)
		this.RawBytes = make([]byte, v4)
		for i := 0; i < v4; i++ {
			this.RawBytes[i] = byte(r.Intn(256))
		}
	}
	if r.Intn(10) != 0 {
		this.MergeTimestamp = cockroach_util_hlc.NewPopulatedTimestamp(r, easy)
	}
	if !easy && r.Intn(10) != 0 {
	}
	return this
}
Example #2
0
func NewPopulatedTxnMeta(r randyMvcc, easy bool) *TxnMeta {
	this := &TxnMeta{}
	if r.Intn(10) != 0 {
		this.ID = github_com_cockroachdb_cockroach_util_uuid.NewPopulatedUUID(r)
	}
	this.Isolation = IsolationType([]int32{0, 1}[r.Intn(2)])
	if r.Intn(10) != 0 {
		v1 := r.Intn(100)
		this.Key = make([]byte, v1)
		for i := 0; i < v1; i++ {
			this.Key[i] = byte(r.Intn(256))
		}
	}
	this.Epoch = uint32(r.Uint32())
	v2 := cockroach_util_hlc.NewPopulatedTimestamp(r, easy)
	this.Timestamp = *v2
	this.Priority = int32(r.Int31())
	if r.Intn(2) == 0 {
		this.Priority *= -1
	}
	this.Sequence = int32(r.Int31())
	if r.Intn(2) == 0 {
		this.Sequence *= -1
	}
	this.BatchIndex = int32(r.Int31())
	if r.Intn(2) == 0 {
		this.BatchIndex *= -1
	}
	if !easy && r.Intn(10) != 0 {
	}
	return this
}