This project has retired. For details please refer to its Attic page.
Lucy::Store::LockFactory – C API Documentation
Apache Lucy™

Lucy::Store::LockFactory

parcel Lucy
class variable LUCY_LOCKFACTORY
struct symbol lucy_LockFactory
class nickname lucy_LockFact
header file Lucy/Store/LockFactory.h

Name

Lucy::Store::LockFactory – Create Locks.

Description

LockFactory is used to spin off interprocess mutex locks used by various index reading and writing components. The default implementation uses lockfiles, but LockFactory subclasses which are implemented using alternatives such as flock() are possible.

Functions

new
lucy_LockFactory* // incremented
lucy_LockFact_new(
    lucy_Folder *folder,
    cfish_String *host
);

Create a new LockFactory.

folder

A Folder.

host

An identifier which should be unique per-machine.

init
lucy_LockFactory*
lucy_LockFact_init(
    lucy_LockFactory *self,
    lucy_Folder *folder,
    cfish_String *host
);

Initialize a LockFactory.

folder

A Folder.

host

An identifier which should be unique per-machine.

Methods

Make_Lock
lucy_Lock* // incremented
lucy_LockFact_Make_Lock(
    lucy_LockFactory *self,
    cfish_String *name,
    int32_t timeout,
    int32_t interval
);

Return a Lock object, which, once Obtain() returns successfully, maintains an exclusive lock on a resource.

name

A file-system-friendly id which identifies the resource to be locked.

timeout

Time in milliseconds to keep retrying before abandoning the attempt to Obtain() a lock.

interval

Time in milliseconds between retries.

Make_Shared_Lock
lucy_Lock* // incremented
lucy_LockFact_Make_Shared_Lock(
    lucy_LockFactory *self,
    cfish_String *name,
    int32_t timeout,
    int32_t interval
);

Return a Lock object for which Shared() returns true, and which maintains a non-exclusive lock on a resource once Obtain() returns success.

name

A file-system-friendly id which identifies the resource to be locked.

timeout

Time in milliseconds to keep retrying before abandoning the attempt to Obtain() a lock.

interval

Time in milliseconds between retries.

Inheritance

Lucy::Store::LockFactory is a Clownfish::Obj.