Package org.mockserver.mock.audit
Class AuditStore
java.lang.Object
org.mockserver.mock.audit.AuditStore
Thread-safe, append-only, bounded ring buffer of
AuditEntry records
for control-plane mutations. Oldest entries are evicted once the store reaches
its maximum capacity.
The singleton's initial capacity is read once from controlPlaneAuditMaxEntries at class
initialization, but is NOT fixed for the process lifetime: setMaxSize(int) resizes the
store live, and is invoked when controlPlaneAuditMaxEntries changes via
PUT /mockserver/configuration. A package-visible constructor exists for unit tests that
need an isolated, small-capacity instance.
-
Method Summary
Modifier and TypeMethodDescriptionvoidadd(AuditEntry entry) voidclear()static AuditStoreintThe store's current capacity.getRecent(int limit) Returns up tolimitmost-recent entries, newest first.voidsetMaxSize(int maxSize) Resize the store.intsize()
-
Method Details
-
getInstance
-
setMaxSize
public void setMaxSize(int maxSize) Resize the store. A SHRINK takes effect immediately: the oldest entries are discarded until the store fits the new capacity, rather than waiting for further audited mutations to push them out. Non-positive values are ignored (the existing capacity is retained), matching the constructor's treatment of a non-positive configured value.- Parameters:
maxSize- the new capacity
-
getMaxSize
public int getMaxSize()The store's current capacity. -
add
-
getRecent
Returns up tolimitmost-recent entries, newest first. -
clear
public void clear() -
size
public int size()
-