Documentation
¶
Overview ¶
Package ocfl provides high-level functions for interacting with OCFL objects. It orchestrates lower-level modules to perform common tasks like validating, extracting, and retrieving metadata from OCFL objects.
Package ocfl provides functions for loading and initializing OCFL storage roots and objects. It acts as a high-level entry point for working with different OCFL versions by orchestrating the creation of appropriate factories and managers.
Index ¶
- func Extract(ctx context.Context, objectFS fs.FS, destFS appendfs.FS, path string, ...) error
- func ExtractMeta(ctx context.Context, fsys fs.FS, path string, logger ocfllogger.OCFLLogger) (*inventory.Metadata, error)
- func InitObject(ctx context.Context, fsys appendfs.FS, extensionConfigFS fs.FS, ...) (object.Object, error)
- func InitStorageRoot(ctx context.Context, fsys appendfs.FS, extensionConfigFS fs.FS, ...) (storageroot.StorageRoot, error)
- func LoadObject(ctx context.Context, fsys fs.FS, extensionParams map[string]string, ...) (object.Object, error)
- func LoadStorageRoot(ctx context.Context, fsys fs.FS, extensionParams map[string]string, ...) (storageroot.StorageRoot, error)
- func NewExtensionFactory[T extension.ManagerCore[T]](params map[string]string, logger ocfllogger.OCFLLogger) (extension.Factory[T], error)
- func NewFactoryObject(ver version.OCFLVersion, ...) factory.FactoryObject
- func NewFactoryStorageRoot(ver version.OCFLVersion, ...) factory.FactoryStorageRoot
- func NewOCFLLogger(ctx context.Context, logger zLogger.ZLogger, data map[string]string, ...) ocfllogger.OCFLLogger
- func SetupExtensionManager[T extension.ManagerCore[T]](params map[string]string, fsys fs.FS, logger ocfllogger.OCFLLogger) (T, extension.Factory[T], error)
- func ValidateObject(ctx context.Context, objectFS fs.FS, logger ocfllogger.OCFLLogger) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Extract ¶
func Extract(ctx context.Context, objectFS fs.FS, destFS appendfs.FS, path string, version *inventory.VersionNumber, withManifest bool, area string, logger ocfllogger.OCFLLogger) error
Extract retrieves the content of an OCFL object at the specified path and version, and writes it to the destination filesystem (destFS). If version is invalid or empty, the latest version is used. area specifies the storage area (e.g. "content" or "metadata") if applicable.
func ExtractMeta ¶
func ExtractMeta(ctx context.Context, fsys fs.FS, path string, logger ocfllogger.OCFLLogger) (*inventory.Metadata, error)
ExtractMeta retrieves metadata information from an OCFL object at the given path. It returns a pointer to inventory.Metadata containing object details.
func InitObject ¶
func InitObject(ctx context.Context, fsys appendfs.FS, extensionConfigFS fs.FS, ver version.OCFLVersion, id string, digest checksum.DigestAlgorithm, extensionParams map[string]string, logger ocfllogger.OCFLLogger) (object.Object, error)
InitObject initializes a new OCFL object with the given version, id and digest algorithm at fsys.
func InitStorageRoot ¶
func InitStorageRoot(ctx context.Context, fsys appendfs.FS, extensionConfigFS fs.FS, ver version.OCFLVersion, digest checksum.DigestAlgorithm, params map[string]string, logger ocfllogger.OCFLLogger) (storageroot.StorageRoot, error)
InitStorageRoot initializes a new OCFL storage root with the given version at fsys.
func LoadObject ¶
func LoadObject(ctx context.Context, fsys fs.FS, extensionParams map[string]string, logger ocfllogger.OCFLLogger) (object.Object, error)
LoadObject detects the OCFL version of the object at fsys, initializes the extension manager, and loads the object structure. It returns an object.Object instance.
func LoadStorageRoot ¶
func LoadStorageRoot(ctx context.Context, fsys fs.FS, extensionParams map[string]string, conf map[storageroot.ConfigName]any, logger ocfllogger.OCFLLogger) (storageroot.StorageRoot, error)
LoadStorageRoot detects the OCFL version of the storage root at fsys, initializes the extension manager, and loads the storage root structure. The conf parameter allows passing configurations to the storage root factory (e.g. for storage root, initializer or loader). It returns a storageroot.StorageRoot instance.
func NewExtensionFactory ¶
func NewExtensionFactory[T extension.ManagerCore[T]]( params map[string]string, logger ocfllogger.OCFLLogger, ) (extension.Factory[T], error)
func NewFactoryObject ¶
func NewFactoryObject( ver version.OCFLVersion, extensionFactory extension.Factory[object.ExtensionManager], logger ocfllogger.OCFLLogger, ) factory.FactoryObject
NewFactoryObject returns a FactoryObject for the specified OCFL version.
func NewFactoryStorageRoot ¶
func NewFactoryStorageRoot( ver version.OCFLVersion, extensionFactory extension.Factory[storageroot.ExtensionManager], logger ocfllogger.OCFLLogger, ) factory.FactoryStorageRoot
NewFactoryStorageRoot returns a FactoryStorageRoot for the specified OCFL version.
func NewOCFLLogger ¶
func NewOCFLLogger(ctx context.Context, logger zLogger.ZLogger, data map[string]string, ver version.OCFLVersion, validationStatus *validation.Status) ocfllogger.OCFLLogger
func SetupExtensionManager ¶
func SetupExtensionManager[T extension.ManagerCore[T]]( params map[string]string, fsys fs.FS, logger ocfllogger.OCFLLogger, ) (T, extension.Factory[T], error)
SetupExtensionManager initializes an extension factory and loads the extension manager from the provided filesystem. The function uses the type parameter T (usually storageroot.ExtensionManager or object.ExtensionManager) to instantiate the appropriate manager type. It takes configuration parameters, a filesystem containing extension configuration files, and a logger. It is intended to be called once for the storage root and once for objects to manage their respective extensions. Returns the loaded manager, the used factory, and any error encountered.
func ValidateObject ¶
func ValidateObject(ctx context.Context, objectFS fs.FS, logger ocfllogger.OCFLLogger) error
ValidateObject validates an OCFL object located at objectFS. It loads the object and performs structural and fixity checks using the object's validator.
Types ¶
This section is empty.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package extension provides the basic interfaces and structures for OCFL extensions.
|
Package extension provides the basic interfaces and structures for OCFL extensions. |
|
Package factory provides unified factory interfaces for creating OCFL objects and storage roots.
|
Package factory provides unified factory interfaces for creating OCFL objects and storage roots. |
|
Package inventory defines the structures and interfaces for the OCFL (Oxford Common File Layout) Inventory.
|
Package inventory defines the structures and interfaces for the OCFL (Oxford Common File Layout) Inventory. |
|
Package object contains the interfaces and implementations for OCFL objects.
|
Package object contains the interfaces and implementations for OCFL objects. |
|
Package storageroot contains the interfaces and abstractions for managing OCFL (Oxford Common File Layout) storage roots.
|
Package storageroot contains the interfaces and abstractions for managing OCFL (Oxford Common File Layout) storage roots. |
|
Package validation provides structures and functions for handling OCFL validation errors and warnings.
|
Package validation provides structures and functions for handling OCFL validation errors and warnings. |
|
Package version defines the supported OCFL versions and provides utilities for version comparison and specification access.
|
Package version defines the supported OCFL versions and provides utilities for version comparison and specification access. |