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

Implement caching for transport #113

Closed
mschuwalow opened this issue Nov 26, 2019 · 2 comments
Closed

Implement caching for transport #113

mschuwalow opened this issue Nov 26, 2019 · 2 comments
Milestone

Comments

@mschuwalow
Copy link
Member

Transport should keep connection open for a certain time when sending and reuse them if sending to the same node again. One way of implementing this is to have a Ref[Map[Address, Channel]] that is created on construction of the transport and periodically garbage collected.

@pshemass
Copy link
Contributor

This sound like connection pool. IMHO this should not be part of transport. Transport should be an trait with method send

trait Transport {
  def send(data: Chunk[Byte]): ZIO[R, TransportError, Unit]
  // We could add method to check health 
}

class tcp(socket: ZManaged[AsynchronousSocketChannel]) {
  def send(data: Chunk[Byte]): ZIO[R, TransportError, Unit] = ???
}
object tcp {
 def apply(to: SocketAddress, 
    maxConnections: Int,
    connectionTimeout: Duration,
    sendTimeout: Duration): ZIO[Any, TransportError, Transport] = ???

or maybe transport is just factory that return connection which would have the same interface as Transport above. What do you think @mschuwalow ?

@mijicd mijicd added this to the 0.1.0 milestone Dec 13, 2019
@mijicd
Copy link
Member

mijicd commented Dec 13, 2019

Closing it as it doesn't belong at this level.

@mijicd mijicd closed this as completed Dec 13, 2019
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

3 participants