org.garret.perst
Interface Storage

All Known Subinterfaces:
ReplicationMasterStorage, ReplicationSlaveStorage

public interface Storage

Object storage


Field Summary
static int COOPERATIVE_TRANSACTION
          Cooperative mode; all threads share the same transaction.
static int DEFAULT_PAGE_POOL_SIZE
          Constant specifying default pool size
static int EXCLUSIVE_TRANSACTION
          Exclusive per-thread transaction: each thread access database in exclusive mode
static int INFINITE_PAGE_POOL
          Constant specifying that page pool should be dynamically extended to conatins all database file pages
static int REPLICATION_SLAVE_TRANSACTION
          Read only transaction which can be started at replicastion slave node.
static int SERIALIZABLE_TRANSACTION
          Serializable per-thread transaction.
 
Method Summary
 void backup(java.io.OutputStream out)
          Backup current state of database
 void beginThreadTransaction(int mode)
          Begin per-thread transaction.
 void close()
          Commit transaction (if needed) and close the storage
 void commit()
          Commit changes done by the last transaction.
 BitIndex createBitIndex()
          Create new bit index.
 Blob createBlob()
          Create new BLOB.
 FieldIndex createFieldIndex(java.lang.Class type, java.lang.String[] fieldNames, boolean unique)
          Create new mutlifield index
 FieldIndex createFieldIndex(java.lang.Class type, java.lang.String fieldName, boolean unique)
          Create new field index
 Index createIndex(java.lang.Class[] types, boolean unique)
          Create new compound index
 Index createIndex(java.lang.Class type, boolean unique)
          Create new index
 Link createLink()
          Create one-to-many link.
 Link createLink(int initialSize)
          Create one-to-many link with specified initially allocated size.
 PatriciaTrie createPatriciaTrie()
          Create PATRICIA trie (Practical Algorithm To Retrieve Information Coded In Alphanumeric) Tries are a kind of tree where each node holds a common part of one or more keys.
 Query createQuery()
          Create JSQL query.
 Relation createRelation(IPersistent owner)
          Create relation object.
 IPersistentSet createScalableSet()
          Create new scalable set references to persistent objects.
 IPersistentSet createScalableSet(int initialSize)
          Create new scalable set references to persistent objects.
 IPersistentSet createSet()
          Create new peristent set
 SortedCollection createSortedCollection(boolean unique)
          Create new sorted collection.
 SortedCollection createSortedCollection(PersistentComparator comparator, boolean unique)
          Create new sorted collection with specified comparator
 SpatialIndex createSpatialIndex()
          Create new spatial index with integer coordinates
 SpatialIndexR2 createSpatialIndexR2()
          Create new R2 spatial index
 Index createThickIndex(java.lang.Class type)
          Create new thick index (index with large number of duplicated keys)
 TimeSeries createTimeSeries(java.lang.Class blockClass, long maxBlockTimeInterval)
          Create new time series object.
 void deallocateObject(IPersistent obj)
           
 void endThreadTransaction()
          End per-thread transaction started by beginThreadTransaction method.
 void endThreadTransaction(int maxDelay)
          End per-thread cooperative transaction with specified maximal delay of transaction commit.
 void exportXML(java.io.Writer writer)
          Export database in XML format
 int gc()
          Explicit start of garbage collector
 java.lang.ClassLoader getClassLoader()
          Get class loader used to locate classes for loaded class descriptors.
 long getDatabaseSize()
          Get size of the database
 java.util.HashMap getMemoryDump()
          Get database memory dump.
 IPersistent getObjectByOID(int oid)
          Retrieve object by OID.
 java.util.Properties getProperties()
          Get all set properties
 java.lang.Object getProperty(java.lang.String name)
          Get property value.
 IPersistent getRoot()
          Get storage root.
 long getUsedSize()
          Get total size of all allocated objects in the database
 void importXML(java.io.Reader reader)
          Import data from XML file
 boolean isOpened()
          Check if database is opened
 java.util.Iterator join(java.util.Iterator[] selections)
          Join results of several index searches.
 void loadObject(IPersistent obj)
           
 void lockObject(IPersistent obj)
           
 int makePersistent(IPersistent obj)
          Explicitely make object peristent.
 java.util.Iterator merge(java.util.Iterator[] selections)
          Merge results of several index searches.
 void modifyObject(IPersistent obj)
           
 void open(IFile file)
          Open the storage with default page pool size
 void open(IFile file, int pagePoolSize)
          Open the storage
 void open(java.lang.String filePath)
          Open the storage with default page pool size
 void open(java.lang.String filePath, int pagePoolSize)
          Open the storage
 void open(java.lang.String filePath, int pagePoolSize, java.lang.String cipherKey)
          Open the encrypted storage
 void rollback()
          Rollback changes made by the last transaction
 void rollbackThreadTransaction()
          Rollback per-thread transaction.
 java.lang.ClassLoader setClassLoader(java.lang.ClassLoader loader)
          Set class loader.
 void setGcThreshold(long allocatedDelta)
          Set threshold for initiation of garbage collection.
 StorageListener setListener(StorageListener listener)
          Set storage listener.
 void setProperties(java.util.Properties props)
          Set database properties.
 void setProperty(java.lang.String name, java.lang.Object value)
          Set database property.
 void setRoot(IPersistent root)
          Set new storage root object.
 void storeFinalizedObject(IPersistent obj)
           
 void storeObject(IPersistent obj)
           
 void throwObject(IPersistent obj)
           
 

