use of io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.SnapshotTableRequest in project deephaven-core by deephaven.
the class JsTable method snapshot.
@JsMethod
public Promise<JsTable> snapshot(JsTable rightHandSide, @JsOptional Boolean doInitialSnapshot, @JsOptional String[] stampColumns) {
Objects.requireNonNull(rightHandSide, "Snapshot right-hand-side table");
final boolean realDoInitialSnapshot;
if (doInitialSnapshot != null) {
realDoInitialSnapshot = doInitialSnapshot;
} else {
realDoInitialSnapshot = true;
}
final String[] realStampColums;
if (stampColumns == null) {
// server doesn't like null
realStampColums = new String[0];
} else {
// make sure we pass an actual string array
realStampColums = Arrays.stream(stampColumns).toArray(String[]::new);
}
final String fetchSummary = "snapshot(" + rightHandSide + ", " + doInitialSnapshot + ", " + Arrays.toString(stampColumns) + ")";
return workerConnection.newState((c, state, metadata) -> {
SnapshotTableRequest request = new SnapshotTableRequest();
request.setLeftId(state().getHandle().makeTableReference());
request.setRightId(rightHandSide.state().getHandle().makeTableReference());
request.setResultId(state.getHandle().makeTicket());
request.setDoInitialSnapshot(realDoInitialSnapshot);
request.setStampColumnsList(realStampColums);
workerConnection.tableServiceClient().snapshot(request, metadata, c::apply);
}, fetchSummary).refetch(this, workerConnection.metadata()).then(state -> Promise.resolve(new JsTable(workerConnection, state)));
}
use of io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.SnapshotTableRequest in project deephaven-core by deephaven.
the class JsTable method freeze.
@JsMethod
public Promise<JsTable> freeze() {
return workerConnection.newState((c, state, metadata) -> {
SnapshotTableRequest request = new SnapshotTableRequest();
// explicit null to signal that we are just freezing this table
request.setLeftId(null);
request.setRightId(state().getHandle().makeTableReference());
request.setResultId(state.getHandle().makeTicket());
request.setDoInitialSnapshot(true);
request.setStampColumnsList(new String[0]);
workerConnection.tableServiceClient().snapshot(request, metadata, c::apply);
}, "freeze").refetch(this, workerConnection.metadata()).then(state -> Promise.resolve(new JsTable(workerConnection, state)));
}
Aggregations