Documentation ¶
Overview ¶
Package ocfl defines an API for interacting with content in an OCFL repository.
Access to OCFL content is provided by one of more Driver implementations. Drivers may interact with a local filesystem, s3, a relational database for quick/indexed lookup, etc. See individual driver documentation under drivers/ for more information.
Index ¶
Constants ¶
const ( NEW = "new" HEAD = "" )
OCFL version name constants, used in configuring ocfl.Options
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommitInfo ¶
type CommitInfo struct { Name string // User name Address string // Some sort of identifier - e-mail, URL, etc Message string // Freeform text Date time.Time }
CommitInfo defines informative text to be included when committing an OCFL version
type EntityRef ¶
type EntityRef struct { ID string // The logical ID of the entity (string, uri, or relative file path) Addr string // Physical address of the entity (absolute file path or URI) Parent *EntityRef // Parent of next highest type that isn't an intermediate node (e.g. object parent is root) Type Type // Type of entity }
EntityRef represents a single OCFL entity.
type Options ¶
type Options struct { Create bool // If true, this will create a new object if one does not exist. Version string // Desired version, default (zero value) ocfl.HEAD }
Options for establishing a read/write session on an OCFL object.
A given session is scoped to a single version of an OCFL object. That version may be one that already exists, or a uncommitted version. Constants ocfl.NEW and ocfl.HEAD are intended to be used with the Version field in order to specify the head version regardless of name, or an auto-named new version. Otherwise, provide the name of an existing version to access its contents.
type Select ¶
type Select struct { Type Type // Desired OCFL type Head bool // True if desired files or versions must be in the head revision }
Select indicates desired properties of matching OCFL entities
type Session ¶
type Session interface { Put(lpath string, r io.Reader) error // Put file content at the given logical path Delete(lpath string) error // TODO: Move(src, dest string) error // TODO: Read(lpath string) (io.Reader, error) Commit(CommitInfo) error }
Session allows reading or writing to the an OCFL object.
Each session is bound to a single OCFL object version; either a pre-existing version, or an uncommitted new version. New versions contain the content of the previous version as a starting point. Drivers may or may not allow writes/commits to existing versions.
type Type ¶
type Type int
Type names a kind of OCFL entity
OCFL entity type constants, ordered by specificity, e.g. Root > Object
type Walker ¶
Walker crawls through a bounded scope of OCFL entities "underneath" a start location. Given a location and a desired type, Walker will invoke the provided callback any time an entity of the desired type is encountered.
The walk location may either be a single physical address (such as a file path or URI), or it may be a sequence of logical OCFL identifiers, such as {objectID, versionID, logicalFilePath} When providing logical identifiers, object IDs may be provided on their own, version IDs must be preceded by an object ID, and logical file paths must be preceded by the version ID.
If no location is given, the scope of the walk is implied to be the entirety of content under an OCFL root.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
drivers
|
|
fs
Package fs contains an OCFL filesystem driver, intended for reading and writing OCFL present on physical filesystems
|
Package fs contains an OCFL filesystem driver, intended for reading and writing OCFL present on physical filesystems |
Package metadata contains facilities for working with OCFL object metadata.
|
Package metadata contains facilities for working with OCFL object metadata. |