MCPcopy
hub / github.com/apache/caldera / store

Method store

app/objects/c_agent.py:143–154  ·  view source on GitHub ↗
(self, ram)

Source from the content-addressed store, hash-verified

141 self.log = self.create_logger('agent')
142
143 def store(self, ram):
144 existing = self.retrieve(ram['agents'], self.unique)
145 if not existing:
146 ram['agents'].append(self)
147 return self.retrieve(ram['agents'], self.unique)
148 existing.update('group', self.group)
149 existing.update('trusted', self.trusted)
150 existing.update('sleep_min', self.sleep_min)
151 existing.update('sleep_max', self.sleep_max)
152 existing.update('watchdog', self.watchdog)
153 existing.update('pending_contact', self.pending_contact)
154 return existing
155
156 async def calculate_sleep(self):
157 return self.jitter('%d/%d' % (self.sleep_min, self.sleep_max))

Callers 5

test_store_new_agentMethod · 0.95
replace_objectMethod · 0.45

Calls 2

retrieveMethod · 0.80
updateMethod · 0.80

Tested by 2

test_store_new_agentMethod · 0.76