public FixedArrayComboListEnumerator[] GetEnumerators(byte[] dlldata, string classname, string pluginsource) { ensureopen("GetEnumerators"); ensurenotenumd("GetEnumerators"); ensurewassortd("GetEnumerators"); enumd = true; FixedArrayComboListEnumerator[] results; lock (dslaves) { int i; results = new FixedArrayComboListEnumerator[dslaves.Count]; i = 0; foreach (SlaveInfo _slave in dslaves) { BufSlaveInfo slave = (BufSlaveInfo)_slave; lock (slave) { bool flushed = slave.FlushAddBuf_unlocked(); if (flushed) { slave.SlaveErrorCheck(); } } results[i] = new FixedArrayComboListEnumerator(this, slave, dlldata, classname, pluginsource); results[i].buf = this.buf; // Not needed, but fine. i++; } } return(results); }
protected override void ProcessCommand(NetworkStream nstm, char tag) { //string s; int len; switch (tag) { case 'F': // 'F' for BeforeLoad (first) { string classname = XContent.ReceiveXString(nstm, buf); string xlibfn = CreateXlibFileName("load"); { buf = XContent.ReceiveXBytes(nstm, out len, buf); if (0 != len) { System.IO.FileStream stm = System.IO.File.Create(xlibfn); stm.Write(buf, 0, len); stm.Close(); } } string dllfn = CreateDllFileName("load"); { buf = XContent.ReceiveXBytes(nstm, out len, buf); System.IO.FileStream stm = System.IO.File.Create(dllfn); stm.Write(buf, 0, len); stm.Close(); } if (XLog.logging) { string xclassname = classname; if (null == xclassname) { xclassname = "<null>"; } XLog.log("Loading IBeforeReduceFixed plugin named " + xclassname + " for before-load: " + dllfn); } IBeforeLoad bl = LoadBeforeLoadPlugin(dllfn, classname); LoadOutput loadoutput = new ACLLoadOutput(this); bl.OnBeforeLoad(loadoutput); } break; case 'D': // Enumerator DLL binary. { string classname = XContent.ReceiveXString(nstm, buf); string xlibfn = CreateXlibFileName("enum"); { buf = XContent.ReceiveXBytes(nstm, out len, buf); if (0 != len) { System.IO.FileStream stm = System.IO.File.Create(xlibfn); stm.Write(buf, 0, len); stm.Close(); } } string dllfn = CreateDllFileName("enum"); { buf = XContent.ReceiveXBytes(nstm, out len, buf); System.IO.FileStream stm = System.IO.File.Create(dllfn); stm.Write(buf, 0, len); stm.Close(); } if (XLog.logging) { string xclassname = classname; if (null == xclassname) { xclassname = "<null>"; } XLog.log("Loading IBeforeReduceFixed plugin named " + xclassname + " for enumeration: " + dllfn); } IBeforeReduceFixed plugin = LoadBeforeReducePlugin(dllfn, classname); benum = new FixedArrayComboListEnumerator(this, plugin); } break; case 'e': // Batch 'get next' enumeration. { try { if (null == benum) { benum = new FixedArrayComboListEnumerator(this, new FixedEntryEnumerator()); } benum.Go(); } catch { nstm.WriteByte((byte)'-'); //... throw; } } break; case 's': try { #if ENABLE_TIMING long start = 0; if(XLog.logging) { QueryPerformanceCounter(out start); } #endif int readkeybuflen = 1048576; int readvaluebuflen = 1048576; if (null != DistributedObjectsSlave.xslave) { System.Xml.XmlNode xzblocks = DistributedObjectsSlave.xslave["zblocks"]; if (null != xzblocks) { { System.Xml.XmlAttribute xzbs = xzblocks.Attributes["readbuffersize"]; if (null != xzbs) { int x = DistributedObjectsSlave.ParseCapacity(xzbs.Value); readkeybuflen = x; readvaluebuflen = x; } } { System.Xml.XmlAttribute xzbs = xzblocks.Attributes["readkeybuffersize"]; if (null != xzbs) { readkeybuflen = DistributedObjectsSlave.ParseCapacity(xzbs.Value); } } { System.Xml.XmlAttribute xzbs = xzblocks.Attributes["readvaluebuffersize"]; if (null != xzbs) { readvaluebuflen = DistributedObjectsSlave.ParseCapacity(xzbs.Value); } } } } foreach (ZBlock zb in zblocks) { zb.LeaveAddMode(readkeybuflen, readvaluebuflen); } foreach (ZBlock zb in zblocks) { zb.Sort(kentries, ref ebytes); } kentries = new List<ZBlock.KeyBlockEntry>(1); // Non-null, but release larger kentries. #if ENABLE_TIMING if(XLog.logging) { long stop; QueryPerformanceCounter(out stop); long freq; if(QueryPerformanceFrequency(out freq)) { long secs = (stop - start) / freq; if(secs > 10) { XLog.log("ArrayComboListPart sort seconds: " + secs.ToString()); } } } #endif nstm.WriteByte((byte)'+'); } catch { nstm.WriteByte((byte)'-'); throw; } break; case 'p': // Batch put/publish... { buf = XContent.ReceiveXBytes(nstm, out len, buf); uint gbfree = (uint)(GetCurrentDiskFreeBytes() / 1073741824); #if DEBUG { string computer_name = System.Environment.GetEnvironmentVariable("COMPUTERNAME"); if (computer_name == "MAPDDRULE" || computer_name == "MAPDCMILLER" || computer_name == "MAPDCLOK") { gbfree = uint.MaxValue; } } #endif if (gbfree > 20) { for (int y = 0; y < len; ) { y += TimedAddKVBuf(buf, y); } } else { if (!nofreedisklog) { nofreedisklog = true; XLog.errorlog("Low free disk space; now dropping keys/values."); } } } break; default: base.ProcessCommand(nstm, tag); break; } }
public FixedArrayComboListEnumerator[] GetEnumerators(byte[] dlldata, string classname, string pluginsource) { ensureopen("GetEnumerators"); ensurenotenumd("GetEnumerators"); ensurewassortd("GetEnumerators"); enumd = true; FixedArrayComboListEnumerator[] results; lock (dslaves) { int i; results = new FixedArrayComboListEnumerator[dslaves.Count]; i = 0; foreach (SlaveInfo _slave in dslaves) { BufSlaveInfo slave = (BufSlaveInfo)_slave; lock (slave) { bool flushed = slave.FlushAddBuf_unlocked(); if (flushed) { slave.SlaveErrorCheck(); } } results[i] = new FixedArrayComboListEnumerator(this, slave, dlldata, classname, pluginsource); results[i].buf = this.buf; // Not needed, but fine. i++; } } return results; }