public async Task <IActionResult> Edit(int id, [Bind("Da5515Id,UserId,CustomerId,DocNumber,RecUnit,RecDate,Tidate,Notes,Da5515copy")] LocalTransaction localTransaction) { if (id != localTransaction.Da5515Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(localTransaction); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocalTransactionExists(localTransaction.Da5515Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(localTransaction)); }
internal QCandidates(LocalTransaction a_trans, ClassMetadata a_classMetadata, QField a_field, bool isTopLevel) { // Transaction necessary as reference to stream // collection of all constraints // possible class information // possible field information // current executing constraint, only set where needed _result = new QueryResultCandidates(this); _isTopLevel = isTopLevel; i_trans = a_trans; _classMetadata = a_classMetadata; _field = a_field; if (a_field == null || a_field._fieldMetadata == null || !(a_field._fieldMetadata .GetHandler() is StandardReferenceTypeHandler)) { return; } ClassMetadata yc = ((StandardReferenceTypeHandler)a_field._fieldMetadata.GetHandler ()).ClassMetadata(); if (_classMetadata == null) { _classMetadata = yc; } else { yc = _classMetadata.GetHigherOrCommonHierarchy(yc); if (yc != null) { _classMetadata = yc; } } }
public override async Task <Enums.eSyncResult> SaveAndSync(ISUPModel sender) { InteraccionModel <InteraccionBusiness> interaccion = sender as InteraccionModel <InteraccionBusiness>; Enums.eSyncResult syncResult = Enums.eSyncResult.Synchronized; LocalTransaction localTransaction = CRMMobileDesaDB.BeginTransaction(); try { if (interaccion.Formulario_CodigoSAP != null) { // Save formularios guardarFormularios(interaccion); guardarRelevamientos(interaccion); } // Save this and sync Transacciones syncResult = await base.SaveAndSync(sender, new Func <ISUPModel, Task <bool> >(syncTransacciones)); localTransaction.Commit(); } catch (Exception ex) { localTransaction.Rollback(); throw ex; } return(syncResult); }
public override Msg ReplyFromServer() { IServerMessageDispatcher dispatcher = ServerMessageDispatcher(); lock (ContainerLock()) { LocalTransaction trans = ServerTransaction(); long replicationRecordId = ReadLong(); long timestamp = ReadLong(); IList concurrentTimestamps = trans.ConcurrentReplicationTimestamps(); ServerMessageDispatcher().Server().BroadcastReplicationCommit(timestamp, concurrentTimestamps ); ReplicationRecord replicationRecord = (ReplicationRecord)Container().GetByID(trans , replicationRecordId); Container().Activate(trans, replicationRecord, new FixedActivationDepth(int.MaxValue )); replicationRecord.SetVersion(timestamp); replicationRecord.ConcurrentTimestamps(concurrentTimestamps); replicationRecord.Store(trans); Container().StoreAfterReplication(trans, replicationRecord, Container().UpdateDepthProvider ().ForDepth(int.MaxValue), false); trans.Commit(dispatcher); committedInfo = dispatcher.CommittedInfo(); Transaction().UseDefaultTransactionTimestamp(); } return(Msg.Ok); }
public _IVisitor4_336(DefragmentServicesImpl _enclosing, CommitTimestampSupport target , LocalTransaction targetTransaction) { this._enclosing = _enclosing; this.target = target; this.targetTransaction = targetTransaction; }
/// <exception cref="System.Exception"></exception> public static void AssertAllSlotsFreed(LocalTransaction trans, BTree bTree, ICodeBlock block) { LocalObjectContainer container = (LocalObjectContainer)trans.Container(); ITransactionalIdSystem idSystem = trans.IdSystem(); IEnumerator allSlotIDs = bTree.AllNodeIds(trans.SystemTransaction()); Collection4 allSlots = new Collection4(); while (allSlotIDs.MoveNext()) { int slotID = ((int)allSlotIDs.Current); Slot slot = idSystem.CurrentSlot(slotID); allSlots.Add(slot); } Slot bTreeSlot = idSystem.CurrentSlot(bTree.GetID()); allSlots.Add(bTreeSlot); Collection4 freedSlots = new Collection4(); IFreespaceManager freespaceManager = container.FreespaceManager(); container.InstallDebugFreespaceManager(new FreespaceManagerForDebug(new _ISlotListener_99 (freedSlots))); block.Run(); container.InstallDebugFreespaceManager(freespaceManager); Assert.IsTrue(freedSlots.ContainsAll(allSlots.GetEnumerator())); }
internal QCandidates(LocalTransaction a_trans, ClassMetadata a_classMetadata, QField a_field) { // Transaction necessary as reference to stream // root of the QCandidate tree // collection of all constraints // possible class information // possible field information // current executing constraint, only set where needed i_trans = a_trans; i_classMetadata = a_classMetadata; _field = a_field; if (a_field == null || a_field._fieldMetadata == null || !(a_field._fieldMetadata .GetHandler() is StandardReferenceTypeHandler)) { return; } ClassMetadata yc = ((StandardReferenceTypeHandler)a_field._fieldMetadata.GetHandler ()).ClassMetadata(); if (i_classMetadata == null) { i_classMetadata = yc; } else { yc = i_classMetadata.GetHigherOrCommonHierarchy(yc); if (yc != null) { i_classMetadata = yc; } } }
internal QCandidates(LocalTransaction a_trans, ClassMetadata a_classMetadata, QField a_field) { // Transaction necessary as reference to stream // root of the QCandidate tree // collection of all constraints // possible class information // possible field information // current executing constraint, only set where needed i_trans = a_trans; i_classMetadata = a_classMetadata; _field = a_field; if (a_field == null || a_field._fieldMetadata == null || !(a_field._fieldMetadata .GetHandler() is StandardReferenceTypeHandler)) { return; } var yc = ((StandardReferenceTypeHandler) a_field._fieldMetadata.GetHandler ()).ClassMetadata(); if (i_classMetadata == null) { i_classMetadata = yc; } else { yc = i_classMetadata.GetHigherOrCommonHierarchy(yc); if (yc != null) { i_classMetadata = yc; } } }
public async Task TestTransactionalPublishString_Commit() { using (var tx = new LocalTransaction()) { await bus.PublishAsync(Event.Create("This should be committed!")); tx.Complete(); } }
public SodaQueryComparator(LocalObjectContainer container, ClassMetadata extent, Ordering[] orderings) { _container = container; _transaction = ((LocalTransaction) _container.Transaction); _extentType = extent; _orderings = orderings; ResolveFieldPaths(orderings); }
public SodaQueryComparator(LocalObjectContainer container, ClassMetadata extent, SodaQueryComparator.Ordering[] orderings) { _container = container; _transaction = ((LocalTransaction)_container.Transaction); _extentType = extent; _orderings = orderings; ResolveFieldPaths(orderings); }
private void FreeAllNodeIds(LocalTransaction systemTrans, IEnumerator allNodeIDs) { ITransactionalIdSystem idSystem = IdSystem(systemTrans); while (allNodeIDs.MoveNext()) { int id = ((int)allNodeIDs.Current); idSystem.NotifySlotDeleted(id, SlotChangeFactory()); } }
public async Task <IActionResult> Create([Bind("Da5515Id,UserId,CustomerId,DocNumber,RecUnit,RecDate,Tidate,Notes,Da5515copy")] LocalTransaction localTransaction) { if (ModelState.IsValid) { _context.Add(localTransaction); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(localTransaction)); }
public async Task <IDatasourceConnection> GetConnectionAsync() { LocalTransaction tx = LocalTransaction.Current; if (tx != null) { return(await tx.BeginOrJoinTransactionAsync(_underlying)); } return(await _underlying.GetConnectionAsync()); }
public virtual void BroadcastReplicationCommit(long timestamp, IList concurrentTimestamps ) { IEnumerator i = IterateDispatchers(); while (i.MoveNext()) { IServerMessageDispatcher dispatcher = (IServerMessageDispatcher)i.Current; LocalTransaction transaction = (LocalTransaction)dispatcher.Transaction(); transaction.NotifyAboutOtherReplicationCommit(timestamp, concurrentTimestamps); } }
public virtual void ReadIdentity(LocalTransaction trans) { LocalObjectContainer file = trans.LocalContainer(); Db4oDatabase identity = Debug4.staticIdentity ? Db4oDatabase.StaticIdentity : (Db4oDatabase )file.GetByID(trans, SystemData().IdentityId()); if (null != identity) { file.Activate(trans, identity, new FixedActivationDepth(2)); SystemData().Identity(identity); } }
public virtual void ReadIdentity(LocalTransaction trans) { var file = trans.LocalContainer(); var identity = Debug4.staticIdentity ? Db4oDatabase.StaticIdentity : (Db4oDatabase ) file.GetByID(trans, SystemData().IdentityId()); if (null != identity) { file.Activate(trans, identity, new FixedActivationDepth(2)); SystemData().Identity(identity); } }
public override void Free(LocalTransaction trans) { _dead = true; if (!IsRoot()) { Db4objects.Db4o.Internal.Btree.BTreeNode parent = _btree.ProduceNode(_parentID); parent.RemoveChild(trans, this); } PointPreviousTo(trans, _nextID); PointNextTo(trans, _previousID); base.Free((LocalTransaction)trans); _btree.RemoveNode(this); _btree.NotifyDeleted(trans, this); }
public async Task TestPerformance_SingleCommit() { Stopwatch watch = Stopwatch.StartNew(); using (var tx = new LocalTransaction()) { for (int i = 0; i < 1000; i++) { await bus.PublishAsync(Event.Create("hello world")); } tx.Complete(); } Console.WriteLine($"Published 1000 messages in {watch.Elapsed}"); }
private long CommitTimestampUsage() { LocalTransaction st = (LocalTransaction)_db.SystemTransaction(); CommitTimestampSupport commitTimestampSupport = st.CommitTimestampSupport(); if (commitTimestampSupport == null) { return(0); } BTree idToTimestampBtree = commitTimestampSupport.IdToTimestamp(); long idToTimestampBTreeSize = idToTimestampBtree == null ? 0 : BTreeUsage(idToTimestampBtree ); BTree timestampToIdBtree = commitTimestampSupport.TimestampToId(); long timestampToIdBTreeSize = timestampToIdBtree == null ? 0 : BTreeUsage(timestampToIdBtree ); return(idToTimestampBTreeSize + timestampToIdBTreeSize); }
public virtual ByteArrayBuffer Marshall(LocalTransaction transaction, IIntIterator4 ids, int count) { ByteArrayBuffer buffer = new ByteArrayBuffer(Const4.IntLength + count * Const4.IntLength ); int sizeOffset = buffer.Offset(); buffer.WriteInt(0); int written = 0; while (count > 0 && ids.MoveNext()) { buffer.WriteInt(ids.CurrentInt()); ++written; --count; } buffer.Seek(sizeOffset); buffer.WriteInt(written); return(buffer); }
public virtual void DefragIdToTimestampBtree() { if (_sourceDb.SystemData().IdToTimestampIndexId() == 0) { return; } LocalTransaction targetTransaction = (LocalTransaction)_targetDb.SystemTransaction (); LocalTransaction sourceTransaction = (LocalTransaction)_sourceDb.SystemTransaction (); CommitTimestampSupport target = targetTransaction.CommitTimestampSupport(); CommitTimestampSupport source = sourceTransaction.CommitTimestampSupport(); if (source.IdToTimestamp() == null) { return; } source.IdToTimestamp().TraverseKeys(sourceTransaction, new _IVisitor4_336(this, target , targetTransaction)); }
protected virtual void RebuildIndexForWriter(LocalObjectContainer container, StatefulBuffer buffer, int objectId) { ObjectHeader objectHeader = new ObjectHeader(container, buffer); ObjectIdContextImpl context = new ObjectIdContextImpl(container.SystemTransaction (), buffer, objectHeader, objectId); ClassMetadata classMetadata = context.ClassMetadata(); if (classMetadata.IsStruct()) { // We don't keep version information for structs. return; } if (classMetadata.SeekToField(container.SystemTransaction(), buffer, versionFieldMetadata ) != HandlerVersion.Invalid) { long version = ((long)versionFieldMetadata.Read(context)); if (version != 0) { LocalTransaction t = (LocalTransaction)container.SystemTransaction(); t.CommitTimestampSupport().Put(container.SystemTransaction(), objectId, version); } } }
public StandardSlotAccessor(LocalTransaction transaction) { _transaction = transaction; }
public override void Free(LocalTransaction systemTrans) { _disposed = true; FreeAllNodeIds(systemTrans, AllNodeIds(systemTrans)); base.Free((LocalTransaction)systemTrans); }
private void AddCommittedInfoMsg(CallbackObjectInfoCollections committedInfo, LocalTransaction serverTransaction) { lock (ContainerLock()) { Msg.CommittedInfo.SetTransaction(serverTransaction); MCommittedInfo message = Msg.CommittedInfo.Encode(committedInfo, ServerMessageDispatcher ().DispatcherID()); message.SetMessageDispatcher(ServerMessageDispatcher()); ServerMessageDispatcher().Server().AddCommittedInfoMsg(message); } }
public virtual ByteArrayBuffer Marshall(LocalTransaction transaction, IIntIterator4 ids, int maxCount) { return(new EagerObjectWriter(_config, transaction).Write(ids, maxCount)); }
public EagerObjectWriter(ObjectExchangeConfiguration config, LocalTransaction transaction ) { _config = config; _transaction = transaction; }
public override void Free(LocalTransaction systemTrans) { _disposed = true; FreeAllNodeIds(systemTrans, AllNodeIds(systemTrans)); base.Free(systemTrans); }
private void FreeAllNodeIds(LocalTransaction systemTrans, IEnumerator allNodeIDs) { var idSystem = IdSystem(systemTrans); while (allNodeIDs.MoveNext()) { var id = ((int) allNodeIDs.Current); idSystem.NotifySlotDeleted(id, SlotChangeFactory()); } }
public override void Free(LocalTransaction trans) { _dead = true; if (!IsRoot()) { var parent = _btree.ProduceNode(_parentID); parent.RemoveChild(trans, this); } PointPreviousTo(trans, _nextID); PointNextTo(trans, _previousID); base.Free(trans); _btree.RemoveNode(this); _btree.NotifyDeleted(trans, this); }