View Source Bolt.Sips.Routing.RoutingTable (Boltx v0.0.1)

representing the routing table elements

There are a couple of ways to get the routing table from the server, for recent Neo4j servers, and with the latest version of Bolt.Sips, you could use this query:

Bolt.Sips.query!(Bolt.Sips.conn, "call dbms.cluster.routing.getRoutingTable($props)", %{props: %{}})

[
  %{
    "servers" => [
      %{"addresses" => ["localhost:7687"], "role" => "WRITE"},
      %{"addresses" => ["localhost:7689", "localhost:7688"], "role" => "READ"},
      %{
        "addresses" => ["localhost:7688", "localhost:7689", "localhost:7687"],
        "role" => "ROUTE"
      }
    ],
    "ttl" => 300
  }
]

Summary

Types

@type t() :: %Bolt.Sips.Routing.RoutingTable{
  roles: %{
    required(:read | :write | :route | :direct) => %{
      required(String.t()) => non_neg_integer()
    }
  },
  ttl: non_neg_integer(),
  updated_at: non_neg_integer()
}

Functions

@spec parse(map()) :: t() | {:error, String.t()}