-
-
04 Jul 2009 01:44:17 UTC
- Development release
- Distribution: KinoSearch
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (5)
- Testers (13 / 3 / 1)
- Kwalitee
Bus factor: 0- License: perl_5
- Activity
24 month- Tools
- Download (611.03KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Marvin Humphrey <marvin at rectangular dot com>
- Dependencies
- JSON::XS
- Lingua::Stem::Snowball
- Lingua::StopWords
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
KinoSearch::Store::SharedLock - Shared (read) lock.
SYNOPSIS
my $lock_factory = KinoSearch::Store::LockFactory->new( folder => $folder, agent_id => $hostname, ); my $shlock = $lock_factory->make_shared_lock( lock_name => 'snapshot_6r', timeout => 5000, );
DESCRIPTION
SharedLock's interface is nearly identical to that of its parent class KinoSearch::Store::Lock, taking the same constructor arguments and implementing the same list of methods. It differs from Lock only in the semantics of two methods.
First, obtain() will not fail if another lock is held against the resource identified by
lock_name
(though it might fail for other reasons).Second, is_locked() returns true so long as some lock, somewhere is holding a lock on
lock_name
. That lock could be this instance, or it could be another -- so is entirely possible to call release() successfully on a SharedLock object yet still have is_locked() return true.As currently implemented, SharedLock differs from Lock in that each caller gets its own lockfile. Lockfiles still have filenames which begin with the lock name and end with ".lock", but each is also assigned a unique number which gets pasted between: "foo-44.lock" instead of "foo.lock". A SharedLock is considered fully released when no lock files with a given lock name are left.
CONSTRUCTORS
new( [labeled params] )
my $shlock = KinoSearch::Store::SharedLock->new( lock_name => 'commit', # required timeout => 5000, # default: 0 folder => $folder, # required agent_id => $hostname, # required );
folder - The KinoSearch::Store::Folder where the lock file will reside.
lock_name - String identifying the resource to be locked.
agent_id - A per-machine identifier, usually the host name.
timeout - Time in milliseconds to keep retrying before abandoning the attempt to obtain() a lock.
INHERITANCE
KinoSearch::Store::SharedLock isa KinoSearch::Store::Lock isa KinoSearch::Obj.
COPYRIGHT
Copyright 2005-2009 Marvin Humphrey
LICENSE, DISCLAIMER, BUGS, etc.
See KinoSearch version 0.30.
Module Install Instructions
To install KSx::Simple, copy and paste the appropriate command in to your terminal.
cpanm KSx::Simple
perl -MCPAN -e shell install KSx::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.