Class UUID::Server
In: lib/uuid.rb
Parent: Object

With UUID server you don‘t have to worry about multiple processes synchronizing over the state file, calling next_sequence when forking a process and other things you‘re probably not worried about (because statistically they‘re very unlikely to break your code).

But if you are worried about and thought to yourself, "what would a simple UUID server look like?", here‘s the answer. The protocol is dead simple: client sends a byte, server responds with a UUID. Can use TCP or domain sockets.

Methods

bind   listen   new  

Public Class methods

Create new server. Nothing interesting happens until you call listen.

Public Instance methods

Returns UNIXServer or TCPServer from address. Returns argument if not a string, so can pass through (see listen).

Start the server listening on the specific address. Blocks and never returns. Address can be:

  • A Socket object
  • UNIX domain socket name (e.g. /var/run/uuid.sock, must start with /)
  • IP address, colon, port (e.g. localhost:1337)

[Validate]