@@ -10,7 +10,7 @@ use std::{
1010} ;
1111
1212use bytes:: Bytes ;
13- use chrono:: Local ;
13+ use chrono:: { DateTime , Local } ;
1414use derive_setters:: Setters ;
1515use log:: { debug, error, info} ;
1616use serde_with:: { serde_as, DisplayFromStr } ;
@@ -38,7 +38,7 @@ use crate::{
3838 copy:: CopySnapshot ,
3939 forget:: { ForgetGroups , KeepOptions } ,
4040 key:: KeyOptions ,
41- lock:: LockOptions ,
41+ lock:: { lock_all_files , lock_repo , LockOptions } ,
4242 prune:: { PruneOptions , PrunePlan } ,
4343 repair:: { index:: RepairIndexOptions , snapshots:: RepairSnapshotsOptions } ,
4444 repoinfo:: { IndexInfos , RepoFileInfos } ,
@@ -1060,6 +1060,37 @@ impl<P: ProgressBars, S: Open> Repository<P, S> {
10601060 opts. get_plan ( self )
10611061 }
10621062
1063+ /// Lock the complete repository, i.e. everything in the storage backend.
1064+ ///
1065+ /// # Arguments
1066+ ///
1067+ /// * `until` - until when to lock. None means lock forever.
1068+ ///
1069+ /// # Errors
1070+ ///
1071+ // TODO: Document errors
1072+ pub fn lock_repo ( & self , until : Option < DateTime < Local > > ) -> RusticResult < ( ) > {
1073+ lock_repo ( self , until)
1074+ }
1075+
1076+ /// Lock all repository files of the given type
1077+ ///
1078+ /// # Arguments
1079+ ///
1080+ /// * `file_type` - the file type to lock
1081+ /// * `until` - until when to lock. None means lock forever.
1082+ ///
1083+ /// # Errors
1084+ ///
1085+ // TODO: Document errors
1086+ pub fn lock_repo_files (
1087+ & self ,
1088+ file_type : FileType ,
1089+ until : Option < DateTime < Local > > ,
1090+ ) -> RusticResult < ( ) > {
1091+ lock_all_files ( self , file_type, until)
1092+ }
1093+
10631094 /// Lock snapshot and pack files needed for the given snapshots
10641095 ///
10651096 /// # Arguments
@@ -1071,7 +1102,7 @@ impl<P: ProgressBars, S: Open> Repository<P, S> {
10711102 /// # Errors
10721103 ///
10731104 // TODO: Document errors
1074- pub fn lock ( & self , opts : & LockOptions , snaps : & [ SnapshotFile ] ) -> RusticResult < ( ) > {
1105+ pub fn lock_snaphots ( & self , opts : & LockOptions , snaps : & [ SnapshotFile ] ) -> RusticResult < ( ) > {
10751106 let now = Local :: now ( ) ;
10761107 opts. lock ( self , snaps, now)
10771108 }
0 commit comments