Пример #1
0
        public void SendDestroyObject(string typeName, string opaqueRef)
        {
            // Make a Proxy object from the new XML
            Type proxyT = TypeCache.GetProxyType(typeName);

            // Make a Proxy_Event representing this edit, and add it to the events queue
            eventsList.Add(MakeProxyEvent(typeName, opaqueRef, "del", proxyT, Activator.CreateInstance(proxyT)));
        }
Пример #2
0
        public void SendModObject(string typeName, string opaqueRef)
        {
            // Make a Proxy object from the new XML
            Type   proxyT = TypeCache.GetProxyType(typeName);
            object proxy  = get_record(typeName, opaqueRef, false);

            // Make a Proxy_Event representing this edit, and add it to the events queue
            eventsList.Add(MakeProxyEvent(typeName, opaqueRef, "mod", proxyT, proxy));
        }
Пример #3
0
            /// <summary>
            /// Initializes a new instance of the <see cref="Table"/> class.
            /// </summary>
            /// <param name="name">The name of the table.</param>
            /// <param name="db">The <see cref="Db"/> to which this <see cref="Table"/> is attached.</param>
            public Table(string name, Db db)
            {
                Util.ThrowIfStringParameterNullOrEmpty(name, "name");
                Util.ThrowIfParameterNull(db, "db");

                _rows     = new RowDictionary(this);
                _name     = name.ToLower();
                _db       = db;
                _xapiType = TypeCache.GetProxyType(name);

                _rows.Changed += delegate { OnChanged(EventArgs.Empty); };
            }
Пример #4
0
        public void EditObject_(EditTypes editType, string typeName, string opaqueRef, string field, params object[] args)
        {
            // Edit the XML to have the new value
            edit_record(editType, typeName, opaqueRef, field, args);

            // Make a Proxy object from the new XML
            Type   proxyT = TypeCache.GetProxyType(typeName);
            object proxy  = get_record(typeName, opaqueRef, false);

            // Make a Proxy_Event representing this edit, and add it to the events queue
            eventsList.Add(MakeProxyEvent(typeName, opaqueRef, "mod", proxyT, proxy));
        }
Пример #5
0
        public List <Proxy_Event> GetHighLoadEvents(string[] classes, string eventOperation)
        {
            // this fires an event every 2 seconds (for this connection). This is roughly equivalent to the rate at which events occur
            // during a VM boot up.

            ReadOnlyCollection <string> typeNames = classes.Length == 0 || (classes.Length == 1 && classes[0] == "*")
                                               ? SimpleProxyMethodParser.AllTypes
                                               : new ReadOnlyCollection <string>(classes);

            List <Proxy_Event> output = new List <Proxy_Event>();

            if (HighLoadMode && DateTime.Now - lastHighLoadEvent > TimeSpan.FromSeconds(2))
            {
                lastHighLoadEvent = DateTime.Now;

                foreach (string typeName in typeNames)
                {
                    Response <object> resp;
                    if (TryGetAllRecords(typeName, out resp))
                    {
                        foreach (string opaqueRef in ((Hashtable)resp.Value).Keys)
                        {
                            output.Add(DbProxy.MakeProxyEvent(typeName, opaqueRef, eventOperation, TypeCache.GetProxyType(typeName), _proxy.get_record(typeName, opaqueRef, false)));
                        }
                    }
                }
            }
            return(output);
        }