Skip to content

capabilities: implement ping#30

Open
shelby-fulton-villageSQL wants to merge 7 commits into
mainfrom
shelby/implement-ping-capability
Open

capabilities: implement ping#30
shelby-fulton-villageSQL wants to merge 7 commits into
mainfrom
shelby/implement-ping-capability

Conversation

@shelby-fulton-villageSQL

Copy link
Copy Markdown
Member

Capabilities were ported over and ping was implemented. Claude generated most of this. Learning more Rust before continuing with the rest of the capabilities.

@malone-at-work malone-at-work marked this pull request as ready for review July 1, 2026 20:39

@malone-at-work malone-at-work left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks Good - one suggestion.

Comment thread examples/vsql_ping/src/lib.rs Outdated
villagesql::func!(ping_impl, "ping", [] -> villagesql::Type::Int),
],
capabilities: [
PingCapability::request(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

request() does't sound like the right name; could we instead create a Capability trait with that function? and rename capablities, to requires: so registration would look something like:

  requires: [
    PingCapabilty,
  ]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hey Mike, went ahead and implemented what we talked about. Added a Capability trait and renamed capabilities: to requires:.

Tried my best to match with what already exists on the C++ side. The vtable is now a field inside each capability instance instead of a global static. The authors now will declare the capability as a static and pass a reference to it:

static PING: PingCapability = PingCapability::new();
// ...
requires: [
&PING,
]

Now I'm moving on to apply the same type of changes to the sys_var branch.

@malone-at-work

Copy link
Copy Markdown
Member

One other suggestion can you do a PR description like: "capabilities: implement Ping"

@shelby-fulton-villageSQL shelby-fulton-villageSQL changed the title Ping Capability capabilities: implement Ping Jul 6, 2026
@shelby-fulton-villageSQL shelby-fulton-villageSQL changed the title capabilities: implement Ping capabilities: implement ping Jul 6, 2026

@malone-at-work malone-at-work left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

Comment thread examples/vsql_ping/src/lib.rs Outdated
/// monotonically incrementing counter. Returns NULL if the capability was not
/// populated (e.g. `vsql_allow_preview_extensions` is OFF).
#[allow(clippy::cast_possible_wrap)]
fn ping_impl(_args: &[InValue]) -> VdfReturn {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry - one more nit - this maybe should be 'call_ping_impl()' and the VDF 'call_ping'? I know you are basing it on the C++, but it is confusing. This calls ping, which is implemented by the server.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Made those changes if you want to check before I squash and merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants