Skip to content

ocfl-archive/gocfl

Repository files navigation

GOCFL - Go OCFL Library

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 gocfl library. For the command-line interface, please refer to the gocfl-cli repository.

Features

  • 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.

Installation

go get github.com/ocfl-archive/gocfl/v3

Basic Usage

The library uses a Unified Factory pattern to ensure consistency across different OCFL versions.

Initializing a Storage Root

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 ...

Supported Extensions

Community Extensions

Local & Special Extensions

  • 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.

Documentation

License

GOCFL is licensed under the Apache License, Version 2.0. See LICENSE for details.

About

Go OCFL Implementation

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors