The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
/* 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.
 */

parcel Lucy;

/** File System implementation of Folder.
 *
 * Implementation of [](cfish:Folder) using a single file system
 * directory and multiple files.
 */

public class Lucy::Store::FSFolder inherits Lucy::Store::Folder {

    /** Create a new Folder.
     *
     * @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 incremented FSFolder*
    new(String *path);

    /** Initialize a Folder.  See [](.new) for a description of the
     * parameters.
     */
    public inert FSFolder*
    init(FSFolder *self, String *path);

    /** Attempt to create the directory specified by `path`.
     */
    void
    Initialize(FSFolder *self);

    /** Verify that `path` is a directory.  TODO: check
     * permissions.
     */
    bool
    Check(FSFolder *self);

    void
    Close(FSFolder *self);

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

    incremented nullable DirHandle*
    Local_Open_Dir(FSFolder *self);

    bool
    Local_MkDir(FSFolder *self, String *name);

    bool
    Local_Exists(FSFolder *self, String *name);

    bool
    Local_Is_Directory(FSFolder *self, String *name);

    nullable Folder*
    Local_Find_Folder(FSFolder *self, String *name);

    bool
    Local_Delete(FSFolder *self, String *name);

    bool
    Rename(FSFolder *self, String* from, String *to);

    bool
    Hard_Link(FSFolder *self, String *from, String *to);
}