class LavinMQ::Clustering::Server

Overview

When a follower connects: It sends a static header (wrong header disconnects the client) It sends its password (servers closes the connection if the password is wrong) Server sends a list of files in its data directory and the sha1 hash of those files Client requests files that is missing or has mismatching checksums of In the meantime the server queues up changes (all publishes/consumes are paused) When client doesn't request more files starts to stream changes Server sends "appends", which include the file path and the bytes to be appended It also sends which files should be deleted or has been rewritten (such as json files) The follower sends back/acknowledges how many bytes it has received

Included Modules

Defined in:

lavinmq/clustering/server.cr

Constant Summary

Log = LavinMQ::Log.for("clustering.server")

Constructors

Instance Method Summary

Instance methods inherited from module LavinMQ::Clustering::Replicator

append(path : String, file : MFile, position : Int32, length : Int32)
append(path : String, obj)
append
, clear clear, close close, delete_file(path : String) delete_file, followers : Array(Follower) followers, listen(server : TCPServer) listen, password : String password, register_file(file : File)
register_file(mfile : MFile)
register_file
, replace_file(path : String) replace_file

Instance methods inherited from module LavinMQ::Clustering::FileIndex

files_with_hash(& : Tuple(String, Bytes) -> Nil) files_with_hash, with_file(filename : String, & : MFile | File | Nil -> Nil) : Nil with_file

Constructor Detail

def self.new(config : Config, etcd : Etcd, id : Int32 = (File.read(File.join(config.data_dir, ".clustering_id"))).to_i(36)) #

[View source]

Instance Method Detail

def append(path : String, file : MFile, position : Int32, length : Int32) #

[View source]
def append(path : String, obj) #

[View source]
def clear #

[View source]
def close #

[View source]
def delete_file(path : String) #

[View source]
def files_with_hash(& : Tuple(String, Bytes) -> Nil) #

[View source]
def followers : Array(Follower) #

[View source]
def listen(server : TCPServer) #

[View source]
def password : String #

[View source]
def register_file(file : File) #

[View source]
def register_file(mfile : MFile) #

[View source]
def replace_file(path : String) #

[View source]
def with_file(filename, & : MFile | File | Nil -> Nil) : Nil #

[View source]