#JetBrains Xodus
JetBrains Xodus is a transactional schema-less embedded database written in Java. It was initially developed for JetBrains YouTrack (an issue tracking and project management tool). Currently Xodus is also used in JetBrains Hub (JetBrains' team tools connector) and in some internal JetBrains projects.
- Xodus is transactional and fully ACID-compliant.
- Xodus is highly concurrent. Reads are completely non-blocking due to MVCC and true snapshot isolation.
- Xodus is schema-less and agile. It requires no schema migrations or refactorings.
- Xodus is embedded. It doesn’t require installation or administration.
- Xodus is written in pure Java.
- Xodus is free and licensed under Apache 2.0.
##Hello Worlds!
To start using Xodus, define dependencies:
<!-- in Maven project -->
<dependency>
<groupId>org.jetbrains.xodus</groupId>
<artifactId>xodus-openAPI</artifactId>
<version>1.0.0</version>
</dependency>
// in Gradle project
dependencies {
compile 'org.jetbrains.xodus:xodus-openAPI:1.0.0'
}
Read more about managing dependencies.
There are three different ways to deal with data which give three different API layers: Environments, Entity Stores and Virtual File Systems.
###Environments
final Environment env = Environments.newInstance("/home/me/.myAppData");
env.executeInTransaction(new TransactionalExecutable() {
@Override
public void execute(@NotNull final Transaction txn) {
final Store store = env.openStore("Messages", StoreConfig.WITHOUT_DUPLICATES, txn)
store.put(txn, StringBinding.stringToEntry("Hello"), StringBinding.stringToEntry("World!"));
}
});
env.close();
###Entity Stores
final PersistentEntityStore entityStore = PersistentEntityStores.newInstance("/home/me/.myAppData");
entityStore.executeInTransaction(new StoreTransactionalExecutable() {
@Override
public void execute(@NotNull final StoreTransaction txn) {
final Entity message = txn.newEntity("Message");
message.setProperty("hello", "World!");
}
});
entityStore.close();
###Virtual File Systems
final Environment env = Environments.newInstance("/home/me/.myAppData");
final VirtualFileSystem vfs = new VirtualFileSystem(env);
env.executeInTransaction(new TransactionalExecutable() {
@Override
public void execute(@NotNull final Transaction txn) {
final File file = vfs.createFile(txn, "Messages");
try (DataOutputStream output = new DataOutputStream(vfs.writeFile(txn, file))) {
output.writeUTF("Hello ");
output.writeUTF("World!");
}
}
});
vfs.shutdown();
env.close();
##Building from Source Gradle is used to build, test and publish. JDK 1.8 is required. To build the project run:
./gradlew build
To assemble jars and skip running tests run:
./gradlew assemble
##Find out More