Field Detail

COOPERATIVE_TRANSACTION

public static final int COOPERATIVE_TRANSACTION
Cooperative mode; all threads share the same transaction. Commit will commit changes made by all threads. To make this schema work correctly, it is necessary to ensure (using locking) that no thread is performing update of the database while another one tries to perform commit. Also please notice that rollback will undo the work of all threads.

See Also:
Constant Field Values

DEFAULT_PAGE_POOL_SIZE

public static final int DEFAULT_PAGE_POOL_SIZE
Constant specifying default pool size

See Also:
Constant Field Values

EXCLUSIVE_TRANSACTION

public static final int EXCLUSIVE_TRANSACTION
Exclusive per-thread transaction: each thread access database in exclusive mode

See Also:
Constant Field Values

INFINITE_PAGE_POOL

public static final int INFINITE_PAGE_POOL
Constant specifying that page pool should be dynamically extended to conatins all database file pages

See Also:
Constant Field Values

REPLICATION_SLAVE_TRANSACTION

public static final int REPLICATION_SLAVE_TRANSACTION
Read only transaction which can be started at replicastion slave node. It runs concurrently with receiving updates from master node.

See Also:
Constant Field Values

SERIALIZABLE_TRANSACTION

public static final int SERIALIZABLE_TRANSACTION
Serializable per-thread transaction. Unlike exclusive mode, threads can concurrently access database, but effect will be the same as them work exclusively. To provide such behavior, programmer should lock all access objects (or use hierarchical locking). When object is updated, exclusive lock should be set, otherwise shared lock is enough. Lock should be preserved until the end of transaction.

See Also:
Constant Field Values
Method Detail

backup

public void backup(java.io.OutputStream out)
            throws java.io.IOException
Backup current state of database

Parameters:
out - output stream to which backup is done
Throws:
java.io.IOException

beginThreadTransaction

