Trait tuf::repository::Repository
[−]
[src]
pub trait Repository<D> where
D: DataInterchange, { type TargetRead: Read; fn initialize(&mut self) -> Result<()>; fn store_metadata<M>(
&mut self,
role: &Role,
meta_path: &MetadataPath,
version: &MetadataVersion,
metadata: &SignedMetadata<D, M>
) -> Result<()>
where
M: Metadata; fn fetch_metadata<M>(
&mut self,
role: &Role,
meta_path: &MetadataPath,
version: &MetadataVersion,
max_size: &Option<usize>,
min_bytes_per_second: u32,
hash_data: Option<(&HashAlgorithm, HashValue)>
) -> Result<SignedMetadata<D, M>>
where
M: Metadata; fn store_target<R>(
&mut self,
read: R,
target_path: &TargetPath
) -> Result<()>
where
R: Read; fn fetch_target(
&mut self,
target_path: &TargetPath,
target_description: &TargetDescription,
min_bytes_per_second: u32
) -> Result<SafeReader<Self::TargetRead>>; fn check<M>(role: &Role, meta_path: &MetadataPath) -> Result<()>
where
M: Metadata, { ... } }
Top-level trait that represents a TUF repository and contains all the ways it can be interacted with.
Associated Types
type TargetRead: Read
The type returned when reading a target.
Required Methods
fn initialize(&mut self) -> Result<()>
Initialize the repository.
fn store_metadata<M>(
&mut self,
role: &Role,
meta_path: &MetadataPath,
version: &MetadataVersion,
metadata: &SignedMetadata<D, M>
) -> Result<()> where
M: Metadata,
&mut self,
role: &Role,
meta_path: &MetadataPath,
version: &MetadataVersion,
metadata: &SignedMetadata<D, M>
) -> Result<()> where
M: Metadata,
Store signed metadata.
Note: This MUST canonicalize the bytes before storing them as a read will expect the hashes of the metadata to match.
fn fetch_metadata<M>(
&mut self,
role: &Role,
meta_path: &MetadataPath,
version: &MetadataVersion,
max_size: &Option<usize>,
min_bytes_per_second: u32,
hash_data: Option<(&HashAlgorithm, HashValue)>
) -> Result<SignedMetadata<D, M>> where
M: Metadata,
&mut self,
role: &Role,
meta_path: &MetadataPath,
version: &MetadataVersion,
max_size: &Option<usize>,
min_bytes_per_second: u32,
hash_data: Option<(&HashAlgorithm, HashValue)>
) -> Result<SignedMetadata<D, M>> where
M: Metadata,
Fetch signed metadata.
fn store_target<R>(&mut self, read: R, target_path: &TargetPath) -> Result<()> where
R: Read,
R: Read,
Store the given target.
fn fetch_target(
&mut self,
target_path: &TargetPath,
target_description: &TargetDescription,
min_bytes_per_second: u32
) -> Result<SafeReader<Self::TargetRead>>
&mut self,
target_path: &TargetPath,
target_description: &TargetDescription,
min_bytes_per_second: u32
) -> Result<SafeReader<Self::TargetRead>>
Fetch the given target.
Provided Methods
fn check<M>(role: &Role, meta_path: &MetadataPath) -> Result<()> where
M: Metadata,
M: Metadata,
Perform a sanity check that M
, Role
, and MetadataPath
all desrcribe the same entity.
Implementors
impl<D> Repository<D> for FileSystemRepository<D> where
D: DataInterchange, type TargetRead = File;impl<D> Repository<D> for HttpRepository<D> where
D: DataInterchange, type TargetRead = Response;impl<D> Repository<D> for EphemeralRepository<D> where
D: DataInterchange, type TargetRead = Cursor<Vec<u8>>;