Skip to content
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

Separate protobuf messages from buttplug to consumer into system messages and return values for client/device "method" calls #68

Open
kitlith opened this issue Apr 21, 2021 · 2 comments
Assignees

Comments

@kitlith
Copy link
Contributor

kitlith commented Apr 21, 2021

Feature Description

See title, the idea is that since every call now takes a callback, we can more strongly type the protobuf messages that consumers receive back from FFI proper.

@kitlith
Copy link
Contributor Author

kitlith commented Apr 22, 2021

hmm, i think there's going to be a bit more involved here, actually.

First off, ClientMessage, DeviceMessage, and ButtplugFFIServerMessage have unused fields, in the form of id (and index for device), and otherwise wrap *.FFIMessage. We should be able to ditch those unused fields, and then bring the contents of FFIMessage into the outer message, meaning that an inner FFIMessage is no longer necessary.

Second off, I think the Ok and Error messages can be lifted up to the top level, and we can start creating 'Result' messages. i.e.

message ResultVoid {
  oneof msg {
    Ok ok = 1;
    Error error = 2;
  }
}

message ResultDeviceEvent {
  oneof msg {
    DeviceEvent ok = 1;
    Error error = 2;
  }
}

maybe with types for the individual sub-messages of DeviceEvent instead of DeviceEvent itself, to make some things potentially even easier.

also, TIL about protobuf's service definition, which is separated from gRPC -- aka we can build our own """RPC""" system that can work with protobuf that serves our need of crossing the FFI boundary. This may be worth further investigation.

@kitlith
Copy link
Contributor Author

kitlith commented Apr 23, 2021

mark this as something to consider for ffi core 3.0 i guess, if we don't decide to nix protobuf entirely by then.

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

No branches or pull requests

2 participants