class LavinMQ::Replication::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

Defined in:

lavinmq/replication/server.cr

Constant Summary

Log = ::Log.for("replication")

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def append(path : String, obj) #

[View source]
def bind(host, port) #

[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 handle_socket(socket) #

[View source]
def listen #

[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]