Skip to content

Conversation

@sjorsdonkers
Copy link
Contributor

Replaces: #524

@sjorsdonkers sjorsdonkers changed the base branch from main to node_subtypes April 18, 2025 10:08
Base automatically changed from node_subtypes to main April 18, 2025 11:46
@karlseguin
Copy link
Collaborator

Looks good.

I don't want to beat a dead horse, but.. getValueByObjectId takes an *const Executor, so that you can return a Value (which needs it) and you need the Value to get the TaggedAnyOpaque for the ptr+subtype.

It's a bit less direct, and doesn't depend on an Executor, versus:

pub fn getNodePtr(self: *const Inspector, allocator: Allocator, , object_id: []const u8) !?*anyopaque {
  const unwrapped = try self.session.unwrapObject(allocator, object_id);
  const toa = getTaggedAnyOpaque(unwrapped.value) orelse return null;
  if (toa.subtype == null or toa.subtype != .node) return error.ObjectIdIsNotANode;
  return toa.ptr;
}

@sjorsdonkers sjorsdonkers mentioned this pull request Apr 22, 2025
if (params.nodeId != null) {
const node = bc.node_registry.lookup_by_id.get(params.nodeId.?) orelse return error.NodeNotFound;
return cmd.sendResult(.{ .node = bc.nodeWriter(node, .{}) }, .{});
} else if (params.objectId != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't really need a else here isn't it?

I would prefer have:

if (params.nodeId != null) {
    // ...
}

if (params.objectId != null) {
    // ...
}

return error.MissingParams;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed : a698ff8
Note that it is correct since every if branch returns.
The if else structure was indicating that only one of the paths should be taking.

@krichprollsch krichprollsch merged commit 1b74289 into main Apr 22, 2025
12 checks passed
@krichprollsch krichprollsch deleted the describeNode2 branch April 22, 2025 11:57
@github-actions github-actions bot locked and limited conversation to collaborators Apr 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants