public virtual void Add(Int64 a, Int32 b) { if (!didopen) { throw new Exception("Must Open before writing to Hashtable"); } B12 b12; // = new B12(a, b); b12.A = a; b12.B = b; int slaveID = (int)(b12.A % dslaves.Count); /*if (slaveID < 0 || slaveID >= dslaves.Count) * { * throw new Exception("Slave missing: slaveID needed: " + slaveID.ToString()); * }*/ SlaveInfo slave = dslaves[slaveID]; lock (slave) { if (addbufinitsize > 0) { BufSlaveInfo bslave = (BufSlaveInfo)slave; bslave.EnsureAddBuf_unlocked(addbufinitsize); b12.CopyToArray(buf); bslave.AddBuf_unlocked(buf, 12); } } }
public void Add(IList <byte> key, int keyoffset, IList <byte> value, int valueoffset) { ensureopen("Add"); ensurenotenumd("Add"); ensurenotsortd("Add"); int slaveID = DetermineSlave(key, keyoffset, this.keylen); /*if (slaveID < 0 || slaveID >= dslaves.Count) * { * throw new Exception("Slave missing: slaveID needed: " + slaveID.ToString()); * }*/ SlaveInfo slave = dslaves[slaveID]; lock (slave) { BufSlaveInfo bslave = (BufSlaveInfo)slave; bslave.EnsureAddBuf_unlocked(addbufinitsize); bool flushed = bslave.AddBuf_unlocked(key, keyoffset, this.keylen, value, valueoffset, this.valuelen); if (flushed) { bslave.SlaveErrorCheck(); } } }
public virtual void Add(int a, int b) { if (!didopen) { throw new Exception("Must Open before writing to Hashtable"); } B8 b8; // = new B8(a, b); b8.A = a; b8.B = b; //b8.CopyToArray(buf); //int slaveID = DetermineSlave(buf, 8); int slaveID = ((b8.A ^ b8.B) & 0x7FFFFFFF) % dslaves.Count; /*if (slaveID < 0 || slaveID >= dslaves.Count) * { * throw new Exception("Slave missing: slaveID needed: " + slaveID.ToString()); * }*/ SlaveInfo slave = dslaves[slaveID]; lock (slave) { if (addbufinitsize > 0) { BufSlaveInfo bslave = (BufSlaveInfo)slave; bslave.EnsureAddBuf_unlocked(addbufinitsize); b8.CopyToArray(buf); bslave.AddBuf_unlocked(buf, 8); } else { // 'P' for publish/put slave.nstm.WriteByte((byte)'P'); DistObject.ToBytes(Int32.MaxValue, buf, 0); XContent.SendXContent(slave.nstm, buf, 4); b8.CopyToArray(buf); XContent.SendXContent(slave.nstm, buf, 8); // Note: no confirmation } } }