Changeset 1584
- Timestamp:
- 10/30/08 12:42:05 (2 months ago)
- Files:
-
- branches/0.4.7/shell/state/ddb.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/0.4.7/shell/state/ddb.py
r1582 r1584 594 594 return ring 595 595 596 def state_running(self,node,hostname): 597 if node.watch.has_key(hostname): 598 del node.watch[hostname] 599 600 a = self.mdns.getCache(hostname,types=[zeroconf._TYPE_TXT,])[0] 601 a.setProperty("state","running") 602 603 604 def state_stale(self,node,hostname): 605 node.watch[hostname].setProperty("state","stale") 606 del node.watch[hostname] 607 x = ACoreService(self.bus,self.bus.address) 608 x.nop() 609 596 610 @public 597 611 def dconfirm(self, index, addr): 612 rcpt = addr["from"].split("@")[-1] 598 613 node = self.get(index) 599 del node.dsync[ addr["from"].split("@")[-1]]600 del node.watch[addr["from"].split("@")[-1]]614 del node.dsync[rcpt] 615 self.state_running(node,rcpt) 601 616 node.dconfirmed[addr["from"]] = index 602 617 603 618 @public 604 619 def uconfirm(self, index, data, addr): 620 rcpt = addr["from"].split("@")[-1] 605 621 node = self.get(index) 606 del node.usync[ addr["from"].split("@")[-1]]607 del node.watch[addr["from"].split("@")[-1]]622 del node.usync[rcpt] 623 self.state_running(node,rcpt) 608 624 node.uconfirmed[addr["from"]] = { 609 625 "index": index, … … 613 629 @public 614 630 def confirm(self, new_index, index, data, addr): 631 rcpt = addr["from"].split("@")[-1] 615 632 node = self.get(index) 616 del node.async[ addr["from"].split("@")[-1]]617 del node.watch[addr["from"].split("@")[-1]]633 del node.async[rcpt] 634 self.state_running(node,rcpt) 618 635 node.aconfirmed[addr["from"]] = { 619 636 "new_index": new_index, … … 645 662 if node.watch.has_key(hostname): 646 663 self.log("critical","Node sync (add) watchdog: low watermark touch; mark node as stale") 647 node.watch[hostname].setProperty("state","stale") 648 del node.watch[hostname] 649 x = ACoreService(self.bus,self.bus.address) 650 x.nop() 664 self.state_stale(node,hostname) 651 665 else: 652 666 self.log("debug","Node sync watchdog for host `%s` terminated: confirmed" % (hostname)) … … 674 688 if node.watch.has_key(hostname): 675 689 self.log("critical","Node sync (update) watchdog: low watermark touch; mark node as stale") 676 node.watch[hostname].setProperty("state","stale") 677 del node.watch[hostname] 678 x = ACoreService(self.bus,self.bus.address) 679 x.nop() 690 self.state_stale(node,hostname) 680 691 else: 681 692 self.log("debug","Node sync watchdog for host `%s` terminated: confirmed" % (hostname)) … … 703 714 if node.watch.has_key(hostname): 704 715 self.log("critical","Node sync (del) watchdog: low watermark touch; mark node as stale") 705 node.watch[hostname].setProperty("state","stale") 706 del node.watch[hostname] 707 x = ACoreService(self.bus,self.bus.address) 708 x.nop() 716 self.state_stale(node,hostname) 709 717 else: 710 718 self.log("debug","Node sync watchdog for host `%s` terminated: confirmed" % (hostname)) … … 729 737 for i in x: 730 738 a = self.mdns.getCache(i,types=[zeroconf._TYPE_TXT,])[0] 731 node.dsync[i] = 2739 node.dsync[i] = 5 732 740 if a.properties.has_key("state"): 733 741 if a.properties["state"] != "stale": 734 742 node.watch[i] = a 735 node.dsync[i] = 5736 743 self._t_del(i,index) 737 744 … … 783 790 for i in x: 784 791 a = self.mdns.getCache(i,types=[zeroconf._TYPE_TXT,])[0] 785 node.usync[i] = 2792 node.usync[i] = 5 786 793 if a.properties.has_key("state"): 787 794 if a.properties["state"] != "stale": 788 795 node.watch[i] = a 789 node.usync[i] = 5790 796 self._t_update(i,p) 791 797 … … 869 875 for i in x: 870 876 a = self.mdns.getCache(i,types=[zeroconf._TYPE_TXT,])[0] 871 node.async[i] = 2877 node.async[i] = 5 872 878 if a.properties.has_key("state"): 873 879 if a.properties["state"] != "stale": 874 880 node.watch[i] = a 875 node.async[i] = 5876 881 self._t_add(i,p) 877 882 #
