gocfl is a high-performance Go library for the Oxford Common Filesystem Layout (OCFL). It focuses on the creation, update, validation, and extraction of OCFL Storage Roots and Objects, with a strong emphasis on extensibility, I/O efficiency, and technical metadata indexing.
Note: This repository contains the
gocfllibrary. For the command-line interface, please refer to the gocfl-cli repository.
- OCFL Support: Full support for OCFL v1.0 and v1.1, with experimental support for v2.0.
- Storage Backends:
- Local Filesystem
- S3 Cloud Storage (via MinIO Client SDK)
- Serialization into ZIP Containers (with optional AES Encryption)
- High Performance:
- Optimized I/O: Files are read and written as few times as possible.
- Concurrent checksum generation and processing.
- Extensibility: Implements a flexible extension hook system (7 different hooks) for both Storage Root and Object extensions.
- Advanced Capabilities:
- Technical metadata extraction and indexing.
- File format migration.
- Thumbnail generation.
- METS/PREMIS generation.
go get github.com/ocfl-archive/gocfl/v3The library uses a Unified Factory pattern to ensure consistency across different OCFL versions.
import (
"context"
"github.com/ocfl-archive/gocfl/v3/pkg/ocfl/factory/factoryimpl"
"github.com/ocfl-archive/gocfl/v3/pkg/ocfl/version"
"github.com/ocfl-archive/gocfl/v3/pkg/ocfllogger"
"github.com/je4/filesystem/v3/pkg/vfs"
)
ctx := context.Background()
logger := ocfllogger.NewNopLogger() // Replace with actual logger
// Create a factory for OCFL 1.1
fact := factoryimpl.NewFactory(version.Version1_1, nil, logger)
// Initialize a storage root
sr := fact.NewStorageRoot(ctx)
// ... configure storage root with FS and extensions ...- 0001-digest-algorithms
- 0002-flat-direct-storage-layout
- 0003-hash-and-id-n-tuple-storage-layout
- 0004-hashed-n-tuple-storage-layout
- 0006-flat-omit-prefix-storage-layout
- 0007-n-tuple-omit-prefix-storage-layout
- NNNN-mets: Generation of METS and PREMIS files.
- NNNN-indexer: Technical metadata extraction.
- NNNN-migration: Automatic file format migration on ingest.
- NNNN-thumbnail: Generation of thumbnails for video, images, and PDFs.
- NNNN-filesystem: Preserves filesystem metadata.
- NNNN-pairtree-storage-layout: Support for pairtree layouts.
- NNNN-gocfl-extension-manager: Internal manager for extension execution order.
GOCFL is licensed under the Apache License, Version 2.0. See LICENSE for details.