Package dev.sigstore.tuf
Class PassthroughCacheMetaStore
- java.lang.Object
-
- dev.sigstore.tuf.PassthroughCacheMetaStore
-
- All Implemented Interfaces:
MetaReader
,MetaStore
public class PassthroughCacheMetaStore extends java.lang.Object implements MetaReader, MetaStore
An in memory cache that will pass through to a provided local tuf store.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearMeta(java.lang.String role)
Generic method to remove meta, useful when keys rotated in root.java.lang.String
getIdentifier()
A generic string for identifying the local store in debug messages.static PassthroughCacheMetaStore
newPassthroughMetaCache(MetaStore localStore)
<T extends SignedTufMeta<? extends TufMeta>>
java.util.Optional<T>readMeta(java.lang.String roleName, java.lang.Class<T> tClass)
Return a named metadata item if there is any.void
writeMeta(java.lang.String roleName, SignedTufMeta<? extends TufMeta> meta)
Generic method to store one of theSignedTufMeta
resources in the local tuf store.
-
-
-
Method Detail
-
getIdentifier
public java.lang.String getIdentifier()
Description copied from interface:MetaStore
A generic string for identifying the local store in debug messages. A file system based implementation might return the path being used for storage, while an in-memory store may just return something like 'in-memory'.- Specified by:
getIdentifier
in interfaceMetaStore
-
newPassthroughMetaCache
public static PassthroughCacheMetaStore newPassthroughMetaCache(MetaStore localStore)
-
readMeta
public <T extends SignedTufMeta<? extends TufMeta>> java.util.Optional<T> readMeta(java.lang.String roleName, java.lang.Class<T> tClass) throws java.io.IOException
Description copied from interface:MetaReader
Return a named metadata item if there is any.- Specified by:
readMeta
in interfaceMetaReader
- Parameters:
roleName
- the name of the role to load (root, timestamp, snapshot, targets, or a delegated target role)tClass
- the class type- Returns:
- an instance of the signed metadata for the role if it was found
- Throws:
java.io.IOException
- if an error occurs reading from the backing store
-
writeMeta
public void writeMeta(java.lang.String roleName, SignedTufMeta<? extends TufMeta> meta) throws java.io.IOException
Description copied from interface:MetaStore
Generic method to store one of theSignedTufMeta
resources in the local tuf store.
-
clearMeta
public void clearMeta(java.lang.String role) throws java.io.IOException
Description copied from interface:MetaStore
Generic method to remove meta, useful when keys rotated in root. Deletion is not optional, implementers must ensure meta is removed from the storage medium.
-
-