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 voidclearMeta(java.lang.String role)Generic method to remove meta, useful when keys rotated in root.java.lang.StringgetIdentifier()A generic string for identifying the local store in debug messages.static PassthroughCacheMetaStorenewPassthroughMetaCache(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.voidwriteMeta(java.lang.String roleName, SignedTufMeta<? extends TufMeta> meta)Generic method to store one of theSignedTufMetaresources in the local tuf store.
-
-
-
Method Detail
-
getIdentifier
public java.lang.String getIdentifier()
Description copied from interface:MetaStoreA 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:
getIdentifierin 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:MetaReaderReturn a named metadata item if there is any.- Specified by:
readMetain 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.IOExceptionDescription copied from interface:MetaStoreGeneric method to store one of theSignedTufMetaresources in the local tuf store.
-
clearMeta
public void clearMeta(java.lang.String role) throws java.io.IOExceptionDescription copied from interface:MetaStoreGeneric method to remove meta, useful when keys rotated in root. Deletion is not optional, implementers must ensure meta is removed from the storage medium.
-
-