The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
parcel KinoSearch cnick Kino;

/** File System implementation of Folder.
 *
 * Implementation of L<KinoSearch::Store::Folder> using a single file system
 * directory and multiple files.
 */

class KinoSearch::Store::FSFolder inherits KinoSearch::Store::Folder {

    inert incremented FSFolder*
    new(const CharBuf *path);

    /**
     * @param path Location of the index. If the specified directory does
     * not exist already, it will NOT be created, in order to prevent
     * misconfigured read applications from spawning bogus files -- so it may
     * be necessary to create the directory yourself.
     */
    public inert FSFolder*
    init(FSFolder *self, const CharBuf *path);

    /** Attempt to create the directory specified by <code>path</code>.
     */
    public void
    Initialize(FSFolder *self);

    /** Verify that <code>path</code> is a directory.  TODO: check
     * permissions.
     */
    public bool_t
    Check(FSFolder *self);

    public void
    Close(FSFolder *self);

    incremented nullable FileHandle*
    Local_Open_FileHandle(FSFolder *self, const CharBuf *name, 
                          uint32_t flags);

    incremented nullable DirHandle*
    Local_Open_Dir(FSFolder *self);

    bool_t 
    Local_MkDir(FSFolder *self, const CharBuf *name);

    bool_t
    Local_Exists(FSFolder *self, const CharBuf *name);

    bool_t
    Local_Is_Directory(FSFolder *self, const CharBuf *name);

    nullable Folder*
    Local_Find_Folder(FSFolder *self, const CharBuf *name);

    bool_t 
    Local_Delete(FSFolder *self, const CharBuf *name);

    public bool_t 
    Rename(FSFolder *self, const CharBuf* from, const CharBuf *to);

    public bool_t
    Hard_Link(FSFolder *self, const CharBuf *from, const CharBuf *to);

    /** Transform a relative path into an abolute path.
     */
    inert incremented CharBuf*
    absolutify(const CharBuf *path);
}

/* Copyright 2006-2011 Marvin Humphrey
 *
 * This program is free software; you can redistribute it and/or modify
 * under the same terms as Perl itself.
 */