pub struct OcflRepo { /* private fields */ }
Expand description
OCFL repository
Implementations
Creates a new OcflRepo
instance backed by the local filesystem. storage_root
is the
location of the OCFL repository to open. The OCFL repository must already exist.
pub fn init_fs_repo(
storage_root: impl AsRef<Path>,
staging: Option<&Path>,
layout: Option<StorageLayout>
) -> Result<Self>
pub fn init_fs_repo(
storage_root: impl AsRef<Path>,
staging: Option<&Path>,
layout: Option<StorageLayout>
) -> Result<Self>
Initializes a new OcflRepo
instance backed by the local filesystem. The OCFL repository
most not already exist.
Initializes a new OcflRepo
instance backed by S3. The OCFL repository
most not already exist.
Creates a new OcflRepo
instance backed by S3. prefix
used to specify a
sub directory within a bucket that the OCFL repository is rooted in.
Instructs the repo to gracefully stop any in-flight work and not accept any additional requests.
pub fn validate_object(
&self,
object_id: &str,
fixity_check: bool
) -> Result<ObjectValidationResult>
pub fn validate_object(
&self,
object_id: &str,
fixity_check: bool
) -> Result<ObjectValidationResult>
Validates the specified object and returns any problems found. Err will only be returned if a non-validation problem was encountered.
pub fn validate_object_at(
&self,
path: &str,
fixity_check: bool
) -> Result<ObjectValidationResult>
pub fn validate_object_at(
&self,
path: &str,
fixity_check: bool
) -> Result<ObjectValidationResult>
Validates the specified object at the specified path, relative the storage root, and returns any problems found. Err will only be returned if a non-validation problem was encountered.
pub fn validate_repo<'a>(
&'a self,
fixity_check: bool
) -> Result<Box<dyn IncrementalValidator + 'a>>
pub fn validate_repo<'a>(
&'a self,
fixity_check: bool
) -> Result<Box<dyn IncrementalValidator + 'a>>
Validates the structure of an OCFL repository as well as all of the objects in the repository
When fixity_check
is false
, then the digests of object content files are not validated.
The storage root is validated immediately, and an incremental validator is returned that is used to lazily validate the rest of the repository.
pub fn list_objects<'a>(
&'a self,
filter_glob: Option<&str>
) -> Result<Box<dyn Iterator<Item = Result<ObjectVersionDetails>> + 'a>>
pub fn list_objects<'a>(
&'a self,
filter_glob: Option<&str>
) -> Result<Box<dyn Iterator<Item = Result<ObjectVersionDetails>> + 'a>>
Returns an iterator that iterate through all of the objects in an OCFL repository. Objects are lazy-loaded. An optional glob pattern may be provided to filter the objects that are returned.
The iterator returns an error if it encounters a problem accessing an object. This does
terminate the iterator; there are still more objects until it returns None
.
pub fn list_staged_objects<'a>(
&'a self,
filter_glob: Option<&str>
) -> Result<Box<dyn Iterator<Item = Result<ObjectVersionDetails>> + 'a>>
pub fn list_staged_objects<'a>(
&'a self,
filter_glob: Option<&str>
) -> Result<Box<dyn Iterator<Item = Result<ObjectVersionDetails>> + 'a>>
Returns an iterator that iterate through all of the staged objects in an OCFL repository. Objects are lazy-loaded. An optional glob pattern may be provided to filter the objects that are returned.
The iterator returns an error if it encounters a problem accessing an object. This does
terminate the iterator; there are still more objects until it returns None
.
Returns a view of a version of an object. If a VersionNum
is not specified,
then the head version of the object is returned.
If the object or version of the object cannot be found, then a RocflError::NotFound
error is returned.
Same as get_object()
except that it returns the staged version of an object.
If the object does not have a staged version, then a RocflError::NotFound
error is returned.
pub fn get_object_details(
&self,
object_id: &str,
version_num: VersionRef
) -> Result<ObjectVersionDetails>
pub fn get_object_details(
&self,
object_id: &str,
version_num: VersionRef
) -> Result<ObjectVersionDetails>
Returns high-level details about an object version. This method is similar to
OcflRepo::get_object()
except that it does less processing and does not
include the version’s state.
If the object or version of the object cannot be found, then a RocflError::NotFound
error is returned.
Same as get_object_details()
, but for the staged version of an object.
If the object does not have a staged version, then a RocflError::NotFound
error is returned.
Returns a vector containing the version metadata for ever version of an object. The vector is sorted in ascending order.
If the object cannot be found, then a RocflError::NotFound
error is returned.
pub fn get_object_file(
&self,
object_id: &str,
path: &LogicalPath,
version_num: VersionRef,
sink: &mut dyn Write
) -> Result<()>
pub fn get_object_file(
&self,
object_id: &str,
path: &LogicalPath,
version_num: VersionRef,
sink: &mut dyn Write
) -> Result<()>
Writes the specified file to the sink.
If the file cannot be found, then a RocflError::NotFound
error is returned.
pub fn get_staged_object_file(
&self,
object_id: &str,
path: &LogicalPath,
sink: &mut dyn Write
) -> Result<()>
pub fn get_staged_object_file(
&self,
object_id: &str,
path: &LogicalPath,
sink: &mut dyn Write
) -> Result<()>
Writes the specified file from the staged version of the object to the sink.
If the file cannot be found, then a RocflError::NotFound
error is returned.
pub fn list_file_versions(
&self,
object_id: &str,
path: &LogicalPath
) -> Result<Vec<VersionDetails>>
pub fn list_file_versions(
&self,
object_id: &str,
path: &LogicalPath
) -> Result<Vec<VersionDetails>>
Returns a vector contain the version metadata for every version of an object that affected the specified file. The vector is sorted in ascending order.
If the object or path cannot be found, then a `RocflError::NotFound’ error is returned.
pub fn diff(
&self,
object_id: &str,
left_version: Option<VersionNum>,
right_version: VersionNum
) -> Result<Vec<Diff>>
pub fn diff(
&self,
object_id: &str,
left_version: Option<VersionNum>,
right_version: VersionNum
) -> Result<Vec<Diff>>
Returns the diff of two object versions. If only one version is specified, then the diff is between the specified version and the version before it.
If the object cannot be found, then a RocflError::NotFound
error is returned.
Returns all of the staged changes to the specified object, if there are any.
Completely removes the specified object from the repository. If the object doest not exist, nothing happens.
pub fn create_object(
&self,
object_id: &str,
digest_algorithm: DigestAlgorithm,
content_dir: &str,
padding_width: u32
) -> Result<()>
pub fn create_object(
&self,
object_id: &str,
digest_algorithm: DigestAlgorithm,
content_dir: &str,
padding_width: u32
) -> Result<()>
Stages a new OCFL object if there is not an existing object with the same ID. The object is not inserted into the repository until it is committed.
Copies files from outside the OCFL repository into the specified OCFL object.
A destination of /
specifies the object’s root.
Copies files within an OCFL object. The source paths may be glob patterns.
Moves files from outside the OCFL repository into the specified OCFL object.
A destination of /
specifies the object’s root.
Moves files within an OCFL object. The source paths may be glob patterns.
Removes the specified files from the staged version of the object. The files still exist in prior versions.
Reset all staged changes for an object by dropping the object’s staged version completely.
Resets to specified staged changes to an object. Paths may be a glob and is resolved against both the staged version and the previous version. Matches in the staged version are treated as add/update resets and matches in the previous version are treated as remove resets.
Commits all of an object’s staged changes. If user_address
is provided, then user_name
must also be. If created
is not provided, then it defaults to the current time.
object_root
may be specified to define the storage root relative path to the object’s
root. This value is only respected if the object does not already exist, and the
repo does not have defined storage layout.
Auto Trait Implementations
impl !RefUnwindSafe for OcflRepo
impl !UnwindSafe for OcflRepo
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more