Exemplo n.º 1
0
        public override NodeAVL SetParent(IPersistentStore store, NodeAVL n)
        {
            NodeAVLDisk node = this;
            RowAVLDisk  row  = this.row;

            if (!row.KeepInMemory(true))
            {
                row  = (RowAVLDisk)store.Get(this.row, true);
                node = (NodeAVLDisk)row.GetNode(this._iId);
            }
            if (!row.IsInMemory())
            {
                row.KeepInMemory(false);
                throw Error.RuntimeError(0xc9, "NodeAVLDisk");
            }
            row.SetNodesChanged();
            node._iParent = (n == null) ? -1 : n.GetPos();
            if ((n != null) && !n.IsInMemory())
            {
                n = this.FindNode(store, n.GetPos());
            }
            node.nParent = n;
            row.KeepInMemory(false);
            return(node);
        }
Exemplo n.º 2
0
        public override void Replace(IPersistentStore store, Index index, NodeAVL n)
        {
            NodeAVLDisk node = this;
            RowAVLDisk  row  = this.row;

            if (!row.KeepInMemory(true))
            {
                row  = (RowAVLDisk)store.Get(this.row, true);
                node = (NodeAVLDisk)row.GetNode(this._iId);
            }
            if (node._iParent == -1)
            {
                if (n != null)
                {
                    n = n.SetParent(store, null);
                }
                store.SetAccessor(index, n);
            }
            else
            {
                bool isLeft = node.IsFromLeft(store);
                node.GetParent(store).Set(store, isLeft, n);
            }
            row.KeepInMemory(false);
        }
Exemplo n.º 3
0
        public void Handle(DepositDetected cmd)
        {
            var depositJob = _store.Get <LabelDepositJobDto>(cmd.Key);

            depositJob.Label  = cmd.Label.ToString();
            depositJob.Status = "Waiting for Download";
            _store.Store(depositJob);
        }
Exemplo n.º 4
0
 public override Row GetRow(IPersistentStore store)
 {
     if (!this.row.IsInMemory())
     {
         return((RowAVLDisk)store.Get(this.row, false));
     }
     this.row.UpdateAccessCount(store.GetAccessCount());
     return(this.row);
 }
Exemplo n.º 5
0
        private ICachedObject GetFromFile(int pos, IPersistentStore store, bool keep)
        {
            ICachedObject obj2;

            Monitor.Enter(this.Lock);
            try
            {
                ICachedObject row = this.cache.Get(pos);
                if (row != null)
                {
                    if (keep)
                    {
                        row.KeepInMemory(true);
                    }
                    return(row);
                }
                for (int i = 0; i < 2; i++)
                {
                    try
                    {
                        IRowInputInterface interface2 = this.ReadObject(pos);
                        if (interface2 == null)
                        {
                            return(null);
                        }
                        row = store.Get(interface2);
                        break;
                    }
                    catch (OutOfMemoryException)
                    {
                        this.cache.ForceCleanUp();
                        if (i > 0)
                        {
                            throw;
                        }
                    }
                }
                pos = row.GetPos();
                this.cache.Put(pos, row);
                if (keep)
                {
                    row.KeepInMemory(true);
                }
                store.Set(row);
                obj2 = row;
            }
            catch (CoreException exception)
            {
                this.database.logger.LogSevereEvent(this.DataFileName + FwNs.Core.LC.cResources.SR.DataFileCache_GetFromFile__getFromFile_ + pos, exception);
                throw;
            }
            finally
            {
                Monitor.Exit(this.Lock);
            }
            return(obj2);
        }
Exemplo n.º 6
0
        public override bool IsRoot(IPersistentStore store)
        {
            NodeAVLDisk node = this;

            if (!this.row.IsInMemory())
            {
                node = (NodeAVLDisk)((RowAVLDisk)store.Get(this.row, false)).GetNode(this._iId);
            }
            return(node._iParent == -1);
        }
Exemplo n.º 7
0
        public override int GetBalance(IPersistentStore store)
        {
            NodeAVLDisk node = this;

            if (!this.row.IsInMemory())
            {
                node = (NodeAVLDisk)((RowAVLDisk)store.Get(this.row, false)).GetNode(this._iId);
            }
            return(node.IBalance);
        }
