GithubHelp home page GithubHelp logo

Comments (7)

carllerche avatar carllerche commented on July 22, 2024 2

The short answer is, Tower is decoupled from UDS or TCP.

You would implement Service for Redis, which is request / response based. Once you have that, you can take advantage of all the middleware provided here.

The easiest way to do that, as mentioned, would be tokio-tower. With tokio-tower, you provide a "transport" which is a type that implements Stream + Sink.

And the easiest way to get a transport, is to use a codec :)

(we really should have full stack docs for this).

  1. Start with UnixStream
  2. Implement your codec (Encoder + Decoder) for your redis protocol (https://docs.rs/tokio/0.1.13/tokio/codec/index.html).
  3. Call MyCodec.framed(my_stream) (https://docs.rs/tokio/0.1.13/tokio/codec/trait.Decoder.html#method.framed), you now have a transport.
  4. Pass your transport to tokio-tower (not released yet, but we will do that asap).

At that point, you have your Service handle for the redis protocol. Then, you can use all the middleware.

from tower.

carllerche avatar carllerche commented on July 22, 2024

What do you hope to do w/ Tower & unix domain sockets? Maybe with more info I could point you in the right direction.

from tower.

rohitjoshi avatar rohitjoshi commented on July 22, 2024

@callerche planning to implement Redis protocol interface which internally connects to remove DB.

I did implement using β€˜mio’ and wanted to leverage many towers modules like rate limit, reconnect, bufffer etc

from tower.

carllerche avatar carllerche commented on July 22, 2024

I think this might be a good case for tokio-tower (which is in progress). Thoughts @jonhoo

from tower.

jonhoo avatar jonhoo commented on July 22, 2024

As long as you have an AsyncRead and AsyncWrite (which Unix domain sockets are iirc), you should be able to turn that into Stream + Sink with a tokio::codec (or by writing your own if you're so inclined). Once you have that, you can indeed use tokio-tower to move from Stream + Sink to Service :)

@carllerche maybe we should publish tokio-tower 0.0.1 so that we get docs up on docs.rs?

from tower.

jonhoo avatar jonhoo commented on July 22, 2024

πŸ‘ for full stack docs! :D

from tower.

carllerche avatar carllerche commented on July 22, 2024

Tracking documentation with #33.

from tower.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.