-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor XREF to use Sasha plane file storage instead of Dali IPT #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Modified saxref.cpp to save XREF branches to Sasha plane instead of Dali IPT - Created directory structure: <sasha_prefix>/xref/<cluster>/<datestamp>/ - Store path reference in Dali cluster tree instead of full data - Updated XRefNodeManager.cpp to read from path-based files - Maintained backward compatibility by falling back to "data" attribute Co-authored-by: jakesmith <[email protected]>
Co-authored-by: jakesmith <[email protected]>
Co-authored-by: jakesmith <[email protected]>
jakesmith
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - see comments.
dali/sasha/saxref.cpp
Outdated
| { | ||
| StringBuffer planeName; | ||
| // Look for sasha plane | ||
| if (getDefaultPlane(planeName, nullptr, "sasha")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - There should always be a sasha plane categeory defined.
This should throw an error if one cannot be found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c7c4bbb - Now throws error if Sasha plane category not found instead of falling back.
dali/sasha/saxref.cpp
Outdated
| if (sashaPlane) | ||
| { | ||
| StringBuffer prefix; | ||
| if (sashaPlane->getProp("@prefix", prefix)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - the above calls could be simplified by using getDefaultPlaneDirectory to get the prefix directly (and throwing an error if fails)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c7c4bbb - Simplified to use getDefaultPlane + getStoragePlaneConfig. Note: getDefaultPlaneDirectory is a static function not available in the header.
dali/sasha/saxref.cpp
Outdated
| addPathSepChar(sashaDir).append(datestamp); | ||
|
|
||
| // Create the directory | ||
| Owned<IFile> dir = createIFile(sashaDir.str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - use recursiveCreateDirectoryForFile instead and fire an error if it fails.
We should not failover to write to dali.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c7c4bbb - Now uses recursiveCreateDirectoryForFile and throws error on failure (no fallback to Dali).
dali/sasha/saxref.cpp
Outdated
| saveSuccess = saveBranchToSashaPlane(sashaDir.str(), "Orphans", orphansbranch) && saveSuccess; | ||
| saveSuccess = saveBranchToSashaPlane(sashaDir.str(), "Lost", lostbranch) && saveSuccess; | ||
| saveSuccess = saveBranchToSashaPlane(sashaDir.str(), "Found", foundbranch) && saveSuccess; | ||
| saveSuccess = saveBranchToSashaPlane(sashaDir.str(), "Directories", dirbranch) && saveSuccess; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - use 'warn' in saveBranchToSashaPlane to preserve and publish the warning, but don't bother with 'saveSuccess' and a return result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c7c4bbb - saveBranchToSashaPlane now uses warn() and has no return value or saveSuccess tracking.
dali/sasha/saxref.cpp
Outdated
| } | ||
| saveSuccess = saveBranchToSashaPlane(sashaDir.str(), "Messages", message) && saveSuccess; | ||
|
|
||
| if (saveSuccess) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - see previous comment. Get rid of 'saveSuccess'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c7c4bbb - Removed saveSuccess tracking completely.
dali/sasha/saxref.cpp
Outdated
| // Store path reference in Dali instead of full data | ||
| // Convert to hostname-based URL if not a local path | ||
| StringBuffer pathUrl; | ||
| if (!isAbsolutePath(sashaDir.str())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - this in fact is not necessary, simply store the sashaDir in all cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c7c4bbb - Now stores plain sashaDir path directly (no URL conversion).
dali/sasha/saxref.cpp
Outdated
| } | ||
| } | ||
|
|
||
| if (!useSashaPlane) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given we are not going to failover to this. Just make this the else branch of if (useSashaPlane)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c7c4bbb - Made it a simple else branch with no fallback logic.
dali/dfuXRefLib/XRefNodeManager.cpp
Outdated
| { | ||
| StringBuffer basePath(xrefPath); | ||
| // Handle file:// URLs | ||
| if (hasPrefix(basePath, "file://", false)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - this is not necessary, remove this block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c7c4bbb - Removed file:// URL handling block entirely.
dali/dfuXRefLib/XRefNodeManager.cpp
Outdated
| } | ||
|
|
||
| // Fall back to loading from "data" attribute if path not available or failed | ||
| if (!m_XRefTree->hasProp("Orphans") && !m_XRefTree->hasProp("Lost") && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - don't failover like this, simply make this the else branch if xrefpath is missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c7c4bbb - Made it a simple else branch instead of fallback logic.
|
|
||
| } | ||
|
|
||
| CXRefNode::CXRefNode(IPropertyTree* pTreeRoot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - in fact , all changes to this version of the ctor should be undone. This ctor is unused, leave it untouched for now.
The correct place to handle xrefPath is in places like CXRefNode::getOrphanFiles(), getFoundFiles, getLostFiles, getDataTree , and CXRefFilesNode (e.g. queryData()), which currently looks at "data" and then uses that MemoryBuffer to create an IPT (in queryDataTree), or Serialize that returns it into a StringBuffer.
These methods need to cope with the new and old approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c7c4bbb - Reverted all changes to CXRefNode(IPropertyTree*) constructor. Added loadBranchFromPath helper and modified getLostFiles, getFoundFiles, getOrphanFiles, serializeMessages, and serializeDirectories to handle xrefPath properly.
- Made useSashaPlane configurable via expert option (default to isContainerized) - Simplified sasha plane setup to throw errors if not configured - Use recursiveCreateDirectoryForFile for directory creation - Removed saveSuccess tracking, use warn() in saveBranchToSashaPlane - Store plain sashaDir path instead of URL - Reverted all changes to CXRefNode(IPropertyTree*) constructor - Added loadBranchFromPath helper to load from xrefPath - Modified getLostFiles, getFoundFiles, getOrphanFiles to load from path - Modified serializeMessages and serializeDirectories to load from path - Removed fallback to Dali storage (throw error instead) Co-authored-by: jakesmith <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Several problems:
- loadBranchFromPath is currently conditional on whether the individual branch nodea re present or not, but it should be based purely on whether xrefPath was present.
- it's loading the branch into the m_XRefTree, which is a tree in Dali, and it then commits it, pushing the loaded trees into Dali. That is not the goal/wanted. We want to keep the external file base trees out of Dali.
- The trees are saved in various places (see places that do setPropBin("data" ..). This works if the data is to be stored in Dali, but our goal is to save them back to disk. NB: if the original was in dali, after save, xrefPath can be set, so future handling can use the diskbased versions
- CXRefFilesNode needs to cope with the old way and new way, paying careful attention to the way the old way read/set "data", and how the new way should load the tree from disk and if request to, serialize it back to disk.
jakesmith
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - there are Several problems:
- loadBranchFromPath is currently conditional on whether the individual branch nodea re present or not, but it should be based purely on whether xrefPath was present.
- it's loading the branch into the m_XRefTree, which is a tree in Dali, and it then commits it, pushing the loaded trees into Dali. That is not the goal/wanted. We want to keep the external file base trees out of Dali.
- The trees are saved in various places (see places that do setPropBin("data" ..). This works if the data is to be stored in Dali, but our goal is to save them back to disk. NB: if the original was in dali, after save, xrefPath can be set, so future handling can use the diskbased versions
- CXRefFilesNode needs to cope with the old way and new way, paying careful attention to the way the old way read/set "data", and how the new way should load the tree from disk and if request to, serialize it back to disk.
@copilot - please fix these issues.
- Modified CXRefFilesNode to handle both file-based and Dali-based storage - Added setXRefPath() method to CXRefFilesNode - queryData() loads from file when xrefPath is set, otherwise from "data" attribute - Deserialize() saves to file when xrefPath is set, otherwise to "data" attribute - Updated getLostFiles, getFoundFiles, getOrphanFiles to set xrefPath on CXRefFilesNode - Don't commit file-loaded branches to Dali - Updated serializeMessages/Directories and deserializeMessages/Directories to handle file-based storage - Removed loadBranchFromPath helper that was loading into Dali Co-authored-by: jakesmith <[email protected]>
Fixed in ab4d5fa:
|
XREF Refactoring - Fixed File Storage Implementation
This PR refactors how saxref saves XREF branches to move from Dali IPT (in-memory property tree) to file-based storage on the Sasha plane.
Latest Changes (Addressing Review Feedback):
CXRefFilesNode Changes
XRefNodeManager Changes
Storage Path Structure
<sasha_prefix>/xref/<cluster>/<YYYY-MM-DD>/<branch>.xmlHow It Works
File-based storage (xrefPath exists):
<xrefPath>/<branchName>.xml<xrefPath>/<branchName>.xmlDali-based storage (no xrefPath):
Configuration
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.