Example #1
0
func (vc *VectorClock) AddToSeg(seg *capn.Segment) msgs.VectorClock {
	if vc == nil {
		vcCap := msgs.NewVectorClock(seg)
		vcCap.SetVarUuids(seg.NewDataList(0))
		vcCap.SetValues(seg.NewUInt64List(0))
		return vcCap

	} else if vc.cap == nil {
		vcCap := msgs.NewVectorClock(seg)
		vc.cap = &vcCap
		vUUIds := seg.NewDataList(len(vc.Clock))
		values := seg.NewUInt64List(len(vc.Clock))
		vcCap.SetVarUuids(vUUIds)
		vcCap.SetValues(values)
		idx := 0
		for vUUId, ver := range vc.Clock {
			vUUIds.Set(idx, vUUId[:])
			values.Set(idx, ver)
			idx++
		}
		return vcCap

	} else {
		return *vc.cap
	}
}
Example #2
0
func NewZtmList(s *C.Segment, sz int) Ztm_List { return Ztm_List(s.NewUInt64List(sz)) }
Example #3
0
func NewZdateList(s *C.Segment, sz int) Zdate_List { return Zdate_List(s.NewUInt64List(sz)) }