Skip to content
This repository was archived by the owner on Mar 9, 2019. It is now read-only.

Higher level client/server API #4

Closed
wez opened this issue Jul 22, 2013 · 0 comments
Closed

Higher level client/server API #4

wez opened this issue Jul 22, 2013 · 0 comments

Comments

@wez
Copy link
Contributor

wez commented Jul 22, 2013

Convenient functions that allow configuring a client or server socket to:

  • Buffer send chunks by block and/or line (queue up the writes, they happen async, reads can continue independently unless you request that the write buffer be sync'd up to a certain point)
  • Initiate a read of a fixed buffer size. Trigger a callback when the complete read is satisfied or if an error occurred. Set a time constraint on the read.
  • Initiate a read of a variable size record and specified terminator. For example, CRLF and LF are two common terminators. Trigger a callback when a complete record is read or if an error occurred. Set a time constraint on the read.

It is desirable for these read functions to return slices over the underlying buffers to reduce copying.

For clients, add an API that allows a new client to be created:

  • Specify the target sockaddr to which we want to connect
  • If the target is specified textually, handle name resolution using the job API to run eg: getaddrinfo in a thread pool
  • client connection happens async; trigger a callback when it completes or fails, or fails to complete with a desired timeout. Provide simple access to the underlying failure reason.

The callbacks mentioned here should be able to be dispatched in a thread pool (or the active scheduler thread) as configured by code for that particular client/server/callback.

@wez wez closed this as completed Sep 13, 2013
@maczpc maczpc mentioned this issue Nov 27, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant