func (alloc *Allocator) loadPersistedData() bool {
	var checkPeerName mesh.PeerName
	nameFound, err := alloc.db.Load(db.NameIdent, &checkPeerName)
	if err != nil {
		alloc.fatalf("Error loading persisted peer name: %s", err)
	}
	var persistedRing *ring.Ring
	ringFound, err := alloc.db.Load(ringIdent, &persistedRing)
	if err != nil {
		alloc.fatalf("Error loading persisted IPAM data: %s", err)
	}
	var persistedOwned map[string]ownedData
	ownedFound, err := alloc.db.Load(ownedIdent, &persistedOwned)
	if err != nil {
		alloc.fatalf("Error loading persisted address data: %s", err)
	}

	overwritePersisted := func(fmt string, args ...interface{}) {
		alloc.infof(fmt, args...)
		alloc.persistRing()
		alloc.persistOwned()
	}

	if !nameFound || !ringFound {
		overwritePersisted("No valid persisted data")
		return false
	}

	if checkPeerName != alloc.ourName {
		overwritePersisted("Deleting persisted data for peername %s", checkPeerName)
		return false
	}

	if persistedRing.Range() != alloc.universe.Range() {
		overwritePersisted("Deleting persisted data for IPAM range %s; our range is %s", persistedRing.Range(), alloc.universe)
		return false
	}

	alloc.ring.Restore(persistedRing)
	alloc.space.UpdateRanges(alloc.ring.OwnedRanges())

	if ownedFound {
		alloc.owned = persistedOwned
		for _, d := range alloc.owned {
			for _, cidr := range d.Cidrs {
				alloc.space.Claim(cidr.Addr)
			}
		}
	}
	return true
}
// Returns true if persisted data is to be used, otherwise false
Returns true if persisted data is to be used, otherwise false
// Returns true if persisted data is to be used otherwise false
func (alloc *Allocator) loadPersistedData() bool {
	var checkPeerName mesh.PeerName
	nameFound, err := alloc.db.Load(db.NameIdent, &checkPeerName)
	if err != nil {
		alloc.fatalf("Error loading persisted peer name: %s", err)
	}
	var persistedRing *ring.Ring
	ringFound, err := alloc.db.Load(ringIdent, &persistedRing)
	if err != nil {
		alloc.fatalf("Error loading persisted IPAM data: %s", err)
	}
	var persistedOwned map[string]ownedData
	ownedFound, err := alloc.db.Load(ownedIdent, &persistedOwned)
	if err != nil {
		alloc.fatalf("Error loading persisted address data: %s", err)
	}
	overwritePersisted := func(fmt string, args ...interface{}) {
		alloc.infof(fmt, args...)
		alloc.persistRing()
		alloc.persistOwned()
	}
	if !nameFound || !ringFound {
		overwritePersisted("No valid persisted data")
		return false
	}
	if checkPeerName != alloc.ourName {
		overwritePersisted("Deleting persisted data for peername %s", checkPeerName)
		return false
	}
	if persistedRing.Range() != alloc.universe.Range() {
		overwritePersisted("Deleting persisted data for IPAM range %s; our range is %s", persistedRing.Range(), alloc.universe)
		return false
	}
	alloc.ring.Restore(persistedRing)
	alloc.space.UpdateRanges(alloc.ring.OwnedRanges())
	if ownedFound {
		alloc.owned = persistedOwned
		for _, d := range alloc.owned {
			for _, cidr := range d.Cidrs {
				alloc.space.Claim(cidr.Addr)
			}
		}
	}
	return true
}
func ( alloc * Allocator ) loadPersistedData ( ) bool { var checkPeerName mesh . PeerName nameFound , err := alloc . db . Load ( db . NameIdent , & checkPeerName ) if err != nil { alloc . fatalf ( " " , err ) } var persistedRing * ring . Ring ringFound , err := alloc . db . Load ( ringIdent , & persistedRing ) if err != nil { alloc . fatalf ( " " , err ) } var persistedOwned map [ string ] ownedData ownedFound , err := alloc . db . Load ( ownedIdent , & persistedOwned ) if err != nil { alloc . fatalf ( " " , err ) } overwritePersisted := func ( fmt string , args ... interface { } ) { alloc . infof ( fmt , args ... ) alloc . persistRing ( ) alloc . persistOwned ( ) } if ! nameFound || ! ringFound { overwritePersisted ( " " ) return false } if checkPeerName != alloc . ourName { overwritePersisted ( " " , checkPeerName ) return false } if persistedRing . Range ( ) != alloc . universe . Range ( ) { overwritePersisted ( " " , persistedRing . Range ( ) , alloc . universe ) return false } alloc . ring . Restore ( persistedRing ) alloc . space . UpdateRanges ( alloc . ring . OwnedRanges ( ) ) if ownedFound { alloc . owned = persistedOwned for _ , d := range alloc . owned { for _ , cidr := range d . Cidrs { alloc . space . Claim ( cidr . Addr ) } } } return true }
Returns true if persisted data is to be used, otherwise false
Returns true if persisted data is to be used otherwise false