Coder Social home page Coder Social logo

BITOP example broken about redis-io HOT 7 CLOSED

redis avatar redis commented on July 26, 2024
BITOP example broken

from redis-io.

Comments (7)

catwell avatar catwell commented on July 26, 2024

Ping? This is still broken :)

from redis-io.

deltheil avatar deltheil commented on July 26, 2024

Same thing for INFO:

capture decran 2014-07-29 a 00 31 06

from redis-io.

mattsta avatar mattsta commented on July 26, 2024

Looks like INFO needs a custom handler. This fixes INFO on my local machine:

diff --git a/lib/interactive/namespace.rb b/lib/interactive/namespace.rb
index 05f4990..fd8ace7 100644
--- a/lib/interactive/namespace.rb
+++ b/lib/interactive/namespace.rb
@@ -36,6 +36,8 @@ module Interactive
       end
     when :custom
       case name.downcase
+      when "info"
+        out = args
       when "zunionstore", "zinterstore"
         # Destination key
         if args.size >= 1

from redis-io.

deltheil avatar deltheil commented on July 26, 2024

What's strange is that SCAN and COMMAND INFO have no custom handler either but... they just work.

from redis-io.

mattsta avatar mattsta commented on July 26, 2024

So, delving deeper into figuring out how all this works...

SCAN actually has no in-page console outputโ€”everything there is just pre-formatted output. But, the pre-formatted output looks like the live in-page console. It's misleading. So, there's no bad behavior with in-page SCAN.

Now, COMMAND INFO is special because the namespace.rb/pattern() parser is busted. It does args.shift which takes the first word of the entire in-page command string. So, the parser thinks the entire command COMMAND INFO get set eval is just COMMAND with arguments of ["INFO", "get", "set", "eval"].

So, technically, COMMAND INFO should be broken without a custom handler, but it still works.

Mystery 1 solved! We do need the custom case handler for INFO, but everything else is either working as designed or broken and still working as intended.

Mystery 2: Why doesn't BITOP work properly in the web console? BITOP was missing from the custom handler, and it uses three key positions that needed to be registered for namespacing. Console BITOP support can be enabled with:

diff --git a/lib/interactive/namespace.rb b/lib/interactive/namespace.rb
index 05f4990..b8dd8d3 100644
--- a/lib/interactive/namespace.rb
+++ b/lib/interactive/namespace.rb
@@ -36,6 +36,9 @@ module Interactive
       end
     when :custom
       case name.downcase
+      when "bitop"
+        # Argument positions 1,2,3 are all keys
+        out[1,3] = 3.times.map{:key}
       when "zunionstore", "zinterstore"
         # Destination key
         if args.size >= 1

Mystery 2 solved!

from redis-io.

deltheil avatar deltheil commented on July 26, 2024

๐Ÿ‘

from redis-io.

catwell avatar catwell commented on July 26, 2024

๐Ÿ‘

from redis-io.

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.