Package io.sentry.cache
Class EnvelopeCache
java.lang.Object
io.sentry.cache.EnvelopeCache
- All Implemented Interfaces:
IEnvelopeCache
,Iterable<SentryEnvelope>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected final @NotNull File
static final String
protected @NotNull SentryOptions
static final String
static final String
protected final @NotNull LazyEvaluator<ISerializer>
static final String
static final String
File suffix added to all serialized envelopes files.protected static final Charset
-
Constructor Summary
ConstructorDescriptionEnvelopeCache
(@NotNull SentryOptions options, @NotNull String cacheDirPath, int maxCacheItems) -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull IEnvelopeCache
create
(@NotNull SentryOptions options) void
discard
(@NotNull SentryEnvelope envelope) void
static @NotNull File
getCurrentSessionFile
(@NotNull String cacheDirPath) static @NotNull File
getPreviousSessionFile
(@NotNull String cacheDirPath) protected boolean
Check if a dir.@NotNull Iterator<SentryEnvelope>
iterator()
protected void
rotateCacheIfNeeded
(@NotNull File[] files) Rotates the caching folder if full, deleting the oldest files firstvoid
store
(@NotNull SentryEnvelope envelope, @NotNull Hint hint) boolean
Awaits until the previous session (if any) is flushed to its own file.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.sentry.cache.IEnvelopeCache
store
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
SUFFIX_ENVELOPE_FILE
File suffix added to all serialized envelopes files.- See Also:
-
PREFIX_CURRENT_SESSION_FILE
- See Also:
-
PREFIX_PREVIOUS_SESSION_FILE
- See Also:
-
CRASH_MARKER_FILE
- See Also:
-
NATIVE_CRASH_MARKER_FILE
- See Also:
-
STARTUP_CRASH_MARKER_FILE
- See Also:
-
UTF_8
-
options
-
serializer
-
directory
-
-
Constructor Details
-
EnvelopeCache
public EnvelopeCache(@NotNull @NotNull SentryOptions options, @NotNull @NotNull String cacheDirPath, int maxCacheItems)
-
-
Method Details
-
create
-
store
- Specified by:
store
in interfaceIEnvelopeCache
-
discard
- Specified by:
discard
in interfaceIEnvelopeCache
-
getCurrentSessionFile
-
getPreviousSessionFile
-
iterator
- Specified by:
iterator
in interfaceIterable<SentryEnvelope>
-
waitPreviousSessionFlush
public boolean waitPreviousSessionFlush()Awaits until the previous session (if any) is flushed to its own file. -
flushPreviousSession
public void flushPreviousSession() -
isDirectoryValid
protected boolean isDirectoryValid()Check if a dir. is valid and have write and read permission- Returns:
- true if valid and has permissions or false otherwise
-
rotateCacheIfNeeded
Rotates the caching folder if full, deleting the oldest files first- Parameters:
files
- the Files
-