public void beginThreadTransaction(int mode)
Begin per-thread transaction. Three types of per-thread transactions are supported: exclusive, cooperative and serializable. In case of exclusive transaction, only one thread can update the database. In cooperative mode, multiple transaction can work concurrently and commit() method will be invoked only when transactions of all threads are terminated. Serializable transactions can also work concurrently. But unlike cooperative transaction, the threads are isolated from each other. Each thread has its own associated set of modified objects and committing the transaction will cause saving only of these objects to the database. To synchronize access to the objects in case of serializable transaction programmer should use lock methods of IResource interface. Shared lock should be set before read access to any object, and exclusive lock - before write access. Locks will be automatically released when transaction is committed (so programmer should not explicitly invoke unlock method) In this case it is guaranteed that transactions are serializable.
It is not possible to use IPersistent.store() method in serializable transactions. That is why it is also not possible to use Index and FieldIndex containers (since them are based on B-Tree and B-Tree directly access database pages and use store() method to assign OID to inserted object. You should use SortedCollection based on T-Tree instead or alternative B-Tree implemenataion (set "perst.alternative.btree" property).

Parameters:
mode - EXCLUSIVE_TRANSACTION, COOPERATIVE_TRANSACTION, SERIALIZABLE_TRANSACTION or REPLICATION_SLAVE_TRANSACTION

close

public void close()
Commit transaction (if needed) and close the storage


commit

public void commit()
Commit changes done by the last transaction. Transaction is started implcitlely with forst update opertation.


createBitIndex

public BitIndex createBitIndex()
Create new bit index. Bit index is used to select object with specified set of (boolean) properties.

Returns:
persistent object implementing bit index

createBlob

public Blob createBlob()
Create new BLOB. Create object for storing large binary data.

Returns:
empty BLOB

createFieldIndex

public FieldIndex createFieldIndex(java.lang.Class type,
                                   java.lang.String[] fieldNames,
                                   boolean unique)
Create new mutlifield index

Parameters:
type - objects of which type (or derived from which type) will be included in the index
fieldNames - names of the index fields. Fields with such name should be present in specified class type
unique - whether index is unique (duplicate value of keys are not allowed)
Returns:
persistent object implementing field index
Throws:
StorageError(StorageError.INDEXED_FIELD_NOT_FOUND) - if there is no such field in specified class,
StorageError(StorageError.UNSUPPORTED_INDEX_TYPE) exception if type of specified field is not supported by implementation

createFieldIndex

public FieldIndex createFieldIndex(java.lang.Class type,
                                   java.lang.String fieldName,
                                   boolean unique)
Create new field index

Parameters:
type - objects of which type (or derived from which type) will be included in the index
fieldName - name of the index field. Field with such name should be present in specified class type
unique - whether index is unique (duplicate value of keys are not allowed)
Returns:
persistent object implementing field index
Throws:
StorageError(StorageError.INDEXED_FIELD_NOT_FOUND) - if there is no such field in specified class,
StorageError(StorageError.UNSUPPORTED_INDEX_TYPE) exception if type of specified field is not supported by implementation

createIndex

public Index createIndex(java.lang.Class[] types,
                         boolean unique)
Create new compound index

Parameters:
types - types of the index compound key components
unique - whether index is unique (duplicate value of keys are not allowed)
Returns:
persistent object implementing compound index
Throws:
StorageError(StorageError.UNSUPPORTED_INDEX_TYPE) - exception if specified key type is not supported by implementation.

createIndex

public Index createIndex(java.lang.Class type,
                         boolean unique)
Create new index

Parameters:
type - type of the index key (you should path here String.class, int.class, ...)
unique - whether index is unique (duplicate value of keys are not allowed)
Returns:
persistent object implementing index
Throws:
StorageError(StorageError.UNSUPPORTED_INDEX_TYPE) - exception if specified key type is not supported by implementation.

createLink

public Link createLink()
Create one-to-many link.

Returns:
new empty link, new members can be added to the link later.

createLink

public Link createLink(int initialSize)
Create one-to-many link with specified initially allocated size.

Parameters:
initialSize - initial size of array
Returns:
new empty link, new members can be added to the link later.

createPatriciaTrie

public PatriciaTrie createPatriciaTrie()
Create PATRICIA trie (Practical Algorithm To Retrieve Information Coded In Alphanumeric) Tries are a kind of tree where each node holds a common part of one or more keys. PATRICIA trie is one of the many existing variants of the trie, which adds path compression by grouping common sequences of nodes together.
This structure provides a very efficient way of storing values while maintaining the lookup time for a key in O(N) in the worst case, where N is the length of the longest key. This structure has it's main use in IP routing software, but can provide an interesting alternative to other structures such as hashtables when memory space is of concern.

Returns:
created PATRICIA trie

createQuery

public Query createQuery()
Create JSQL query. JSQL is object oriented subset of SQL allowing to specify arbitrary prdicates for selecting members of Perst collections

Returns:
created query object

createRelation

public Relation createRelation(IPersistent owner)
Create relation object. Unlike link which represent embedded relation and stored inside owner object, this Relation object is standalone persisitent object containing references to owner and members of the relation

Parameters:
owner - owner of the relation
Returns:
object representing empty relation (relation with specified owner and no members), new members can be added to the link later.

createScalableSet

public IPersistentSet createScalableSet()
Create new scalable set references to persistent objects. This container can effciently store small number of references as well as very large number references. When number of memers is small, Link class is used to store set members. When number of members exceed some threshold, PersistentSet (based on B-Tree) is used instead.

Returns:
scalable set implementation

createScalableSet

public IPersistentSet createScalableSet(int initialSize)
Create new scalable set references to persistent objects. This container can effciently store small number of references as well as very large number references. When number of memers is small, Link class is used to store set members. When number of members exceed some threshold, PersistentSet (based on B-Tree) is used instead.

Parameters:
initialSize - initial size of the set
Returns:
scalable set implementation

createSet

public IPersistentSet createSet()
Create new peristent set

Returns:
persistent object implementing set

createSortedCollection

public SortedCollection createSortedCollection(boolean unique)
Create new sorted collection. Members of this collections should implement java.lang.Comparable interface and make it possible to compare collection members with each other as well as with serch key.

Parameters:
unique - whether index is collection (members with the same key value are not allowed)
Returns:
persistent object implementing sorted collection

createSortedCollection

public SortedCollection createSortedCollection(PersistentComparator comparator,
                                               boolean unique)
Create new sorted collection with specified comparator

Parameters:
comparator - comparator class specifying order in the collection
unique - whether index is collection (members with the same key value are not allowed)
Returns:
persistent object implementing sorted collection

createSpatialIndex

public SpatialIndex createSpatialIndex()
Create new spatial index with integer coordinates

Returns:
persistent object implementing spatial index

createSpatialIndexR2

public SpatialIndexR2 createSpatialIndexR2()
Create new R2 spatial index

Returns:
persistent object implementing spatial index

createThickIndex

public Index createThickIndex(java.lang.Class type)
Create new thick index (index with large number of duplicated keys)

Parameters:
type - type of the index key (you should path here String.class, int.class, ...)
Returns:
persistent object implementing index
Throws:
StorageError(StorageError.UNSUPPORTED_INDEX_TYPE) - exception if specified key type is not supported by implementation.

createTimeSeries

public TimeSeries createTimeSeries(java.lang.Class blockClass,
                                   long maxBlockTimeInterval)
Create new time series object.

Parameters:
blockClass - class derived from TimeSeries.Block
maxBlockTimeInterval - maximal difference in milliseconds between timestamps of the first and the last elements in a block. If value of this parameter is too small, then most blocks will contains less elements than preallocated. If it is too large, then searching of block will be inefficient, because index search will select a lot of extra blocks which do not contain any element from the specified range. Usually the value of this parameter should be set as (number of elements in block)*(tick interval)*2. Coefficient 2 here is used to compencate possible holes in time series. For example, if we collect stocks data, we will have data only for working hours. If number of element in block is 100, time series period is 1 day, then value of maxBlockTimeInterval can be set as 100*(24*60*60*1000)*2
Returns:
new empty time series

deallocateObject

public void deallocateObject(IPersistent obj)

endThreadTransaction

public void endThreadTransaction()
End per-thread transaction started by beginThreadTransaction method.
If transaction is exclusive, this method commits the transaction and allows other thread to proceed.
If transaction is serializable, this method commits sll changes done by this thread and release all locks set by this thread.
If transaction is cooperative, this method decrement counter of cooperative transactions and if it becomes zero - commit the work


endThreadTransaction

public void endThreadTransaction(int maxDelay)
End per-thread cooperative transaction with specified maximal delay of transaction commit. When cooperative transaction is ended, data is not immediately committed to the disk (because other cooperative transaction can be active at this moment of time). Instead of it cooperative transaction counter is decremented. Commit is performed only when this counter reaches zero value. But in case of heavy load there can be a lot of requests and so a lot of active cooperative transactions. So transaction counter never reaches zero value. If system crash happens a large amount of work will be lost in this case. To prevent such scenario, it is possible to specify maximal delay of pending transaction commit. In this case when such timeout is expired, new cooperative transaction will be blocked until transaction is committed.

Parameters:
maxDelay - maximal delay in milliseconds of committing transaction. Please notice, that Perst could not force other threads to commit their cooperative transactions when this timeout is expired. It will only block new cooperative transactions to make it possible to current transaction to complete their work. If maxDelay is 0, current thread will be blocked until all other cooperative trasnaction are also finished and changhes will be committed to the database.

exportXML

public void exportXML(java.io.Writer writer)
               throws java.io.IOException
Export database in XML format

Parameters:
writer - writer for generated XML document
Throws:
java.io.IOException

gc

public int gc()
Explicit start of garbage collector

Returns:
number of collected (deallocated) objects

getClassLoader

public java.lang.ClassLoader getClassLoader()
Get class loader used to locate classes for loaded class descriptors.

Returns:
class loader previously set by setClassLoader method or null if not specified.

getDatabaseSize

public long getDatabaseSize()
Get size of the database


getMemoryDump

public java.util.HashMap getMemoryDump()
Get database memory dump. This function returns hashmap which key is classes of stored objects and value - MemoryUsage object which specifies number of instances of particular class in the storage and total size of memory used by these instance. Size of internal database structures (object index,* memory allocation bitmap) is associated with Storage class. Size of class descriptors - with java.lang.Class class.

This method traverse the storage as garbage collection do - starting from the root object and recursively visiting all reachable objects. So it reports statistic only for visible objects. If total database size is significantly larger than total size of all instances reported by this method, it means that there is garbage in the database. You can explicitly invoke garbage collector in this case.


getObjectByOID

public IPersistent getObjectByOID(int oid)
Retrieve object by OID. This method should be used with care because if object is deallocated, its OID can be reused. In this case getObjectByOID will return reference to the new object with may be different type.

Parameters:
oid - object oid
Returns:
reference to the object with specified OID

getProperties

public java.util.Properties getProperties()
Get all set properties

Returns:
all properties set by setProperty or setProperties method

getProperty

public java.lang.Object getProperty(java.lang.String name)
Get property value.

Parameters:
name - property name
Returns:
value of the property previously assigned by setProperty or setProperties method or null if property was not set

getRoot

public IPersistent getRoot()
Get storage root. Storage can have exactly one root object. If you need to have several root object and access them by name (as is is possible in many other OODBMSes), you should create index and use it as root object.

Returns:
root object or null if root is not specified (storage is not yet initialized)

getUsedSize

public long getUsedSize()
Get total size of all allocated objects in the database


importXML

public void importXML(java.io.Reader reader)
               throws XMLImportException
Import data from XML file

Parameters:
reader - XML document reader
Throws:
XMLImportException

isOpened

public boolean isOpened()
Check if database is opened

Returns:
true if database was opened by open method, false otherwise

join

public java.util.Iterator join(java.util.Iterator[] selections)
Join results of several index searches. This method efficiently join selections without loading objects themselve

Parameters:
selections - selections to be merged
Returns:
Iterator through joineded result

loadObject

public void loadObject(IPersistent obj)

lockObject

public void lockObject(IPersistent obj)

makePersistent

public int makePersistent(IPersistent obj)
Explicitely make object peristent. Usually objects are made persistent implicitlely using "persistency on reachability apporach", but this method allows to do it explicitly. If object is already persistent, execution of this method has no effect.

Parameters:
obj - object to be made persistent
Returns:
OID assigned to the object

merge

public java.util.Iterator merge(java.util.Iterator[] selections)
Merge results of several index searches. This method efficiently merge selections without loading objects themselve

Parameters:
selections - selections to be merged
Returns:
Iterator through merged result

modifyObject

public void modifyObject(IPersistent obj)

open

public void open(IFile file)
Open the storage with default page pool size

Parameters:
file - user specific implementation of IFile interface

open

public void open(IFile file,
                 int pagePoolSize)
Open the storage

Parameters:
file - user specific implementation of IFile interface
pagePoolSize - size of page pool (in bytes). Page pool should contain at least ten 4kb pages, so minimal page pool size should be at least 40Kb. But larger page pool ussually leads to better performance (unless it could not fit in memory and cause swapping).

open

public void open(java.lang.String filePath)
Open the storage with default page pool size

Parameters:
filePath - path to the database file

open

public void open(java.lang.String filePath,
                 int pagePoolSize)
Open the storage

Parameters:
filePath - path to the database file
pagePoolSize - size of page pool (in bytes). Page pool should contain at least ten 4kb pages, so minimal page pool size should be at least 40Kb. But larger page pool usually leads to better performance (unless it could not fit in memory and cause swapping). Value 0 of this paremeter corresponds to infinite page pool (all pages are cashed in memory). It is especially useful for in-memory database, when storage is created with NullFile.

open

public void open(java.lang.String filePath,
                 int pagePoolSize,
                 java.lang.String cipherKey)
Open the encrypted storage

Parameters:
filePath - path to the database file
pagePoolSize - size of page pool (in bytes). Page pool should contain at least ten 4kb pages, so minimal page pool size should be at least 40Kb. But larger page pool ussually leads to better performance (unless it could not fit in memory and cause swapping).
cipherKey - cipher key

rollback

public void rollback()
Rollback changes made by the last transaction


rollbackThreadTransaction

public void rollbackThreadTransaction()
Rollback per-thread transaction. It is safe to use this method only for exclusive transactions. In case of cooperative transactions, this method rollback results of all transactions.


setClassLoader

public java.lang.ClassLoader setClassLoader(java.lang.ClassLoader loader)
Set class loader. This class loader will be used to locate classes for loaded class descriptors. If class loader is not specified or it did find the class, then Thread.getContextClassLoader().loadClass() method will be used to get class for the specified name.

Parameters:
loader - class loader
Returns:
previous class loader or null if not specified

setGcThreshold

public void setGcThreshold(long allocatedDelta)
Set threshold for initiation of garbage collection. By default garbage collection is disable (threshold is set to Long.MAX_VALUE). If it is set to the value different from Long.MAX_VALUE, GC will be started each time when delta between total size of allocated and deallocated objects exceeds specified threashold OR after reaching end of allocation bitmap in allocator.

Parameters:
allocatedDelta - delta between total size of allocated and deallocated object since last GC or storage opening

setListener

public StorageListener setListener(StorageListener listener)
Set storage listener.

Parameters:
listener - new storage listener (may be null)
Returns:
previous storage listener

setProperties

public void setProperties(java.util.Properties props)
Set database properties. This method should be invoked before opening database. For list of supported properties please see setProperty command. All not recognized properties are ignored.


setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Set database property. This method should be invoked before opening database. Currently the following boolean properties are supported:
Property nameParameter typeDefault valueDescription
perst.implicit.valuesBooleanfalse Treate any class not derived from IPersistent as value. This object will be embedded inside persistent object containing reference to this object. If this object is referenced from N persistent object, N instances of this object will be stored in the database and after loading there will be N instances in memory. As well as persistent capable classes, value classes should have default constructor (constructor with empty list of parameters) or has no constructors at all. For example Integer class can not be stored as value in PERST because it has no such constructor. In this case serialization mechanism can be used (see below)
perst.serialize.transient.objectsBooleanfalse Serialize any class not derived from IPersistent or IValue using standard Java serialization mechanism. Packed object closure is stored in database as byte array. Latter the same mechanism is used to unpack the objects. To be able to use this mechanism object and all objects referenced from it should implement java.io.Serializable interface and should not contain references to persistent objects. If such object is referenced from N persistent object, N instances of this object will be stored in the database and after loading there will be N instances in memory.
perst.object.cache.kindString"lru" Kind of object cache. The following values are supported: "strong", "weak", "soft", "lru". String cache uses strong (normal) references to refer persistent objects. Thus none of loaded persistent objects can be deallocated by GC. Weak cache use weak references and soft cache - soft references. The main difference between soft and weak references is that garbage collector is not required to remove soft referenced objects immediately when object is detected to be soft referenced, so it may improve caching of objects. But it also may increase amount of memory used by application, and as far as persistent object requires finalization it can cause memory overflow even though garbage collector is required to clear all soft references before throwing OutOfMemoryException.
But Java specification says nothing about the policy used by GC for soft references (except the rule mentioned above). Unlike it lru cache provide determined behavior, pinning most recently used objects in memory. Number of pinned objects is determined for lru cache by perst.object.index.init.size parameter (it can be 0).
perst.object.cache.init.sizeInteger1319 Initial size of object cache
perst.object.index.init.sizeInteger1024 Initial size of object index (specifying large value increase initial size of database, but reduce number of index reallocations)
perst.extension.quantumLong1048576 Object allocation bitmap extension quantum. Memory is allocate by scanning bitmap. If there is no large enough hole, then database is extended by the value of dbDefaultExtensionQuantum. This parameter should not be smaller than 64Kb.
perst.gc.thresholdLongLong.MAX_VALUE Threshold for initiation of garbage collection. If it is set to the value different from Long.MAX_VALUE, GC will be started each time when delta between total size of allocated and deallocated objects exceeds specified threashold OR after reaching end of allocation bitmap in allocator.
perst.lock.fileBooleanfalse Lock database file to prevent concurrent access to the database by more than one application.
perst.file.readonlyBooleanfalse Database file should be opened in read-only mode.
perst.file.noflushBooleanfalse Do not flush file during transaction commit. It will greatly increase performance because eliminate synchronous write to the disk (when program has to wait until all changed are actually written to the disk). But it can cause database corruption in case of OS or power failure (but abnormal termination of application itself should not cause the problem, because all data which were written to the file, but is not yet saved to the disk is stored in OS file buffers and sooner or later them will be written to the disk)
perst.alternative.btreeBooleanfalse Use aternative implementation of B-Tree (not using direct access to database file pages). This implementation should be used in case of serialized per thread transctions. New implementation of B-Tree will be used instead of old implementation if "perst.alternative.btree" property is set. New B-Tree has incompatible format with old B-Tree, so you could not use old database or XML export file with new indices. Alternative B-Tree is needed to provide serializable transaction (old one could not be used). Also it provides better performance (about 3 times comaring with old implementation) because of object caching. And B-Tree supports keys of user defined types.
perst.background.gcBooleanfalse Perform garbage collection in separate thread without blocking the main application.
perst.string.encodingStringnull Specifies encoding of storing strings in the database. By default Perst stores strings as sequence of chars (two bytes per char). If all strings in application are in the same language, then using encoding can signifficantly reduce space needed to store string (about two times). But please notice, that this option has influence on all strings stored in database. So if you already have some data in the storage and then change encoding, then it can cause incorrect fetching of strings and even database crash.
perst.replication.ackBooleanfalse Request acknowledgement from slave that it receives all data before transaction commit. If this option is not set, then replication master node just writes data to the socket not warring whether it reaches slave node or not. When this option is set to true, master not will wait during each transaction commit acknowledgement from slave node. Please notice that this option should be either set or not set both at slave and master node. If it is set only on one of this nodes then behavior of the system is unpredicted. This option can be used both in synchronous and asynchronous replication mode. The only difference is that in first case main application thread will be blocked waiting for acknowledgment, while in the asynchronous mode special replication thread will be blocked allowing thread performing commit to proceed.
perst.concurrent.iteratorBooleanfalse By default iterator will throw ConcurrentModificationException if iterated collection was changed outside iterator, when the value of this property is true then iterator will try to restore current position and continue iteration
perst.slave.connection.timeoutInteger60 Timeout in seconds during which mastr node will try to establish connection with slave node. If connection can not be established within specified time, then master will not perform replication to this slave node
perst.force.storeBooleantrue When the value of this parameter is true Storage.makePersistent method cause immediate storing of object in the storage, otherwise object is assigned OID and is marked as modified. Storage.makePersistent method is mostly used when object is inserted in B-Tree. If application put in index object referencing a large number of other objects which also has to be made persistent, then marking object as modified instead of immediate storing may cause memory overflow because garbage collector and finalization threads will store objects with less speed than application creates new ones. But if object will be updated after been placed in B-Tree, then immediate store will just cause cause extra overhead, because object has to be stored twice.

Parameters:
name - name of the property
value - value of the property (for boolean properties pass java.lang.Boolean.TRUE and java.lang.Boolean.FALSE

setRoot

public void setRoot(IPersistent root)
Set new storage root object. Previous reference to the root object is rewritten but old root is not automatically deallocated.

Parameters:
root - object to become new storage root. If it is not persistent yet, it is made persistent and stored in the storage

storeFinalizedObject

public void storeFinalizedObject(IPersistent obj)

storeObject

public void storeObject(IPersistent obj)

throwObject

public void throwObject(IPersistent obj)