class LavinMQ::Clustering::Server
- LavinMQ::Clustering::Server
- Reference
- Object
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.crConstant Summary
-
Log =
LavinMQ::Log.for("clustering.server")
Constructors
Instance Method Summary
- #append(path : String, file : MFile, position : Int32, length : Int32)
- #append(path : String, obj)
- #clear
- #close
- #delete_file(path : String)
- #files_with_hash(& : Tuple(String, Bytes) -> Nil)
- #followers : Array(Follower)
- #listen(server : TCPServer)
- #password : String
- #register_file(file : File)
- #register_file(mfile : MFile)
- #replace_file(path : String)
- #with_file(filename, & : MFile | File | Nil -> Nil) : Nil
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))
#