tape: make sure we only commit/write valid catalogs
This commit is contained in:
parent
88bc9635aa
commit
82775c4764
@ -313,6 +313,9 @@ impl MediaCatalog {
|
|||||||
|
|
||||||
/// Conditionally commit if in pending data is large (> 1Mb)
|
/// Conditionally commit if in pending data is large (> 1Mb)
|
||||||
pub fn commit_if_large(&mut self) -> Result<(), Error> {
|
pub fn commit_if_large(&mut self) -> Result<(), Error> {
|
||||||
|
if self.current_archive.is_some() {
|
||||||
|
bail!("can't commit catalog in the middle of an chunk archive");
|
||||||
|
}
|
||||||
if self.pending.len() > 1024*1024 {
|
if self.pending.len() > 1024*1024 {
|
||||||
self.commit()?;
|
self.commit()?;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user