MoveIndexRequest

Namespace: Algolia.Search
We found 6 examples in language CSharp for this search. You will see 21 fragments of code.

Other methods

/*
* Copyright (c) 2018 Algolia
* http://www.algolia.com/
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

namespace Algolia.Search.Models.Common
{
    /// <summary>
    /// Move index request
    /// </summary>
    public class MoveIndexRequest
    {
        /// <summary>
        /// Operation <see cref="Enums.MoveType"/>
        /// </summary>
        public string Operation { get; set; }

        /// <summary>
        /// Index destination name
        /// </summary>
        public string Destination { get; set; }
    }
}

/*
* Copyright (c) 2018 Algolia
* http://www.algolia.com/
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

namespace Algolia.Search.Models.Common
{
    /// <summary>
    /// Move index request
    /// </summary>
    public class MoveIndexRequest
    {
        /// <summary>
        /// Operation <see cref="Enums.MoveType"/>
        /// </summary>
        public string Operation { get; set; }

        /// <summary>
        /// Index destination name
        /// </summary>
        public string Destination { get; set; }
    }
}

/*
* Copyright (c) 2018 Algolia
* http://www.algolia.com/
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

namespace Algolia.Search.Core.Models.Common
{
    /// <summary>
    /// Move index request
    /// </summary>
    public class MoveIndexRequest
    {
        /// <summary>
        /// Operation <see cref="Enums.MoveType"/>
        /// </summary>
        public string Operation { get; set; }

        /// <summary>
        /// Index destination name
        /// </summary>
        public string Destination { get; set; }
    }
}


        private void initialise(long cabContractMaxReceivedMessageSize)
        {
            m_SyncCompleteEvent = new AutoResetEvent(false);
            m_SyncStartEvent = new AutoResetEvent(false);
            m_SyncProgressEvent = new AutoResetEvent(false);
            m_BugReportProgressEvent = new AutoResetEvent(false);
            m_MoveCompleteEvent = new AutoResetEvent(false);
            m_CopyCompleteEvent = new AutoResetEvent(false);
            m_AnalyzeCompleteEvent = new AutoResetEvent(false);
            m_RunScriptCompleteEvent = new AutoResetEvent(false);
            m_LogOnCompleteEvent = new AutoResetEvent(false);
            m_DownloadCabCompleteEvent = new AutoResetEvent(false);
            m_UploadMappingFileCompleteEvent = new AutoResetEvent(false);
            m_RunBugReportCompleteEvent = new AutoResetEvent(false);
            m_ApplicationGuid = Guid.NewGuid();

            // These objects will be used to call the service.
            m_ServiceProxyControl = new ServiceProxyControl(@"net.tcp://localhost:9000/StackHash/", @"host/localhost", cabContractMaxReceivedMessageSize);
            m_ServiceProxyControl.AdminReport += new EventHandler<AdminReportEventArgs>(this.AdminReportCallback);

            m_AllReports = new Collection<AdminReportEventArgs>();
            m_AllActivationReports = new Collection<AdminReportEventArgs>();
            m_AdminReportEvent = new AutoResetEvent(false);
            m_BugReportProgressReports = new List<StackHashAdminReport>();

        }



        /// <summary>
        /// Invoked when an admin report arrives. 
        /// </summary>
        /// <param name="sender">Object invoking this delegate.</param>
        /// <param name="e">Callback events.</param>
        public  void AdminReportCallback(object sender, AdminReportEventArgs e)
        {
            // Dump the report to the windows.
            String outString = string.Format("{0} {1}",
                e.Report.Operation.ToString(), e.Report.ResultData.ToString());

            if (e.Report.LastException != null)
            {
                outString += e.Report.LastException.ToString();
            }

            Console.WriteLine(outString);

            if (e.Report.Operation == StackHashAdminOperation.WinQualSyncCompleted)
            {
                StackHashWinQualSyncCompleteAdminReport report = e.Report as StackHashWinQualSyncCompleteAdminReport;
                if (report.ErrorIndexStatistics == null)
                    report.ErrorIndexStatistics = new StackHashSynchronizeStatistics();

                // Dump the stats.
                outString = string.Format("{0}:{1}:{2}:{3}:{4}", report.ErrorIndexStatistics.Products,
                    report.ErrorIndexStatistics.Files, report.ErrorIndexStatistics.Events, report.ErrorIndexStatistics.EventInfos,
                    report.ErrorIndexStatistics.Cabs);
                Console.WriteLine(outString);

                m_WinQualSyncAdminReport = e.Report;

                m_SyncCompleteEvent.Set();
            }
            else if (e.Report.Operation == StackHashAdminOperation.WinQualSyncStarted)
            {
                m_SyncStartEvent.Set();
            }
            else if (e.Report.Operation == StackHashAdminOperation.WinQualSyncProgressDownloadingProductList)
            {
                m_SyncProgressEvent.Set();
            }
            else if (e.Report.Operation == StackHashAdminOperation.BugReportProgress)
            {
                m_BugReportProgressEvent.Set();
                m_BugReportProgressReports.Add(e.Report);
            }
            else if (e.Report.Operation == StackHashAdminOperation.ErrorIndexMoveCompleted)
            {
                m_MoveCompleteAdminReport = e.Report;

                m_MoveCompleteEvent.Set();
            }
            else if (e.Report.Operation == StackHashAdminOperation.AnalyzeCompleted)
            {
                m_AnalyzeCompleteAdminReport = e.Report;

                m_AnalyzeCompleteEvent.Set();
            }
            else if (e.Report.Operation == StackHashAdminOperation.RunScriptStarted)
            {
                m_RunScriptStartedAdminReport = e.Report;
            }
            else if (e.Report.Operation == StackHashAdminOperation.RunScriptCompleted)
            {
                m_RunScriptAdminReport = e.Report;

                m_RunScriptCompleteEvent.Set();
            }
            else if (e.Report.Operation == StackHashAdminOperation.WinQualLogOnCompleted)
            {
                m_WinQualLogOnAdminReport = e.Report;

                m_LogOnCompleteEvent.Set();
            }
            else if (e.Report.Operation == StackHashAdminOperation.DownloadCabCompleted)
            {
                m_DownloadCabAdminReport = e.Report;

                m_DownloadCabCompleteEvent.Set();
            }
            else if (e.Report.Operation == StackHashAdminOperation.UploadFileCompleted)
            {
                m_UploadMappingFileCompleteEvent.Set();
                m_UploadMappingFileAdminReport = e.Report;
            }
            else if (e.Report.Operation == StackHashAdminOperation.BugReportCompleted)
            {
                m_RunBugReportCompleteEvent.Set();
            }
            else if (e.Report.Operation == StackHashAdminOperation.ErrorIndexCopyCompleted)
            {
                m_CopyCompleteAdminReport = e.Report;

                m_CopyCompleteEvent.Set();
            }

            if (e.Report.Operation == StackHashAdminOperation.ContextStateChanged)
            {
                m_AllActivationReports.Add(e);
            }
            else
            {
                m_AllReports.Add(e);
                m_AdminReportEvent.Set();
            }

            Assert.AreNotEqual(null, e.Report.ServiceGuid);
            Assert.AreEqual(Environment.MachineName, e.Report.ServiceHost);
        }


        public StackHashTaskStatus FindTaskStatus(StackHashTaskStatusCollection collection, StackHashTaskType taskType)
        {
            foreach (StackHashTaskStatus taskStatus in collection)
            {
                if (taskStatus.TaskType == taskType)
                    return taskStatus;
            }

            return null;
        }

        public GetStackHashPropertiesResponse GetContextSettings()
        {
            // Make sure it has been added and is inactive.
            GetStackHashPropertiesRequest request = new GetStackHashPropertiesRequest();
            request.ClientData = DefaultClientData;

            GetStackHashPropertiesResponse resp =
                m_ServiceProxyControl.StackHashAdminClient.GetStackHashSettings(request);


            Assert.AreEqual(StackHashServiceResult.Success, resp.ResultData.Result);
            Assert.AreEqual(null, resp.ResultData.LastException);

            return resp;
        }

        public GetDataCollectionPolicyResponse GetDataCollectionPolicy(int contextId, StackHashCollectionObject RootObject, int id, bool getAll, StackHashCollectionObject conditionObject, StackHashCollectionObject objectToCollect)
        {
            GetDataCollectionPolicyRequest request = new GetDataCollectionPolicyRequest();
            request.ClientData = DefaultClientData;
            request.ContextId = contextId;
            request.RootObject = RootObject;
            request.ConditionObject = conditionObject;
            request.ObjectToCollect = objectToCollect;
            request.Id = id;
            request.GetAll = getAll;

            GetDataCollectionPolicyResponse resp =
                m_ServiceProxyControl.StackHashAdminClient.GetDataCollectionPolicy(request);


            Assert.AreEqual(StackHashServiceResult.Success, resp.ResultData.Result);
            Assert.AreEqual(null, resp.ResultData.LastException);

            return resp;
        }

        
        public GetActiveDataCollectionPolicyResponse GetActiveDataCollectionPolicy(int contextId, int ProductId, int FileId, int EventId, int CabId)
        {
            GetActiveDataCollectionPolicyRequest request = new GetActiveDataCollectionPolicyRequest();
            request.ClientData = DefaultClientData;
            request.ContextId = contextId;
            request.ProductId = ProductId;
            request.FileId = FileId;
            request.EventId = EventId;
            request.CabId = CabId;
            request.ObjectToCollect = StackHashCollectionObject.Cab;

            GetActiveDataCollectionPolicyResponse resp =
                m_ServiceProxyControl.StackHashAdminClient.GetActiveDataCollectionPolicy(request);


            Assert.AreEqual(StackHashServiceResult.Success, resp.ResultData.Result);
            Assert.AreEqual(null, resp.ResultData.LastException);

            return resp;
        }

        /// <summary>
        /// Callback from the service to the client informing of progress.
        /// </summary>
        /// <param name="adminReport">Info about async operation status.</param>
        [OperationContract(IsOneWay = true)]
        void AdminProgressEvent(StackHashAdminReport adminReport);
        /// <summary>
        /// Register for admin notification events. You will recieve notification of all 
        /// asynchronous events from the service.
        /// Upon Registration an AdminRegister event will be sent to the callback. Note that the
        /// event may arrive at the client some time after the client has returned from the call to RegisterForNotifications
        /// because the RegisterForNotifications call IsOneWay.
        /// No event is sent upon de-registration.
        /// This function is ONE-WAY because it calls back to the client. This would cause a deadlock
        /// if not one way.
        /// </summary>
        /// <param name="requestData">Request parameters</param>
        [OperationContract(IsOneWay = true)]
        void RegisterForNotifications(RegisterRequest requestData);

        /// <summary>
        /// Gets the settings associated with a particular context (profile).
        /// </summary>
        /// <param name="requestData">Request parameters</param>
        /// <returns>Response data</returns>
        [OperationContract]
        [FaultContract(typeof(ReceiverFaultDetail))]
        [FaultContract(typeof(SenderFaultDetail))]
        RestartResponse Restart(RestartRequest requestData);

        /// <summary>
        /// Checks the client version against the service version.
        /// </summary>
        /// <param name="requestData">Request parameters</param>
        /// <returns>Response data</returns>
        [OperationContract]
        [FaultContract(typeof(ReceiverFaultDetail))]
        [FaultContract(typeof(SenderFaultDetail))]
        CheckVersionResponse CheckVersion(CheckVersionRequest requestData);


        /// <summary>
        /// Tests the database connection for a particular context.
        /// </summary>
        /// <param name="requestData">Request parameters</param>
        /// <returns>Response data</returns>
        [OperationContract]
        [FaultContract(typeof(ReceiverFaultDetail))]
        [FaultContract(typeof(SenderFaultDetail))]
        TestDatabaseConnectionResponse TestDatabaseConnection(TestDatabaseConnectionRequest requestData);

        
        /// <summary>
        /// Deletes the index associated with the specified context.
        /// </summary>
        /// <param name="requestData">Request parameters</param>
        /// <returns>Response data</returns>
        [OperationContract]
        [FaultContract(typeof(ReceiverFaultDetail))]
        [FaultContract(typeof(SenderFaultDetail))]
        DeleteIndexResponse DeleteIndex(DeleteIndexRequest requestData);


        #endregion Fields

        #region Registration

        /// <summary>
        /// Called to notify ALL clients of an event.
        /// </summary>
        /// <param name="adminReport">The report to send.</param>
        /// <param name="sendToAll">True - send to all clients. False send to specific client.</param>
        [SuppressMessage("Microsoft.Design", "CA1031")]
        public static void OnAdminNotification(StackHashAdminReport adminReport, bool sendToAll)
        {
            if (adminReport == null)
                throw new ArgumentNullException("adminReport");

            adminReport.ServiceGuid = StaticObjects.TheStaticObjects.TheController.ServiceGuid;
            adminReport.ServiceHost = Environment.MachineName;

            if (!sendToAll)
            {
                IAdminNotificationEvents eventHandler = null;

                Monitor.Enter(s_AdminCallbacks);
                try
                {
                    if (s_AdminCallbacks.ContainsKey(adminReport.ClientData.ApplicationGuid))
                    {
                        eventHandler = s_AdminCallbacks[adminReport.ClientData.ApplicationGuid].ClientCallback;
                    }
                }
                finally
                {
                    Monitor.Exit(s_AdminCallbacks);
                }

                if (eventHandler != null)
                {
                    try
                    {
                        eventHandler.AdminProgressEvent(adminReport);
                    }
                    catch (System.Exception)
                    {
                        Monitor.Enter(s_AdminCallbacks);
                        try
                        {
                            if (s_AdminCallbacks.ContainsKey(adminReport.ClientData.ApplicationGuid))
                                s_AdminCallbacks.Remove(adminReport.ClientData.ApplicationGuid);
                        }
                        finally
                        {
                            Monitor.Exit(s_AdminCallbacks);
                        }
                    }
                }

            }
            else
            {
                List<KeyValuePair<Guid, RegisteredClient>> oldObjects = new List<KeyValuePair<Guid, RegisteredClient>>();
                List<KeyValuePair<Guid, RegisteredClient>> callbacks = new List<KeyValuePair<Guid, RegisteredClient>>();

                Monitor.Enter(s_AdminCallbacks);
                try
                {
                    // Make a copy of the callbacks.
                    foreach (KeyValuePair<Guid, RegisteredClient> obj in s_AdminCallbacks)
                    {
                        callbacks.Add(obj);
                    }
                }
                finally
                {
                    Monitor.Exit(s_AdminCallbacks);
                }

                foreach (KeyValuePair<Guid, RegisteredClient> obj in callbacks)
                {
                    try
                    {
                        obj.Value.ClientCallback.AdminProgressEvent(adminReport);
                    }
                    catch (System.Exception ex)
                    {
                        DiagnosticsHelper.LogException(DiagSeverity.Warning, "On Admin Notification", ex);
                        ; // Ignore - the connection may have gone down.
                        oldObjects.Add(obj);
                    }
                }

                foreach (KeyValuePair<Guid, RegisteredClient> obj in oldObjects)
                {
                    Monitor.Enter(s_AdminCallbacks);

                    try
                    {
                        if (s_AdminCallbacks.ContainsKey(obj.Key))
                        {
                            // Remove the callback from the list.
                            s_AdminCallbacks.Remove(obj.Key);
                        }
                    }
                    finally
                    {
                        Monitor.Exit(s_AdminCallbacks);
                    }
                }
            }
        }

        /// <summary>
        /// Determines if the specified user is registered or not.
        /// A user may be logged in on several machines (clients).
        /// </summary>
        /// <param name="clientName">Name of the user.</param>
        /// <returns>True - user logged in, False - user not logged in.</returns>
        private static bool isUserRegistered(String clientName)
        {
            Monitor.Enter(s_AdminCallbacks);

            try
            {
                foreach (KeyValuePair<Guid, RegisteredClient> obj in s_AdminCallbacks)
                {
                    if (obj.Value.ClientData.ClientName == clientName)
                        return true;
                }
                return false;
            }
            finally
            {
                Monitor.Exit(s_AdminCallbacks);
            }            
        }

        private static StackHashClientLicenseUsageCollection getClientData()
        {
            StackHashClientLicenseUsageCollection clientUsageData = new StackHashClientLicenseUsageCollection();

            Monitor.Enter(s_AdminCallbacks);

            try
            {
                foreach (KeyValuePair<Guid, RegisteredClient> obj in s_AdminCallbacks)
                {
                    StackHashClientLicenseUsage clientData = new StackHashClientLicenseUsage();
                    clientData.ClientData = obj.Value.ClientData;
                    clientData.ClientConnectTime = obj.Value.FirstRegisteredTime;
                    clientData.LastAccessTime = obj.Value.LastAccessTime;
                    clientUsageData.Add(clientData);
                }

                return clientUsageData;
            }
            finally
            {
                Monitor.Exit(s_AdminCallbacks);
            }            
        }


        /// <summary>
        /// Determines if the specified client is registered.
        /// </summary>
        /// <param name="clientGuid">ID of the client.</param>
        /// <returns>True - if registered, False - if not registered.</returns>
        private static bool isClientRegistered(Guid clientGuid)
        {
            Monitor.Enter(s_AdminCallbacks);

            try
            {
                return s_AdminCallbacks.ContainsKey(clientGuid);
            }
            finally
            {
                Monitor.Exit(s_AdminCallbacks);
            }
        }


        /// <summary>
        /// Determines how many different users are logged on at present.
        /// </summary>
        /// <returns>Number of logged on users.</returns>
        private static int registeredUserCount()
        {
            Dictionary<String, bool> users = new Dictionary<string, bool>();

            Monitor.Enter(s_AdminCallbacks);

            try
            {
                foreach (KeyValuePair<Guid, RegisteredClient> obj in s_AdminCallbacks)
                {
                    if (!users.ContainsKey(obj.Value.ClientData.ClientName))
                    {
                        if (!obj.Value.ClientData.ClientName.Contains("_StackHashDBConfig"))
                            users[obj.Value.ClientData.ClientName] = true;
                    }
                }
                return users.Count;
            }
            finally
            {
                Monitor.Exit(s_AdminCallbacks);
            }
        }

        
        /// <summary>
        /// Registers the client. The client GUID is used to identify the client.
        /// If the same user is already logged in then they are permitted to log 
        /// in again on a different client.
        /// </summary>
        /// <param name="clientData">Unique ID for the installation.</param>
        private static bool registerClient(StackHashClientData clientData)
        {
            return registerClient(clientData, true, true);
        }

Algolia.Search.Models.Common.MoveIndexRequest : Object

Constructors :

public MoveIndexRequest()

Methods :

public String get_Operation()
public Void set_Operation(String value = )
public String get_Destination()
public Void set_Destination(String value = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()

Other methods