1.3 - DirectoryService

The DirectoryService is the core of the server. This is where we process incoming requests and ask the backend for data.

It has an entry point, the OperationManager, which is in charge of pushing the requests into the Interceptors chain, and to protect the server against concurrent modifications.

Then the request is going through every Interceptor being registered for this operation. When we have gone through all the Interceptors, we have reached the PartitionNexus, which is the connection with the backends.

We now just have to determinate which type of Backend we should address, and this is done using the Dn. The request is then transmitted to the Backend, which returns the result.

The result bubbles up through the Interceptors as we unfold the stack stack, up to the OperationManager and to the caller.

Environment

The DirectoryService knows about its execution environment : it has a schemaManager instance, it knows about the Interceptors chain, it stores a map of all the pending requests (it’s necessary as one may abandon some request), it holds the existing Sessions.

In other word, the DirectoryService is not only the part of the server executing the logic, it also holds the current state of every clients.

Initialization

Starting a DirectoryService will require to create the following parts:

  • The SchemaManager: it will create the directory on which the schema will be extracted, if it does not already exist. It will then load the schema in memory.
  • The Schema partition: it will create the in-memory LDIF partition containing a copy of the schema.
  • The Configuration partition: it will create a in-memory partition containing all the configuration (the configuration is LDAP-based). Once done, a in-memory representation of this configuration will be created to ease the initialization of the server.
  • The DnFactory: it will create the DN cache, which size is based on all the partitions cache size configuration.
  • A shutdown hook to stop the server
  • The various interceptors
  • All the user’s partitions
  • The System partition
  • The ChangeLog system
  • The partition Nexus (which manages to the underlaying storage)

Once this is done, we will be able to start the LdapServer.