Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions ext/diametric/DiametricDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,29 @@ public IRubyObject as_of(ThreadContext context, IRubyObject arg) {
}
}

@JRubyMethod
public IRubyObject basis_t(ThreadContext context) {
try {
Long time = (Long) DiametricService.getFn("datomic.api", "basis-t").invoke(database);
return context.getRuntime().newFixnum(time);
} catch (Throwable t) {
throw context.getRuntime().newRuntimeError("Datomic Error: " + t.getMessage());
}
}

@JRubyMethod
public IRubyObject history(ThreadContext context) {
try {
Database db_history = (Database) DiametricService.getFn("datomic.api", "history").invoke(database);
RubyClass clazz = (RubyClass)context.getRuntime().getClassFromPath("Diametric::Persistence::Database");
DiametricDatabase diametric_database = (DiametricDatabase)clazz.allocate();
diametric_database.init(db_history);
return diametric_database;
} catch (Throwable t) {
throw context.getRuntime().newRuntimeError("Datomic Error: " + t.getMessage());
}
}

@JRubyMethod
public IRubyObject since(ThreadContext context, IRubyObject arg) {
Object t_value = DiametricUtils.convertRubyToJava(context, arg);
Expand Down