Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
originated by Nathan Farrington http://nathanfarrington.com
RedisRpc is the easiest to use RPC library in the world. (No small claim!).
repackaged by Phuong Nguyen This repo only has Ruby implementations
Redis is a powerful in-memory data structure server that is useful
for building fast distributed systems. Redis implements message queue
functionality with its use of list data structures and the LPOP
, BLPOP
,
and RPUSH
commands. RedisRpc implements a lightweight RPC mechanism using
Redis message queues to temporarily hold RPC request and response
messages. These messages are encoded as JSON strings for portability.
Many other RPC mechanisms are either programming language specific (e.g. Java RMI) or require boiler-plate code for explicit typing (e.g. Thrift). RedisRpc was designed to be extremely easy to use by eliminating boiler-plate code while also being programming language neutral. High performance was not an initial goal of RedisRpc and other RPC libraries are likely to have better performance. Instead, RedisRpc has better programmer performance; it lets you get something working immediately.
Each library implementation uses the same client and server example based off of a mutable calculator object. The clients and servers from different languages are interoperable.
RPUSH
command to push
an RPC Request message into a Redis list called calc
.BLPOP
command.RPUSH
command to push
an RPC Response message into a Redis list called calc:rpc:<RAND_STRING>
,
which was chosen by the client.BLPOP
command.Note that the server or client can be made non-blocking by using the Redis LPOP command instead of BLPOP. I currently do not need this feature and have not added support for this, but patches are welcome.
That's all there is to it!
redis_server = Redis.new
message_queue = 'calc'
calculator = RedisRpc::Client.new redis_server, 'calc'
calculator.clr
calculator.add 5
calculator.sub 3
calculator.mul 4
calculator.div 2
assert calculator.val == 4
redis_server = Redis.new
message_queue = 'calc'
local_object = Calculator.new
server = RedisRpc::Server.new redis_server, message_queue, local_object
server.run
The redis-rb library is required. Install using RubyGems:
gem install redis-rpc
All RPC messages are JSON objects. User code will never see these objects because they are handled by the RedisRpc library.
An RPC Request contains two members: a function_call
object and
a response_queue
string.
A function_call
object has one required member: a name
string for the function
name. It also has two optional members: (a) an args
list for positional
function arguments, and (b) a kwargs
object for named function arguments.
The response_queue
string is the name of the Redis list where the
corresponding RPC Response message should be pushed by the server. This queue
is chosen programmatically by the client to be collision free in the Redis
namespace. Also, this queue is used only for a single RPC Response message
and is not reused for future RPC Response messages.
{ "function_call" : {
"args" : [ 1, 2, 3 ],
"kwargs" : { "a" : 4, "b" : 5, "c" : 6 },
"name" : "foo"
},
"response_queue" : "calc:rpc:X7Y2US"
}
If an RPC is successful, then the RPC Response object will contain a single
member, a return_value
of some JSON type.
{ "return_value" : 4.0 }
If an RPC encounters an exceptional condition, then the RPC Response object
will contain a single member, an exception
string. Note that the value of
the exception
string might not have any meaning to the client since the
client and server might be written in different languages or the client
might have no knowledge of the server's wrapped object. Therefore the best
course of action is probably to display the exception
value to the user.
{ "exception" : "AttributeError(\\"\'Calculator\' object has no attribute \'foo\'\\",)" }
Source code is available at http://github.com/phuongnd08/redis-rpc-ruby.
This software is available under the GPLv3 or later.
FAQs
Unknown package
We found that ia-redis-rpc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.