Exemplo n.º 8
0
        private NodeAVLDisk FindNode(IPersistentStore store, int pos)
        {
            NodeAVLDisk node  = null;
            RowAVLDisk  disk2 = (RowAVLDisk)store.Get(pos, false);

            if (disk2 != null)
            {
                node = (NodeAVLDisk)disk2.GetNode(this._iId);
            }
            return(node);
        }
Exemplo n.º 9
0
        public override void Delete(IPersistentStore store)
        {
            RowAVLDisk disk = this;

            if (!disk.KeepInMemory(true))
            {
                disk = (RowAVLDisk)store.Get(disk, true);
            }
            base.Delete(store);
            disk.KeepInMemory(false);
        }
Exemplo n.º 10
0
        public void Delete(Session session, IPersistentStore store, Row row)
        {
            if (!row.IsInMemory())
            {
                row = (Row)store.Get(row, false);
            }
            NodeAVL node = ((RowAVL)row).GetNode(this.Position);

            if (node != null)
            {
                this.Delete(store, node);
                store.UpdateElementCount(this, -1, -1);
            }
        }
Exemplo n.º 11
0
        public override bool IsFromLeft(IPersistentStore store)
        {
            NodeAVLDisk node = this;

            if (!this.row.IsInMemory())
            {
                node = (NodeAVLDisk)((RowAVLDisk)store.Get(this.row, false)).GetNode(this._iId);
            }
            if (node._iParent == -1)
            {
                return(true);
            }
            if ((node.nParent == null) || !node.nParent.IsInMemory())
            {
                node.nParent = this.FindNode(store, this._iParent);
            }
            return(this.GetPos() == ((NodeAVLDisk)node.nParent)._iLeft);
        }
Exemplo n.º 12
0
        public override NodeAVL GetParent(IPersistentStore store)
        {
            NodeAVLDisk node = this;

            if (!this.row.IsInMemory())
            {
                node = (NodeAVLDisk)((RowAVLDisk)store.Get(this.row, false)).GetNode(this._iId);
            }
            if (node._iParent == -1)
            {
                return(null);
            }
            if ((node.nParent == null) || !node.nParent.IsInMemory())
            {
                node.nParent = this.FindNode(store, this._iParent);
            }
            return(node.nParent);
        }
Exemplo n.º 13
0
        public override NodeAVL SetBalance(IPersistentStore store, int b)
        {
            NodeAVLDisk node = this;
            RowAVLDisk  row  = this.row;

            if (!row.KeepInMemory(true))
            {
                row  = (RowAVLDisk)store.Get(this.row, true);
                node = (NodeAVLDisk)row.GetNode(this._iId);
            }
            if (!row.IsInMemory())
            {
                throw Error.RuntimeError(0xc9, "NodeAVLDisk");
            }
            row.SetNodesChanged();
            node.IBalance = b;
            row.KeepInMemory(false);
            return(node);
        }
Exemplo n.º 14
0
        private Row GetRow(Session session, object[] args)
        {
            int              columnCount = this._result.MetaData.GetColumnCount();
            long             rowId       = Convert.ToInt64(args[columnCount]);
            IPersistentStore rowStore    = base.BaseTable.GetRowStore(session);
            Row              row         = null;

            if ((columnCount + 2) == this._result.MetaData.GetExtendedColumnCount())
            {
                object[] data = ((RowSetNavigatorData)this._result.GetNavigator()).GetData(rowId);
                if (data != null)
                {
                    row = (Row)data[columnCount + 1];
                }
            }
            else
            {
                int key = (int)rowId;
                row = (Row)rowStore.Get(key, false);
            }
            this._result = null;
            return(row);
        }
Exemplo n.º 15
0
Arquivo: Row.cs Projeto: cwdotson/FwNs
        public virtual bool IsDeleted(Session session, IPersistentStore store)
        {
            RowAction rowAction = ((Row)store.Get(this, false)).rowAction;

            return((rowAction != null) && !rowAction.CanRead(session, 0));
        }