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

Lucy::Index::Snapshot

parcel Lucy
class variable LUCY_SNAPSHOT
struct symbol lucy_Snapshot
class nickname lucy_Snapshot
header file Lucy/Index/Snapshot.h

Name

Lucy::Index::Snapshot – Point-in-time index file list.

Description

A Snapshot is list of index files and folders. Because index files, once written, are never modified, a Snapshot defines a point-in-time view of the data in an index.

IndexReader objects interpret the data associated with a single Snapshot.

Functions

new
lucy_Snapshot* // incremented
lucy_Snapshot_new(void);

Constructor. Takes no arguments.

init
lucy_Snapshot*
lucy_Snapshot_init(
    lucy_Snapshot *self
);

Initialize a Snapshot.

Methods

List
cfish_Vector* // incremented
lucy_Snapshot_List(
    lucy_Snapshot *self
);

Return an array of all entries.

Num_Entries
uint32_t
lucy_Snapshot_Num_Entries(
    lucy_Snapshot *self
);

Return the number of entries (including directories).

Add_Entry
void
lucy_Snapshot_Add_Entry(
    lucy_Snapshot *self,
    cfish_String *entry
);

Add a filepath to the snapshot.

Delete_Entry
bool
lucy_Snapshot_Delete_Entry(
    lucy_Snapshot *self,
    cfish_String *entry
);

Delete a filepath from the snapshot.

Returns: true if the entry existed and was successfully deleted, false otherwise.

Read_File
lucy_Snapshot*
lucy_Snapshot_Read_File(
    lucy_Snapshot *self,
    lucy_Folder *folder,
    cfish_String *path
);

Decode a snapshot file and initialize the object to reflect its contents.

folder

A Folder.

path

The location of the snapshot file. If not supplied, the most recent snapshot file in the base directory will be chosen.

Returns: the Snapshot object itself

Write_File
void
lucy_Snapshot_Write_File(
    lucy_Snapshot *self,
    lucy_Folder *folder,
    cfish_String *path
);

Write a snapshot file. The caller must lock the index while this operation takes place, and the operation will fail if the snapshot file already exists.

folder

A Folder.

path

The path of the file to write. If NULL, a file name will be chosen which supersedes the latest snapshot file in the index folder.

Set_Path
void
lucy_Snapshot_Set_Path(
    lucy_Snapshot *self,
    cfish_String *path
);

Set the path to the file that the Snapshot object serves as a proxy for.

Get_Path
cfish_String*
lucy_Snapshot_Get_Path(
    lucy_Snapshot *self
);

Get the path to the snapshot file. Initially NULL; updated by Read_File(), Write_File(), and Set_Path().

Inheritance

Lucy::Index::Snapshot is a Clownfish::Obj.