-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EPIC] Add metadata to cache format #1610
Comments
DesignIn-memory structurestruct Metadata {
error: Option<CacheError>,
version: u32,
created: SystemTime,
scope: Scope,
source: String,
}
struct CacheEntry {
metadata: Metadata,
contents: ByteView<'static>,
} struct Metadata {
version: u32,
created: SystemTime,
scope: Scope,
source: String,
}
struct CacheEntry<T> {
metadata: Metadata,
contents: Result<T, CacheError>,
} This version hews closer to the current implementation, where each cache entry is just On-disk structure
|
The design is complicated somewhat by the fact that we use different (meta)data to compute the cache key in different caches.
|
Currently, on-disk cache entries consist of either the file contents if the file was successfully fetched/looked up, or an error prefix + message if there was an error, or nothing if the file wasn't found. There is no other metadata associated with the file—the source location is used to compute the cache path, but this is not reversible. File deletion operates purely based on the mtime in the file system.
Instead, we propose to associate both data and metadata with each cache entry. The data would be the file contents in the success case and empty otherwise. The metadata could contain:
"global"
)and possibly other data.
Saving the metadata in the filesystem could be accomplished by serializing the metadata to JSON and writing them either to separate files or into the same file before the data (whence it could then be deserialized as in https://github.com/getsentry/relay/blob/eb2b79ce88d2b1323bc99aab72f21fbe56619010/relay-server/src/envelope.rs#L1539-L1541).
Open questions:
CacheEntry
/CacheError
?The text was updated successfully, but these errors were encountered: