![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |
• Persistence Type: You can set persistence to NONE (no persistence, shared all persistence, or shared-nothing persistence).
• Persistence Policy: You can set up asynchronous persistence or synchronous persistence.
• Shared-Nothing Persistence Each node that joins a space as a seeder maintains a copy of the space data on disk. Each node that joins as a seeder writes its data to disk and reads the data when needed for recovery and for cache misses
• Shared-All Persistence All nodes share a single persister or a set of persisters.
• C API By using the tibasSpaceDef_SetPersistenceType() function and the tibasSpaceDef_SetPersistencePolicy() function.
•
• For descriptions of the ActiveSpaces example programs used to set up persistence, see ASPersistence and Shared-Nothing Persistence.The ActiveSpaces C API provides the tibasSpaceDef_SetPersistenceType() Function. When you call this function, you can specify:
• TIBAS_PERSISTENCE_NONE Do not persist objects in the space.
• TIBAS_PERSISTENCE_SHARED_ALL Use shared-all persistence
• TIBAS_PERSISTENCE_SHARED_NOTHING Use shared-nothing persistence.The C API provides the tibasSpaceDef_SetPersistenceType() function specifies the persistence policy to use on the space. You can specify PERSISTENCE_SYNC or PERSISTENCE_ASYNC.
• PersistenceType Method Lets you set persistence to NONE, SHARE_ALL, or SHARE_NOTHING.
• PersistencePolicy Method Lets you set the persistence policy to ASYNC or SYNC.
− Using the MemberDef object and calling the tibasMemberDef_SetDataStore() function.
− Setting the AS_DATA_STORE environment variable to the directory required before starting the client program or as-agent.
− With the as-agent, using the -data_store <directory name with path> CLI command.For code examples showing how to set up shared-nothing persistence, refer to ASPersistence2.c in the /examples directory.Because ActiveSpaces is a true peer-to-peer distributed system, it provides API operations that let you enable shared all persistence. With shared all persistence, some of the space members — the persisters — are responsible for interacting with a persistence layer, just as some of the space members — the seeders — provide the basic space service.Applications can register their ability to provide the persistence service on a space by invoking the setPersister method of the Space object. In Java, this method takes an instance of a class that implements the Persister interface. In C it takes a tibasPersister object, which itself can be created using the tibasPersister_Create function where pointers to the functions required by the persister interface are provided by the user. It is therefore necessary for the application to first have joined the space (as a seeder or as a leech) before it can register itself as a persister.Applications can also indicate their desire to stop providing the persistence service by invoking the space's stopPersister method in Java and tibasPersister_Free in C.Interaction with the persistence layer is implemented by classes (or sets of functions in C) that implement the Persister interface. It is up to the user to provide implementations of this interface to perform persistence to their persistent storage of choice (for example a database, or a key-value store, or a file system).Applications able to provide the persistence service register an instance of a class implementing the Persister interface for a space using the space object's setPersister method, and indicate their willingness to stop providing the persistence service for a space using the space object's stopPersister method.The Persister interface consists of five methods:
• onOpen Invoked when the persister object is registered with the space
• onClose Invoked when the persister object is stopped for the space
• onWrite Invoked when a tuple stored in the space is modified (due to a put, take, or update operation) and is intended to perform the steps necessary to reflect the change in the space onto the persistence layer.
• onRead Invoked if the space has a capacity set and a capacity policy of EVICT, and if a request to read, lock, or take a tuple by key value did not result in a matching tuple being found in the space.
• onLoad The onLoad callback is made to the first persister instance.
It is invoked as soon as the space has reached the minimum number of seeders. If the space has a capacity set and a capacity policy of EVICT it is not required to do anything but can still be used to pre-load the caching space with some of the tuples stored in the persistence layer.The default value for recoverWithData (TIBAS_TRUE) specifies recovery with data; if you specify TIBAS_FALSE, recovery without data is set.You can also use tibasMetaspace_RecoverSpaceEx(metaspace, spaceName, recoveryOptions).
![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |