Пример #1
0
        public virtual void SetPersister(IBTreePersister persister)
        {
            _persister = persister;
            _persister.SetBTree(this);

            if (_root.GetBTree() == null)
            {
                _root.SetBTree(this);
            }
        }
Пример #2
0
        /// <summary>
        ///   saves the bree node Only puts the current node in an 'modified Node' map to be saved on commit
        /// </summary>
        public void SaveNode(IBTreeNode node)
        {
            OID oid;

            // Here we only save the node if it does not have id,
            // else we just save into the hashmap
            if (node.GetId() == StorageEngineConstant.NullObjectId)
            {
                try
                {
                    // first get the oid. : -2:it could be any value
                    oid = _engine.GetObjectWriter().GetIdManager().GetNextObjectId(-2);
                    node.SetId(oid);

                    oid = _engine.Store(oid, node);

                    if (OdbConfiguration.IsLoggingEnabled())
                    {
                        DLogger.Debug(string.Format("LazyOdbBtreePersister: Saved node id {0}", oid));
                    }

                    // + " : " +
                    // node.toString());
                    if (_tree != null && node.GetBTree() == null)
                    {
                        node.SetBTree(_tree);
                    }

                    _oids.Add(oid, node);
                    return;
                }
                catch (Exception e)
                {
                    throw new OdbRuntimeException(BTreeError.InternalError.AddParameter("While saving node"), e);
                }
            }

            oid = (OID)node.GetId();

            _oids.Add(oid, node);
            AddModifiedOid(oid);
        }
Пример #3
0
        /// <summary>
        ///   saves the bree node Only puts the current node in an 'modified Node' map to be saved on commit
        /// </summary>
        public void SaveNode(IBTreeNode node)
        {
            OID oid;
            // Here we only save the node if it does not have id,
            // else we just save into the hashmap
            if (node.GetId() == StorageEngineConstant.NullObjectId)
            {
                try
                {
                    // first get the oid. : -2:it could be any value
                    oid = _engine.GetObjectWriter().GetIdManager().GetNextObjectId(-2);
                    node.SetId(oid);

                    oid = _engine.Store(oid, node);

                    if (OdbConfiguration.IsLoggingEnabled())
                        DLogger.Debug(string.Format("LazyOdbBtreePersister: Saved node id {0}", oid));

                    // + " : " +
                    // node.toString());
                    if (_tree != null && node.GetBTree() == null)
                        node.SetBTree(_tree);

                    _oids.Add(oid, node);
                    return;
                }
                catch (Exception e)
                {
                    throw new OdbRuntimeException(BTreeError.InternalError.AddParameter("While saving node"), e);
                }
            }

            oid = (OID) node.GetId();

            _oids.Add(oid, node);
            AddModifiedOid(oid);
        }