Categorygithub.com/srerickson/ocfl-go
modulepackage
0.4.0
Repository: https://github.com/srerickson/ocfl-go.git
Documentation: pkg.go.dev

# README

An OCFL implementation for Go

godocs

This Go module provide an implementation of the Oxford Common File Layout (OCFL).

[!WARNING]
The API is under heavy development and will have constant breaking changes.

Development

Requires Go >= v1.23.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package [ocflv1] provides an implementation of OCFL v1.0 and v1.1.

# Functions

ConcurrentDigest concurrently digests files in an FS.
Copy copies src in srcFS to dst in dstFS.
Digest is equivalent to ConcurrentDigest with the number of digest workers set to runtime.NumCPU().
DirFS is shorthand for NewFS(os.DirFS(dir)).
Files returns an iterator function that yields name/error pairs for each file in dir and its subdirectories.
FindNamaste returns the NAMASTE declaration from a fs.DirEntry slice.
No description provided by the author
No description provided by the author
InitRoot returns a RootOption for initializing a new storage root as part of the call to NewRoot().
No description provided by the author
No description provided by the author
MustParseVNum parses str as a VNUm and returns a new VNum.
NewFS wraps an io/fs.FS as an ocfl.FS.
NewObject returns an *Object for managing the OCFL object at path in fsys.
NewObjectValidation constructs a new *Validation with the given options.
NewRoot returns a new *Root for working with the OCFL storage root at directory dir in fsys.
No description provided by the author
ObjectPaths searches dir in fsys (and its subdirectories) for OCFL object declarations and returns an iterator that yields each object path it finds.
No description provided by the author
ParseObjectDir returns a new ObjectState based on contents of an object root directory.
ParseVNum parses string as an a VNum and sets the value referenced by vn.
No description provided by the author
No description provided by the author
No description provided by the author
Remove returns a RemapFunc that removes name.
Rename returns a RemapFunc that renames from to to.
SetXferConcurrency sets the maximum number of files transferred concurrently during a commit operation.
StageBytes builds a stage from a map of filenames to file contents.
StageDir builds a stage based on the contents of the directory dir in FS.
No description provided by the author
V returns a new Vnum.
ValidateInventorySidecar reads the inventory sidecar with inv's digest algorithm (e.g., inventory.json.sha512) in directory dir and return an error if the sidecar content is not formatted correctly or if the inv's digest doesn't match the value found in the sidecar.
ValidateNamaste validates a namaste declaration.
ValidateObject fully validates the OCFL Object at dir in fsys.
ValidationAlgorithms sets registry of available digest algorithms for fixity validation.
ValidationDigestConcurrency is used to set the number of go routines used to read and digest contents during validation.
ValidationLogger sets the *slog.Logger that should be used for logging validation errors and warnings.
No description provided by the author
No description provided by the author
No description provided by the author
XferConcurrency is a global configuration for the maximum number of files transferred concurrently during a commit operation.

# Constants

No description provided by the author
HasExtensions indicates that an object root includes a directory named "extensions".
HasInventory indicates that an object root includes an "inventory.json" file.
HasLogs indicates that an object root includes a directory named "logs".
HasNamaste indicates that an object root directory includes a NAMASTE object declaration file.
HasSidecar indicates that an object root includes an "inventory.json.*" file (the inventory sidecar).
No description provided by the author
type string for OCFL Object declaration.
type string for OCFL Storage Root declaration.
No description provided by the author
No description provided by the author
package version.

# Variables

No description provided by the author
Error: invalid contents of inventory sidecar file.
No description provided by the author
ErrMapMakerExists is returned when calling Add with a path and digest that are already present in the MapMaker.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Some functions in this package use the zero value VNum to indicate the most recent, "head" version.

# Structs

Commit represents an update to object.
Commit error wraps an error from a commit.
No description provided by the author
FileInfo provides path and size information for a file in an OCFL context.
InvType represents an inventory type string for example: https://ocfl.io/1.0/spec/#inventory.
MapDigestConflictErr indicates same digest found multiple times in the digest map (i.e., with different cases).
MapPathConflictErr indicates a path appears more than once in the digest map.
MapPathInvalidErr indicates an invalid path in a Map.
Namaste represents a NAMASTE declaration.
Object represents and OCFL Object, typically contained in a Root.
ObjectState provides details of an OCFL object root based on the names of files and directories in the object's root.
ObjectValidation is used to configure and track results from an object validation process.
No description provided by the author
No description provided by the author
PathDigests represent on or more computed digests for a file in an FS.
Root represents an OCFL Storage Root.
Stage is used to create/update objects.
User is a generic user information struct.
Validation represents multiple fatal errors and warning errors.
ValidationCode represents a validation error code defined in an OCFL specification.
ValidationError is an error that includes a reference to a validation error code from the OCFL spec.
VNum represents an OCFL object version number (e.g., "v1", "v02").

# Interfaces

ContentSource is used to access content with a given digest when creating and upadting objects.
CopyFS is a storage backend that supports copying files.
FilesFS is used to iterate over regular files in a directory and its sub-directories.
FixitySource is used to access alternate digests for content with a given digest (sha512 or sha256) when creating or updating objects.
FS is a minimal, read-only storage layer abstraction.
No description provided by the author
OCFL is an interface implemented by types that implement a specific version of the OCFL specification.
No description provided by the author
No description provided by the author
WriteFS is a storage backend that supports write and remove operations.

# Type aliases

DigestMap maps digests to file paths.
FileSeq is an interator returned by Files(), that yields FileInfo values.
No description provided by the author
No description provided by the author
PathMap maps filenames to digest strings.
RemapFunc is a function used to transform a DigestMap.
No description provided by the author
Spec represent an OCFL specification number.
VNums is a slice of VNum elements.