public class MemoryChangeLogStore extends Object implements TaggableChangeLogStore
Constructor and Description |
---|
MemoryChangeLogStore() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Save logs, tags and revision on disk, and clean everything in memory
|
org.apache.directory.api.ldap.model.cursor.Cursor<ChangeLogEvent> |
find()
Gets a Cursor over all the ChangeLogEvents within the system since
revision 0.
|
org.apache.directory.api.ldap.model.cursor.Cursor<ChangeLogEvent> |
find(long startRevision,
long endRevision)
Finds the ChangeLogEvents that occurred between a revision range inclusive.
|
org.apache.directory.api.ldap.model.cursor.Cursor<ChangeLogEvent> |
findAfter(long revision)
Finds the ChangeLogEvents that occurred after a revision exclusive.
|
org.apache.directory.api.ldap.model.cursor.Cursor<ChangeLogEvent> |
findBefore(long revision)
Gets a Cursor over the ChangeLogEvents that occurred before a revision
exclusive.
|
long |
getCurrentRevision()
Gets the current revision of the server (a.k.a.
|
Tag |
getLatest()
Gets the latest tag if one was at all taken.
|
void |
init(DirectoryService service)
Initialize the store.
|
ChangeLogEvent |
log(LdapPrincipal principal,
org.apache.directory.api.ldap.model.ldif.LdifEntry forward,
org.apache.directory.api.ldap.model.ldif.LdifEntry reverse)
Records a change as a forward LDIF, a reverse change to revert the change and
the authorized principal triggering the revertable change event.
|
ChangeLogEvent |
log(LdapPrincipal principal,
org.apache.directory.api.ldap.model.ldif.LdifEntry forward,
List<org.apache.directory.api.ldap.model.ldif.LdifEntry> reverses)
Records a change as a forward LDIF, some reverse changes to revert the change and
the authorized principal triggering the revertable change event.
|
ChangeLogEvent |
lookup(long revision)
Looks up the ChangeLogEvent for a revision.
|
Tag |
removeTag(long revision)
Removes a Tag created for a given revision.
|
void |
sync()
Write the changes on disk
|
Tag |
tag()
Creates a snapshot of the server at the current revision.
|
Tag |
tag(long revision)
Creates a tag for a snapshot of the server in a specific state at a revision.
|
Tag |
tag(long revision,
String descrition)
Creates a tag with the given description for a snapshot of the server
in a specific state at a revision.
|
Tag |
tag(String description)
Creates a snapshot of the server at the current revision with a description
of the snapshot tag.
|
String |
toString() |
public Tag tag(long revision) throws Exception
tag
in interface TaggableChangeLogStore
revision
- the revision to tag the snapshotException
- if there is a problem taking a tag, or if
the revision does not existpublic Tag tag() throws Exception
tag
in interface TaggableChangeLogStore
Exception
- if there is a problem taking a tagpublic Tag tag(String description) throws Exception
TaggableChangeLogStore
tag
in interface TaggableChangeLogStore
description
- a description of the state associate with the tagException
- if there is a problem taking a tagpublic void init(DirectoryService service) throws Exception
ChangeLogStore
init
in interface ChangeLogStore
service
- The associated DirectoryServiceException
- If the initialization failedpublic void sync() throws Exception
ChangeLogStore
sync
in interface ChangeLogStore
Exception
- If the write failedpublic void destroy() throws Exception
destroy
in interface ChangeLogStore
Exception
- If we can't destroy the logspublic long getCurrentRevision()
ChangeLogStore
getCurrentRevision
in interface ChangeLogStore
public ChangeLogEvent log(LdapPrincipal principal, org.apache.directory.api.ldap.model.ldif.LdifEntry forward, org.apache.directory.api.ldap.model.ldif.LdifEntry reverse) throws Exception
log
in interface ChangeLogStore
principal
- the authorized LDAP principal triggering the changeforward
- LDIF of the change going to the next statereverse
- LDIF (anti-operation): the change required to revert this changeException
- if there are problems logging the changepublic ChangeLogEvent log(LdapPrincipal principal, org.apache.directory.api.ldap.model.ldif.LdifEntry forward, List<org.apache.directory.api.ldap.model.ldif.LdifEntry> reverses) throws Exception
log
in interface ChangeLogStore
principal
- the authorized LDAP principal triggering the changeforward
- LDIF of the change going to the next statereverses
- LDIF (anti-operation): the changes required to revert this changeException
- if there are problems logging the changepublic ChangeLogEvent lookup(long revision) throws Exception
ChangeLogStore
lookup
in interface ChangeLogStore
revision
- to get a ChangeLogEvent forException
- if there are failures accessing the storeIllegalArgumentException
- if the revision is out of range (less than 0
and greater than the current revision)public org.apache.directory.api.ldap.model.cursor.Cursor<ChangeLogEvent> find() throws Exception
ChangeLogStore
find
in interface ChangeLogStore
Exception
- if there are failures accessing the storepublic org.apache.directory.api.ldap.model.cursor.Cursor<ChangeLogEvent> findBefore(long revision) throws Exception
ChangeLogStore
findBefore
in interface ChangeLogStore
revision
- the revision number to get the ChangeLogEvents beforeException
- if there are failures accessing the storeIllegalArgumentException
- if the revision is out of range (less than 0
and greater than the current revision)public org.apache.directory.api.ldap.model.cursor.Cursor<ChangeLogEvent> findAfter(long revision) throws org.apache.directory.api.ldap.model.exception.LdapException
ChangeLogStore
findAfter
in interface ChangeLogStore
revision
- the revision number to get the ChangeLogEvents afterorg.apache.directory.api.ldap.model.exception.LdapException
public org.apache.directory.api.ldap.model.cursor.Cursor<ChangeLogEvent> find(long startRevision, long endRevision) throws Exception
ChangeLogStore
find
in interface ChangeLogStore
startRevision
- the revision number to start getting the ChangeLogEvents aboveendRevision
- the revision number to start getting the ChangeLogEvents belowException
- if there are failures accessing the storeIllegalArgumentException
- if the start and end revisions are out of range
(less than 0 and greater than the current revision), or if startRevision > endRevisionpublic Tag getLatest() throws org.apache.directory.api.ldap.model.exception.LdapException
TaggableChangeLogStore
getLatest
in interface TaggableChangeLogStore
org.apache.directory.api.ldap.model.exception.LdapException
public Tag removeTag(long revision) throws Exception
TaggableChangeLogStore
removeTag
in interface TaggableChangeLogStore
revision
- the revision number that was taggedException
- on failures to access the tag storeTaggableChangeLogStore.removeTag(long)
public Tag tag(long revision, String descrition) throws Exception
TaggableChangeLogStore
tag
in interface TaggableChangeLogStore
revision
- the revision number that was taggeddescrition
- a description of the state associate with the tagException
- on failures to access the tag storeTaggableChangeLogStore.tag(long, String)
public String toString()
toString
in class Object
Object.toString()
Copyright © 2018. All rights reserved.