Project

orchard

0.0
No commit activity in last 3 years
No release in over 3 years
Orchard translates id strings to/from Pairtree paths for use with Pairtree file repositories.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Orchard is a Ruby library for working with Pairtrees, a filesystem hierarchy mapping identifiers to object directories.

More information can be found at:

Pairtrees for Object Storage
https://confluence.ucop.edu/display/Curation/PairTree

Orchard requires Ruby 1.9.

Install¶ ↑

gem install orchard

Usage Examples¶ ↑

Encoding/decoding strings according to the Pairtree specification¶ ↑
Orchard::Pairtree.encode('ark:/13030/xt12t3')
# => ark+=13030=xt12t3

Orchard::Pairtree.decode('ark+=13030=xt12t3')
# => ark:/13030/xt12t3
Converting IDs to pairpaths and pairpaths to IDs¶ ↑
Orchard::Pairtree.id_to_ppath('ark:/13030/xt12t3')
# => ar/k+/=1/30/30/=x/t1/2t/3

Orchard::Pairtree.ppath_to_id('ar/k+/=1/30/30/=x/t1/2t/3')
# => ark:/13030/xt12t3
Iterating through a Pairtree for processing¶ ↑
Orchard::Pairtree.iterate('repo/pairtree_root/', {:raise_errors => true}) do |path|
  puts path
end
# => /absolute_path/repo/pairtree_root/ab/cd/e/object
...
# => /absolute_path/repo/pairtree_root/xy/z/object

Thanks¶ ↑

Erik Hetzner for contributions.
Ben O'Steen (this module is a semi-port of his Python Pairtree module, http://github.com/benosteen/pairtree)