Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fadb467
added the clear function to the events
rherrell Jul 11, 2024
1fc483d
added clearResources and TriggerEvents
rherrell Jul 11, 2024
a5a968d
installed reset_resources in file system backend_FS.py
rherrell Jul 19, 2024
039816a
added Signed code and copyright
rherrell Jul 31, 2024
d356f45
Merge branch 'rwh_newClear' into rwh_CXL_Agent_start
rherrell Jul 31, 2024
2eebf52
Removed circular call where the core library calls itself instead of …
christian-pinto Jul 26, 2024
b44998b
Bump zipp from 3.17.0 to 3.19.1
dependabot[bot] Aug 12, 2024
39926a8
removed un-used ClearResources event
rherrell Aug 15, 2024
1196a30
ready to rebase with main
rherrell Aug 19, 2024
89ad965
Revert "Removed circular call where the core library calls itself ins…
rherrell Aug 19, 2024
fb16e0d
recursive fetch fixes WIP
rherrell Aug 23, 2024
91200da
fixed incorrect assumption about posting only to Collections
rherrell Sep 7, 2024
7d4ca8e
more fixes in forward_to_agent logic
rherrell Sep 12, 2024
9bbf979
TriggerEvent handler WIP
rherrell Sep 20, 2024
5b53797
fixed another bug in uploading existing objects
rherrell Sep 25, 2024
ff38b09
added check for duplicate resource in CreateResource event handler
rherrell Oct 2, 2024
ce02983
have working renamer -- no translators yet
rherrell Oct 17, 2024
607c258
Agent upload collisions renamed, aliasDB now updated
rherrell Oct 22, 2024
748baaa
update of an objects aliased links now works, extra prints still incl…
rherrell Oct 25, 2024
c5b371a
added Fabric merge bookkeeping
rherrell Oct 29, 2024
3cbdf0a
correctly writes objects with renamed links back to Sunfish data base
rherrell Oct 30, 2024
e7468db
Added the boundaryPort xreference handling
rherrell Nov 8, 2024
edc58e5
fixed bugs in boundary port search and match
rherrell Nov 9, 2024
25e5bf7
Boundary Link bookkeeping and updating on upload now working
rherrell Nov 11, 2024
96fca55
properly handle redirecting host DSP Endpoints and switch links at bo…
rherrell Nov 13, 2024
845ce42
fixed the forward_to_agent bug in core.py, added renaming to/from the…
rherrell Nov 15, 2024
66044f9
eliminated pdb.settrace() calls for demo
rherrell Nov 18, 2024
d66c95a
merged latest Main into rwh_CXL_Agent_start
rherrell Nov 27, 2024
a66ea25
minor debug vs prinf statement changes
rherrell Dec 2, 2024
b3acaec
fixed a merge bug, eliminated renaming members of collections, remove…
rherrell Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions sunfish/lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,24 +232,28 @@ def replace_object(self, path: str, payload: dict):
str|exception: return the replaced resource or an exception in case of fault.
"""
object_type = self._get_type(payload, path=path)
payload_to_write = payload
# we assume no changes can be done on collections
if "Collection" in object_type:
raise CollectionNotSupported()
try:
# 1. check the path target of the operation exists
self.storage_backend.read(path)
# 2. is needed first forward the request to the agent managing the object
self.objects_manager.forward_to_manager(SunfishRequestType.REPLACE, path, payload=payload)
#self.objects_manager.forward_to_manager(SunfishRequestType.REPLACE, path, payload=payload)
agent_response = self.objects_manager.forward_to_manager(SunfishRequestType.REPLACE, path, payload=payload)
if agent_response:
payload_to_write = agent_response
# 3. Execute any custom handler for this object type
self.objects_handler.dispatch(object_type, path, SunfishRequestType.REPLACE, payload=payload)
self.objects_handler.dispatch(object_type, path, SunfishRequestType.REPLACE, payload=payload_to_write)
except ResourceNotFound:
logger.error(logger.error(f"The resource to be replaced ({path}) does not exist."))
except AttributeError:
# The object does not have a handler.
logger.debug(f"The object {object_type} does not have a custom handler")
pass
# 4. persist change in Sunfish tree
return self.storage_backend.replace(payload)
return self.storage_backend.replace(payload_to_write)

def patch_object(self, path: str, payload: dict):
"""Calls the correspondent patch function from the backend implementation.
Expand All @@ -261,6 +265,7 @@ def patch_object(self, path: str, payload: dict):
str|exception: return the updated resource or an exception in case of fault.
"""
# we assume no changes can be done on collections
payload_to_write = payload
obj = self.storage_backend.read(path)
object_type = self._get_type(obj, path=path)
if "Collection" in object_type:
Expand All @@ -269,7 +274,10 @@ def patch_object(self, path: str, payload: dict):
# 1. check the path target of the operation exists
self.storage_backend.read(path)
# 2. is needed first forward the request to the agent managing the object
self.objects_manager.forward_to_manager(SunfishRequestType.PATCH, path, payload=payload)
#self.objects_manager.forward_to_manager(SunfishRequestType.PATCH, path, payload=payload)
agent_response = self.objects_manager.forward_to_manager(SunfishRequestType.PATCH, path, payload=payload)
if agent_response:
payload_to_write = agent_response
# 3. Execute any custom handler for this object type
self.objects_handler.dispatch(object_type, path, SunfishRequestType.PATCH, payload=payload)
except ResourceNotFound:
Expand All @@ -280,7 +288,7 @@ def patch_object(self, path: str, payload: dict):
pass

# 4. persist change in Sunfish tree
return self.storage_backend.patch(path, payload)
return self.storage_backend.patch(path, payload_to_write)

def delete_object(self, path: string):
"""Calls the correspondent remove function from the backend implementation. Checks that the path is valid.
Expand Down
7 changes: 6 additions & 1 deletion sunfish/storage/backend_interface.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright IBM Corp. 2023
# Copyright Hewlett Packard Enterprise Development LP 2024
# This software is available to you under a BSD 3-Clause License.
# The full license terms are available here: https://github.com/OpenFabrics/sunfish_library_reference/blob/main/LICENSE

Expand All @@ -22,4 +23,8 @@ def patch():

@abstractmethod
def remove():
pass
pass

@abstractmethod
def reset_resources():
pass
Loading
Loading