@Override
  public void applySlotChanges(
      Visitable<SlotChange> slotChangeTree, int slotChangeCount, Slot reservedSlot) {
    if (slotChangeCount < 1) {
      return;
    }

    Runnable commitHook = _container.commitHook();
    flushDatabaseFile();

    ensureLogAndLock();
    int length = transactionLogSlotLength(slotChangeCount);
    ByteArrayBuffer logBuffer = new ByteArrayBuffer(length);
    logBuffer.writeInt(length);
    logBuffer.writeInt(slotChangeCount);

    appendSlotChanges(logBuffer, slotChangeTree);
    write(_logFile, logBuffer);
    _logFile.sync();

    writeToLockFile(LOCK_INT);

    writeSlots(slotChangeTree);
    commitHook.run();
    flushDatabaseFile();
    writeToLockFile(0);
  }
Пример #2
0
 public void write(ByteArrayBuffer writer) {
   if (slotModified()) {
     writer.writeInt(_key);
     writer.writeInt(_newSlot.address());
     writer.writeInt(_newSlot.length());
   }
 }
Пример #3
0
 public void write(ByteArrayBuffer writer) {
   writer.writeInt(indexAddress);
   writer.writeInt(indexEntries);
   writer.writeInt(indexLength);
   writer.writeInt(patchAddress);
   writer.writeInt(patchEntries);
   writer.writeInt(patchLength);
 }
 private void writeToLockFile(int lockSignal) {
   ByteArrayBuffer lockBuffer = newLockFileBuffer();
   lockBuffer.writeInt(lockSignal);
   lockBuffer.writeInt(lockSignal);
   write(_lockFile, lockBuffer);
   _lockFile.sync();
 }
  public void write(
      final Transaction trans, final ClassMetadata clazz, final ByteArrayBuffer writer) {

    writer.writeShortString(trans, clazz.nameToWrite());

    int intFormerlyKnownAsMetaClassID = 0;
    writer.writeInt(intFormerlyKnownAsMetaClassID);

    writer.writeIDOf(trans, clazz.i_ancestor);

    writeIndex(trans, clazz, writer);

    writer.writeInt(clazz.declaredAspectCount());
    clazz.forEachDeclaredAspect(
        new Procedure4() {
          public void apply(Object arg) {
            _family._field.write(trans, clazz, (ClassAspect) arg, writer);
          }
        });
  }
Пример #6
0
 public final void write(ByteArrayBuffer a_writer) {
   // byte order: size, address
   a_writer.writeInt(_key);
   a_writer.writeInt(_peer._key);
 }
 protected void writeIndex(Transaction trans, ClassMetadata clazz, ByteArrayBuffer writer) {
   int indexID = clazz.index().write(trans);
   writer.writeInt(indexIDForWriting(indexID));
 }