[wpiutil] Add DataLog and DataLogManager Stop() (#5860)

Restarting a stopped log results in creating a new log file with fresh copies of the same start records and schema data records.

Also check to see if the file has been deleted or if the log file exceeds 1.8 GB, and start a new one.
This commit is contained in:
Peter Johnson
2023-11-03 20:34:43 -07:00
committed by GitHub
parent 2a04e12c6f
commit f1a82828fe
11 changed files with 398 additions and 135 deletions

View File

@@ -106,11 +106,20 @@ public final class DataLog implements AutoCloseable {
DataLogJNI.pause(m_impl);
}
/** Resumes appending of data records to the log. */
/**
* Resumes appending of data records to the log. If called after stop(), opens a new file (with
* random name if SetFilename was not called after stop()) and appends Start records and schema
* data values for all previously started entries and schemas.
*/
public void resume() {
DataLogJNI.resume(m_impl);
}
/** Stops appending all records to the log, and closes the log file. */
public void stop() {
DataLogJNI.stop(m_impl);
}
/**
* Returns whether there is a data schema already registered with the given name.
*

View File

@@ -18,6 +18,8 @@ public class DataLogJNI extends WPIUtilJNI {
static native void resume(long impl);
static native void stop(long impl);
static native void addSchema(long impl, String name, String type, byte[] schema, long timestamp);
static native void addSchemaString(