Keyboard shortcuts

/ or ⌘/Ctrl K
Find a note
j / k
Next / previous section or linked note
h / l
Collapse or go to parent / expand or enter
e or Alt-click
Read a linked note here
o
Open focused note on its own
g g / G
First / last section or linked note
g h / g a
Home / all notes
g b / g t
Backlinks / table of contents
t
Cycle System, Light, Dark
? / Esc
Show / close this reference

Search: ↑/↓ or Ctrl N/P, Enter to open. Shortcuts pause while typing.

elixir driver for cassandra/scylla [d5b39161]

elixir, Cassandra

1. TokenAware LB Policy for Xandra and Shard Awareness

1.1. Python Examples

1.2. Java Reference

1.3. Elixir NIF

  • github.com/lpgauth/murmur
  • Possibly something like this? -

      defmodule ShardCalculator do
        @min_token -1 <<< 63
        @token_max 1 <<< 64
    
        def calculate_shard(token, ignore_msb, nr_shards) do
          # Bias the token
          biased_token = token - @min_token
    
          # Left shift by ignore_msb bits
          biased_token = biased_token <<< ignore_msb
    
          # Multiply by number of shards and perform truncating division
          shard = div(biased_token * nr_shards, @token_max)
          shard
        end
      end
    
      defmodule ShardCalculator do
        @min_token -1 <<< 63
        @token_max 1 <<< 64
    
        def calculate_shard(token, ignore_msb, nr_shards) do
          token = token - @min_token
          token = token <<< ignore_msb
    
          tok_lo = token &&& 0xFFFFFFFF
          tok_hi = token >>> 32
    
          mul1 = tok_lo * nr_shards
          mul2 = tok_hi * nr_shards
    
          sum = (mul1 >>> 32) + mul2
          sum >>> 32
        end
      end
    

1.4. Existing Xandra

1.5. Worklist