NAME

WARC::Index::Builder - abstract base class for building indexes

SYNOPSIS

use WARC::Index;

$cdx_builder = build WARC::Index::File::CDX (...);
$sdbm_builder = build WARC::Index::File::SDBM (...);

$cdx_entry = $cdx_builder->add($record);
$sdbm_builder->add($cdx_entry);

DESCRIPTION

WARC::Index::Builder is an abstract base class for constructing indexes on WARC files. The interface is documented here, but implemented in specialized classes for each index type. Some common code has also been moved to this class, and is also documented here.

Methods

$builder->add( ... )

Add items to the growing index. All index types accept both WARC records and entries from other indexes, although only metaindex-capable formats use the latter. Any number of items may be added with a single call.

Returns nothing.

The WARC::Index::Builder base class provides an implementation of this method that dispatches to the internal _add_* methods listed below.

$builder->flush

Write any buffered data to the underlying storage. After calling this method, all records added using this builder should be visible. Some index systems do this implicitly; this method is a no-op in those cases.

Returns nothing.

Internal Methods

$builder->_add_record( $record )

Add one WARC::Record to the index.

$builder->_add_entry( $entry )

Add one WARC::Index::Entry to the index.

The WARC::Index::Builder base class provides a default implementation that adds the corresponding record instead.

$builder->_add_index( $index )

Add all entries from an enumerable index to the index.

The WARC::Index::Builder base class provides a default implementation.

$builder->_add_volume( $volume )

Add all records from a WARC::Volume to the index.

The WARC::Index::Builder base class provides a default implementation.

AUTHOR

Jacob Bachmeyer, <jcb@cpan.org>

SEE ALSO

WARC, WARC::Index

COPYRIGHT AND LICENSE

Copyright (C) 2019 by Jacob Bachmeyer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.