Please take a look at the text file I attached to this message. I think Mitosis is far from perfection and needs a lot of test. Any questions and feed back are welcome.
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6
Package breakdown ================= mitosis.common -------------- This package contains common classes used by all components of Mitosis.
* CSN - Change Sequence Number is a sequence number that is given to each
individual LDAP Entry. Any changes made to an entry increase its CSN.
* CSNFactory - CSN factory generates a new CSN with the specified replica ID.
* CSNVector - A set of CSNs with different replica IDs. This data structure is
useful to find out the latest (or oldest) CSN of a replica.
Each replica will have a different CSN vector from each other,
and thus we can decide which replica has more recent changes by
comparing each other's latest CSN vector, and which replica is
out of sync by comparing each other's oldest CSN vector.
* ReplicaId - A identifier of Replica
* Replica - A logical representation of Mitosis replica, which consists of
a ReplicaId and InetSocketAddress (the remote endpoint address)
* UUID - A Universally Unique IDentifier is assigned to each LDAP entry to
identify an entry from the other entry.
mitosis.configuration
---------------------
This package contains classes required to configure Mitosis.
* ReplicaConfiguration - The main configuration class.
* *PropertyEditor - JavaBeans PropertyEditors which is used to help the
configuration with Spring framework.
mitosis.operation
-----------------
This package is the heart of DIT modification. All ApacheDS operations are
defined here extending Operation class and implementing the actual DIT
operations. For example, delete operation is translated into modify operation.
Operation.execute() will perform the actual operation.
mitosis.store
-------------
This package provides the log storage interface and its default implementation
based on Derby.
* ReplicationStore - Provides access to the log store.
* ReplicationLogIterator - An iterator that iterates over the operation logs
in the target ReplicationStore.
mitosis.util
------------
This package contains miscellaneous utility classes used by all over Mitosis.
For now, we have only one class; OctetString.
mitosis.service
---------------
This package contains the most important part of Mitosis. It provides an
ApacheDS interceptor which plugs into ApacheDS core.
* ReplicationService - An ApacheDS Intercaptor that intercepts all LDAP
operations and translates them into the multiple LDAP
operations which is robust against unexpected changes
from multiple peer replicas, using the mitosis.operation
package. It also initiates communication module and
periodical log purger.
* ReplicationLogCleaner - Cleans up too old modification logs stored in
mitosis.store.
* ClientConnectionManager - Manages the Mitosis connection to the remote peer,
and reconnects broken connections.
* ReplicationContext - A context that stores state information for the
Mitosis protocol implementation.
mitosis.service.protocol
------------------------
This package implements Mitosis multi-master replication protocol.
* message - This package contains message classes used by codec and handler.
* codec - This package contains the MINA protocol codec implementation.
* handler - This package contains the MINA protocl handler implementation.
The implementation provides ReplicationContextHandler which is
called by the default IoHandler implementations to provide an
easy way to pass ReplicationContext object.
Dependency
==========
Service
|
|
+----------+---------+
| | |
V V V
Store <-- Operation Protocol
^ |
| |
+--------------------+
The arrow means 'dependency'
Protocol Flow
=============
It is always a client that pushes change logs to a server. Only one client can
send logs to the same server at the same time.
1. [CS] Login
2. [SC] LoginAck (contains the latest and oldest CSN vector of the server)
3. (If there's something to send) [CS] BeginLogEntries
4. (If the server is not receiving logs from other client) [SC]
BeginLogEntriesAck
5. [CS] Multiple LogEntries
6. [SC] Multiple LogEntryAcks
7. [CS] EndLogEntries
8. [SC] EndLogEntriesAck
9. Repeat from (1)
