Module Nanite::FileStreaming
In: lib/nanite/streaming.rb

Nanite actors can transfer files to each other.

Options

filename : you guessed it, name of the file! domain : part of the routing key used to locate receiver(s) destination : is a name of the file as it gonna be stored at the destination meta :

File streaming is done in chunks. When file streaming starts, Nanite::FileStart packet is sent, followed by one or more (usually more ;)) Nanite::FileChunk packets each 16384 (16K) in size. Once file streaming is done, Nanite::FileEnd packet is sent.

16K is a packet size because on certain UNIX-like operating systems, you cannot read/write more than that in one operation via socket.

Domains

Streaming happens using a topic exchange called ‘file broadcast’, with keys formatted as "nanite.filepeer.DOMAIN". Domain variable in the key lets senders and receivers find each other in the cluster. Default domain is ‘global’.

Domains also serve as a way to register a callback Nanite agent executes once file streaming is completed. If a callback with name of domain is registered, it is called.

Callbacks are registered by passing a block to subscribe_to_files method.

Methods

Classes and Modules

Class Nanite::FileStreaming::FileState

Public Instance methods

[Validate]