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) { TypeCache.TryGetProxyType(typeName, out Type proxyT); output.Add(DbProxy.MakeProxyEvent(typeName, opaqueRef, eventOperation, proxyT, _proxy.get_record(typeName, opaqueRef, false))); } } } } return(output); }
public void SendDestroyObject(string typeName, string opaqueRef) { // Make a Proxy object from the new XML TypeCache.TryGetProxyType(typeName, out Type proxyT); // Make a Proxy_Event representing this edit, and add it to the events queue lock (eventsListLock) { eventsList.Add(MakeProxyEvent(typeName, opaqueRef, "del", proxyT, Activator.CreateInstance(proxyT))); } }
/// <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; TypeCache.TryGetProxyType(name, out _xapiType); _rows.Changed += delegate { OnChanged(EventArgs.Empty); }; }
public void SendModObject(string typeName, string opaqueRef) { // Make a Proxy object from the new XML TypeCache.TryGetProxyType(typeName, out Type proxyT); object proxy = get_record(typeName, opaqueRef, false); // Make a Proxy_Event representing this edit, and add it to the events queue lock (eventsListLock) { eventsList.Add(MakeProxyEvent(typeName, opaqueRef, "mod", proxyT, proxy)); } }
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 TypeCache.TryGetProxyType(typeName, out Type proxyT); object proxy = get_record(typeName, opaqueRef, false); // Make a Proxy_Event representing this edit, and add it to the events queue lock (eventsListLock) { eventsList.Add(MakeProxyEvent(typeName, opaqueRef, "mod", proxyT, proxy)); } }