Circuit Self-managed infrastructure, programmatic monitoring and orchestration

Example: Create a channel

Again, take a look at what servers are available:

	circuit ls /...
	/X88550014d4c82e4d
	/X938fe923bcdef2390

Pick one. Say X88550014d4c82e4d. Now, let's create a channel on X88550014d4c82e4d:

	circuit mkchan /X88550014d4c82e4d/this/is/charlie 3

The last argument of this line is the channel buffer capacity, analogously to the way channels are created in Go.

Channel elements reside in the memory of a circuit server.

Verify the channel was created:

	circuit peek /X88550014d4c82e4d/this/is/charlie

This should print out something like this:

	{
			"Cap": 3,
			"Closed": false,
			"Aborted": false,
			"NumSend": 0,
			"NumRecv": 0
	}

Sending a message to the channel is accomplished with the command

	circuit send /X88550014d4c82e4d/this/is/charlie < some_file

The contents of the message is read out from the standard input of the command above. This command will block until a receiver is available, unless there is free space in the channel buffer for a message.

When the command unblocks, it will send any data to the receiver. If there is no receiver, but there is a space in the message buffer, the command will also unblock and consume its standard input (saving it for an eventual receiver) but only up to 32K bytes.

Receiving is accomplished with the command

	circuit recv /X88550014d4c82e4d/this/is/charlie

The received message will be produced on the standard output of the command above.