private void WriteThis(Slot reservedSlot) { // We need a little dance here to keep filling free slots // with X bytes. The FreespaceManager would do it immediately // upon the free call, but then our CrashSimulatingTestCase // fails because we have the Xses in the file before flushing. Slot xByteSlot = null; int slotLength = SlotLength(); if (reservedSlot.Length() >= slotLength) { _slot = reservedSlot; reservedSlot = null; } else { _slot = AllocateSlot(true, slotLength); } ByteArrayBuffer buffer = new ByteArrayBuffer(_slot.Length()); buffer.WriteInt(_childId); _idGenerator.Write(buffer); TreeInt.Write(buffer, _ids); _container.WriteBytes(buffer, _slot.Address(), 0); _container.SystemData().IdSystemSlot(_slot); IRunnable commitHook = _container.CommitHook(); _container.SyncFiles(commitHook); FreeSlot(reservedSlot); }