Reputation: 175
I am evaluating option of using chronicle-queues for storing the audit events and relaying events.
Application should have functionality to replay data from any random point with in a given file, and read relevant data and close he trailer itself.
Application can have multiple trailers at any given time depending on criteria.
While writing the data to appender, we get index using
try (DocumentContext dc = appender.writingDocument()) {
dc.wire().write("hello").text("world " + (i++));
long indexWritten = dc.index();
System.out.println("indexWritten = " + indexWritten);
}
I can store these indices in chronical map or some shared storage. Is there any better way to retrieve index for any data ?
I wanted to delete files after certain duration, and we can use StoreListener or FileStore for calculating the file. Can someone please provide concrete example for the same or is there any better approach that can be used ?
Instead of removing full file, is there any way to remove some data from file or mark it as unreadable
Upvotes: 1
Views: 84
Reputation: 533492
In simple cases, using a Chronicle Map is fine.
You can periodically look at the last modified date or read the date in the file name to check if a file can be deleted. The listener is more useful if you want to act as soon as possible.
You can remove excerpts from a file by copying the excerpts you want to keep and replacing the original file. You can remove write or read access from the file. It is probably simpler to wait until you can delete it.
Upvotes: 0