trinity.core

Functions for operating on Atomix clients, servers and replicas.

bootstrap

(bootstrap replica)(bootstrap replica nodes)

Bootstraps the replica.

nodes - The nodes to bootstrap the replica into. A seq of maps containing :host and :port values. If not given, the replica is bootstrapped as a single node cluster.

bootstrap-async!

(bootstrap-async! replica)(bootstrap-async! replica nodes)

Asynchronously bootstraps the replica.

nodes - The nodes to bootstrap the replica into. A seq of maps containing :host and :port values. If not given, the replica is bootstrapped as a single node cluster.

client

(client)(client config)

Returns an io.atomix.AtomixClient for the nodes and config.

  • config - A map containing:
    • :transport - The io.atomix.catalyst.transport.Transport instance for the client to use. Defaults to NettyTransport.

close!

(close! client)

Closes the client.

close-async!

(close-async! client)

Asynchronously closes the client.

connect!

(connect! client nodes)

Connects the client to a cluster.

  • client - The client to connect to the cluster.
  • nodes - A seq of maps containing :host and :port values.

disk-storage

(disk-storage)(disk-storage config)

Returns a io.atomix.copycat.server.storage.Storage instance for the config.

  • config (Optional) should be a map containing:
    • :path - The path to store logs in. Defaults to [user.dir]/logs/

get-map

(get-map atomix key)

Gets a distributed map for the atomix instance on the resource key.

get-map-async

(get-map-async atomix key)

Asynchronously gets a distributed map for the atomix instance on the resource key.

get-value

(get-value atomix key)

Gets a distributed value for the atomix instance on the resource key.

get-value-async

(get-value-async atomix key)

Asynchronously gets a distributed value for the atomix instance on the resource key.

join

(join replica nodes)

Joins the replica to an existing cluster.

  • replica The replica to join to a cluster
  • nodes - A seq of maps containing :host and :port values indicating the nodes to join.

join-async!

(join-async! replica nodes)

Asynchronously joins the replica to an existing cluster.

  • replica - The replica to join to a cluster
  • nodes - A seq of maps containing :host and :port values indicating the nodes to join.

mem-storage

(mem-storage)

replica

(replica port nodes)(replica port nodes config)

Returns an AtomixReplica for the port and config.

  • port - The localhost port for the replica to listen on.
  • config - A map containing:
    • :storage - The io.atomix.copycat.server.storage.Storage instance for the replica to use.
    • :transport - The io.atomix.catalyst.transport.Transport instance for the client to use. Defaults to NettyTransport.