Class | Description |
---|---|
BucketReadTrx |
BucketReadTrx
|
BucketWriteTrx |
BucketWriteTrx
|
Session |
Session
|
Storage |
This class represents one concrete database for enabling several
ISession objects. |
The access semantics is as follows:
IStorage
instance per Storage-FolderISession
instances per
IStorage
linked uniquely to resources representing concrete data-storages.IBucketWriteTrx
instance per
ISession
IBucketReadTrx
instances per
ISession
.Code examples:
// StorageConfiguration denoted the configuration for a connected set of data resources. final StorageConfiguration dbConfig = new StorageConfiguration(new File("/path/to/db/location")); // Creation of a database. Returns true if successful, false if not (including existence of the database) Storage.createDatabase(dbConfig); // Getting of database instance, will be a singleton for the denoted path final IStorage database = Storage.openDatabase(new File("/path/to/db/location"); // Creation of a resource within the db. The creation includes the setting of versioning, etc. It must take place only one. final ResourceConfiguration resourceConfig = new ResourceConfiguration.Builder("coolResource").setRevision(ERevisioning.Differential).build(); database.createResource(resourceConfig); // Getting access via a ISession final SessionConfiguration sessionConfig = new SessionConfiguration("coolResource"); final ISession someSession = Session.beginSession(sessionConfig); final IBucketWriteTrx someWTX = someSession.beginWriteTransaction(); someWTX.abort(); someWTX.close(); someSession.close(); database.close();
Copyright © 2013. All Rights Reserved.