Exemplo n.º 1
0
// Merge merges the given delta into the existing one.
func (d *Delta) Merge(n *Delta) {
	oadd := toSet(d.Additions)
	odel := toSet(d.Deletions)
	nadd := toSet(n.Additions)
	ndel := toSet(n.Deletions)

	// First remove new deletions from old adds and vice versa
	fadd := set.Difference(oadd, ndel)
	fdel := set.Difference(odel, nadd)

	// Now add new adds and deletions
	fadd = set.Union(fadd, nadd)
	fdel = set.Union(fdel, ndel)

	d.Additions = toStrings(fadd)
	d.Deletions = toStrings(fdel)
}
Exemplo n.º 2
0
// a + b
func scpUnion(a, b []int) []int {
	sa := setFromIntSlice(a)
	sb := setFromIntSlice(b)
	sc := set.Union(sa, sb)
	c := set.IntSlice(sc)
	orderScp(c)
	return c
}
Exemplo n.º 3
0
// calculateActive calculates the active sites for the given configsets and
// stores them in the active property.
func (cs *configsets) calculateActive() {
	cs.active = set.Difference(set.Union(cs.cloud, cs.add), cs.del)
	cs.activeList = toStrings(cs.active)
}