kernel.shell.server

Server site control.

Generates and receives messages at the server site. Modifies the global context. Site control operations are assumed to run atomically in a single thread, no synchronization is performed.

forward-message!

(forward-message! message)

Receives, processes and forwards a message from a client site to all other client sites. If a site has left in the meantime, removes its vector clock coordinate from forwarded messages (as other sites have already been notified about the leaving site). Returns the message that is to be forwarded.

GC!

Runs the garbage collector at the server site. Updates the global context.

GC-filter

(GC-filter server-VC)

Removes the server coordinate from a vector clock. This is required so that no client site unnecessarily takes into account the server coordinate.

generate-heartbeat!

(generate-heartbeat!)

Generates a heartbeat message at the server site. Only required to improve the performance of garbage collection. Only sent explicitly if no messages have been forwarded for a while.

initialize-context-star-topology

(initialize-context-star-topology initial-FM)

Initializes global context for the server site in a star topology. Called when first client site connects and requests to edit a given feature model.

The server receives all operations eventually. The server’s vector clock is the maximum of all its received operation’s vector clocks (save for its own vector clock coordinate).

initialize-context-star-topology!

(initialize-context-star-topology! initial-FM)

Initializes global context for the server site in a star topology. Resets the global context.

resolve-conflict!

(resolve-conflict! MCG-ID)

Resolves a conflict to a given version. Returns the (updated) combined effect.

site-joined!

(site-joined! site-ID)

Processes a newly joined site. Prepares an initial context for the new site. Updates the server’s global context to include the new site. Generates an initial heartbeat message for the new site that is to be forwarded to other sites (effectively simulating that the first message received by the site is this very heartbeat). Returns the new site’s initial context and the generated heartbeat message.

site-left!

(site-left! site-ID)

Processes a leaving site. Generates a leave message for the new site that is to be forwarded to other sites (effectively simulating that the last message received by the site is this leave message). Adds the site to the list of offline sites so that forwarded messages can be pruned of this site’s coordinate. TODO: Garbage collect the list of offline sites after every user has seen the leave (e.g., attach this to a heartbeat that everyone has to succeed).