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

Sub-descriptors, control descriptors, or another such term #75

Open
Xe opened this issue Apr 15, 2019 · 1 comment
Open

Sub-descriptors, control descriptors, or another such term #75

Xe opened this issue Apr 15, 2019 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@Xe
Copy link
Owner

Xe commented Apr 15, 2019

A thought: abi.File should be expanded to contain the idea of a "sub-descriptor", "control descriptor" or another such term. This "sub-descriptor" would fulfill the place of ioctl, accept, stat and other more complicated syscalls. Programs could read/write any structured data in plain human-readable text or msgpack.

This would enable things like the following:

const fout = try Resource.open("file:///log.txt");
const fout_meta = try fout.control("meta"); // helper method?
const delta = "mode=0600";
const n = try fout_meta.write(delta.ptr, delta.len);
const l = try Resource.open("tcp://0.0.0.0:90?mode=host");
for {
  const client = try l.control("accept");
  const client_meta = try client.control("meta");
  // read IP address on first line and log?
  // handle request
  client.close();
}
@Xe Xe added the question Further information is requested label Apr 15, 2019
@Xe Xe self-assigned this Apr 15, 2019
@acln0
Copy link

acln0 commented Apr 15, 2019

"control descriptor" sounds good to me. I'm not sure about the argument in .control("something"). I feel like the platform should multiplex key-value requests written to the control descriptor by itself somehow, and the caller shouldn't really be interested in multiple flavors of control descriptors, unless the surface of the control API is huge, and key collisions are possible.

Pseudocode:

log = open("file:///log.txt")
log_ctl = open_ctl(log)
mode = "mode=0600"
write(log_ctl, mode.ptr, mode.len)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants