Concourse automatically tracks every change to every piece of data,
creating a complete version history. This enables you to query and
read data as it existed at any point in the past.
A temporal query evaluates its selection criteria based on the
version of data at a previous timestamp. The query returns the
records that would have matched the criteria at that point in
time.
12345
// Java// Find records where age > 30 as of last monthSet<Long>records=concourse.find("age > 30",Timestamp.fromString("last month"));
A temporal read retrieves the version of the data that existed
at a previous timestamp. The read returns what the data looked
like at that point in time.
1234
// Java// Get the name that was stored in record 1 last monthObjectname=concourse.get("name",1,Timestamp.fromString("last month"));
You can combine temporal queries and temporal reads in a single
operation:
123456
// Java// Select data from records matching criteria, both// evaluated at the same historical timestampMap<Long,Map<String,Set<Object>>>data=concourse.select("age > 30",Timestamp.fromString("last month"));
The audit method returns a complete revision history for a
record or a specific field. Each entry maps a commit timestamp to
a list of human-readable descriptions of the changes made.
The chronicle method returns a time series of the values stored
for a key in a record after every change. Unlike audit, which
describes what changed, chronicle shows the state of the
field after each change.
The diff method returns the net changes between two points
in time. Unlike audit, which records every individual change,
diff computes the minimal set of additions and removals needed
to transition from the start state to the end state.
// JavaMap<Object,Map<Diff,Set<Long>>>changes=concourse.diff("status",Timestamp.fromString("last week"));// Shows which values were added/removed and in which records
The revert method atomically restores a key in a record to its
state at a previous timestamp. Concourse computes the necessary
adds and removes to recreate the historical state, then applies
them as new revisions. The original history is preserved.
Reverting does not delete history. Instead, it creates new
revisions that undo the changes made since the target
timestamp. The full audit trail, including the revert
operations themselves, is preserved.