The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
# ***********************************************
# 
# !!!! DO NOT EDIT !!!!
# 
# This file was auto-generated by Build.PL.
# 
# ***********************************************
# 
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

=encoding utf8

=head1 NAME

Lucy::Index::IndexManager - Policies governing index updating, locking, and file deletion.

=head1 SYNOPSIS

    use Sys::Hostname qw( hostname );
    my $hostname = hostname() or die "Can't get unique hostname";
    my $manager = Lucy::Index::IndexManager->new( 
        host => $hostname,
    );

    # Index time:
    my $indexer = Lucy::Index::Indexer->new(
        index => '/path/to/index',
        manager => $manager,
    );

    # Search time:
    my $reader = Lucy::Index::IndexReader->open(
        index   => '/path/to/index',
        manager => $manager,
    );
    my $searcher = Lucy::Search::IndexSearcher->new( index => $reader );

=head1 DESCRIPTION

IndexManager is an advanced-use class for controlling index locking,
updating, merging, and deletion behaviors.

IndexManager and L<Architecture|Lucy::Plan::Architecture> are
complementary classes: Architecture is used to define traits and behaviors
which cannot change for the life of an index; IndexManager is used for
defining rules which may change from process to process.

=head1 CONSTRUCTORS

=head2 new

    my $manager = Lucy::Index::IndexManager->new(
        host => $hostname,    # default: ""
    );

Create a new IndexManager.

=over

=item *

B<host> - An identifier which should be unique per-machine.

=item *

B<lock_factory> - A LockFactory.

=back

=head1 METHODS

=head2 set_folder

    $index_manager->set_folder($folder);
    $index_manager->set_folder();  # default: undef

Setter for C<folder> member.  Typical clients (Indexer,
IndexReader) will use this method to install their own Folder instance.

=head2 get_folder

    my $folder = $index_manager->get_folder();

Getter for C<folder> member.

=head2 get_host

    my $string = $index_manager->get_host();

Getter for C<host> member.

=head2 recycle

    my $arrayref = $index_manager->recycle(
        reader     => $reader,      # required
        del_writer => $del_writer,  # required
        cutoff     => $cutoff,      # required
        optimize   => $optimize,    # default: false
    );

Return an array of SegReaders representing segments that should be
consolidated.  Implementations must balance index-time churn against
search-time degradation due to segment proliferation. The default
implementation prefers small segments or segments with a high
proportion of deletions.

=over

=item *

B<reader> - A PolyReader.

=item *

B<del_writer> - A DeletionsWriter.

=item *

B<cutoff> - A segment number which all returned SegReaders must
exceed.

=item *

B<optimize> - A boolean indicating whether to spend extra time
optimizing the index for search-time performance.

=back

=head2 make_write_lock

    my $lock = $index_manager->make_write_lock();

Create the Lock which controls access to modifying the logical content
of the index.

=head2 set_write_lock_timeout

    $index_manager->set_write_lock_timeout($timeout);

Setter for write lock timeout.  Default: 1000 milliseconds.

=head2 get_write_lock_timeout

    my $int = $index_manager->get_write_lock_timeout();

Getter for write lock timeout.

=head2 set_write_lock_interval

    $index_manager->set_write_lock_interval($timeout);

Setter for write lock retry interval.  Default: 100 milliseconds.

=head2 get_write_lock_interval

    my $int = $index_manager->get_write_lock_interval();

Getter for write lock retry interval.

=head1 INHERITANCE

Lucy::Index::IndexManager isa Clownfish::Obj.

=cut