public override ResponseMessage Execute(RequestMessage req)
        {
            RemovableIndexRequest r = (RemovableIndexRequest)req;
            bool   to_mount         = r.Mount;
            string index_dir        = r.IndexDir;
            string mnt_dir          = r.MountDir;

            return(QueryDriver.HandleRemovableIndexRequest(to_mount, index_dir, mnt_dir));
        }
Пример #2
0
    private static void UnmountRemovableIndex(string index_dir, string mnt_dir)
    {
        Console.WriteLine("Unloading removable index from '{0}' for '{1}'", index_dir, mnt_dir);

        RemovableIndexRequest req = new RemovableIndexRequest();

        req.Mount    = false;
        req.IndexDir = Path.IsPathRooted(index_dir) ? index_dir : Path.GetFullPath(index_dir);
        req.MountDir = Path.IsPathRooted(mnt_dir) ? mnt_dir : Path.GetFullPath(mnt_dir);

        ResponseMessage resp;

        try {
            resp = req.Send();
        } catch (ResponseMessageException ex) {
            Log.Error("Error in unloading index: {0}", ex.ToString());
            return;
        }

        RemovableIndexResponse res = (RemovableIndexResponse)resp;

        Console.WriteLine("Successfully unloaded '{0}'@{1} from {2}", res.Source, mnt_dir, index_dir);
    }