XRPLF / clio

An XRP Ledger API Server
https://xrpl.org
ISC License
61 stars 52 forks source link

Plugin system for RPC commands #1167

Open intelliot opened 7 months ago

intelliot commented 7 months ago

A plugin system/ecosystem for commands would allow the community to extend the functionality of Clio, making it more flexible and adaptable for a wider range of use cases.

Originally posted by @sublimator in https://github.com/XRPLF/rippled/issues/2438#issuecomment-374069369

intelliot commented 7 months ago

Example of an RPC that may make sense as a plugin:

Light/reduced book_offers

by @professorhantzen

An optional "light" book_offers request.

The main reason clients request the book is to place trades against it, or to present it in an interface for a user to trade against. To do this, clients require only two numbers per offer: the quality, and the funded amount of taker_gets. In most cases the other material rippled supplies is of no use. The issuer and currency for each offer is redundant for example, as it doesn't change and is known prior to sending the request. A light request could reduce book_offers bandwidth by around 95% (~800bytes vs ~40bytes per offer).

sublimator commented 7 months ago

Wow, blast from the past :)

godexsoft commented 7 months ago

Curious to hear opinions on whether folks would prefer native (C++) plugins or some sort of extensions mechanism thru scripting (think Lua, Python, C#, etc.).

sublimator commented 7 months ago

separate plugin process?

godexsoft commented 7 months ago

separate plugin process?

Can you explain in more detail what you mean with this comment?

In my understanding, a plugin would be either some sort of shared library that Clio can load and execute or it can be some script that extends functionality of Clio by using APIs we provide.

I don't think a plugin needs to be able to do everything. I personally would prefer to expose a set of APIs for developers of plugins. I imagine some way to hook into the ETL process, read/write to DB and become an RPC handler (get called by Clio when the command/method matches).

sublimator commented 7 months ago

Well, similar to say chrome, or sublime text, where plugins run in a separate process, so the system is a bit more resilient when plugins crash. Before Sublime Text 3 the author was tired of the plugins undoing all his performance work, so he moved to that architecture.

A throwaway question to be honest, I don't have much stake in this. Was @ mentioned so came to see what's up.

But maybe worth considering at the outset.

godexsoft commented 3 months ago

@mvadari fyi 👍

mvadari commented 2 months ago

Note: plugins as described in XLS-42d does not currently support custom RPCs.

godexsoft commented 2 months ago

@mvadari good to know. Thankfully though Clio is not limited by any XLS - we could implement just about any plugin architecture. Tagged you because you are involved with rippled's plugin system and we always welcome you to help write stuff for Clio 👍

mvadari commented 2 months ago

@mvadari good to know. Thankfully though Clio is not limited by any XLS - we could implement just about any plugin architecture. Tagged you because you are involved with rippled's plugin system and we always welcome you to help write stuff for Clio 👍

I know, I was just noting that there's no existing API/format 🙂