Skip to content

Commit

Permalink
Add an API that make a sentinel globally accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
ypkang committed Sep 12, 2023
1 parent 6fdd61d commit 521750d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions jaseci_core/jaseci/extens/api/global_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,26 @@ def global_delete(self, name: str):
@Interface.admin_api()
def global_sentinel_set(self, snt: Sentinel = None):
"""
Set sentinel as globally accessible
Make a sentinel globally accessible and set it as the global sentinel
"""
snt.make_read_only()
snt.propagate_access()
self._h.save_glob("GLOB_SENTINEL", snt.jid)
return {"response": f"Global sentinel set to '{snt}'!"}

@Interface.admin_api()
def global_sentinel_set_access(self, snt: Sentinel = None):
"""
Make a sentinel globally accessible
"""
snt.make_read_only()
snt.propagate_access()
return {"response": f"Sentinel '{snt}' is now globally accessible."}

@Interface.admin_api()
def global_sentinel_unset(self):
"""
Set sentinel as globally accessible
Unset a global sentinel
"""
current = self.global_get("GLOB_SENTINEL")["value"]
if current:
Expand Down

0 comments on commit 521750d

Please sign in to comment.